当前位置: 首页>>代码示例>>Python>>正文


Python Track.updateTransitions方法代码示例

本文整理汇总了Python中pitivi.timeline.track.Track.updateTransitions方法的典型用法代码示例。如果您正苦于以下问题:Python Track.updateTransitions方法的具体用法?Python Track.updateTransitions怎么用?Python Track.updateTransitions使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在pitivi.timeline.track.Track的用法示例。


在下文中一共展示了Track.updateTransitions方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: TestAlpha

# 需要导入模块: from pitivi.timeline.track import Track [as 别名]
# 或者: from pitivi.timeline.track.Track import updateTransitions [as 别名]

#.........这里部分代码省略.........
        self.failUnlessAlphaIsSet()

        # two alpha < 1.0 keyframes
        set_one_keyframe(track_object2, 0.5)
        self.failUnlessAlphaIsSet()

        # one alpha < 1.0 keyframe
        set_one_keyframe(track_object1, 1.0)
        self.failUnlessAlphaIsSet()

        # no alpha < 1.0 keyframes
        set_one_keyframe(track_object2, 1.0)

        self.failUnlessAlphaIsNotSet()

    def testKeyframesOnSameObject(self):
        for track_obj in self.track1.track_objects:
            set_all_keyframes(track_obj, 1.0)
        self.failUnlessAlphaIsNotSet()

        track_object1 = self.track1.track_objects[0]
        interpolator1 = track_object1.getInterpolator("alpha")

        keyframe1 = interpolator1.newKeyframe(1 * gst.SECOND, 0.8)
        self.failUnlessAlphaIsSet()

        keyframe2 = interpolator1.newKeyframe(2 * gst.SECOND, 0.5)
        self.failUnlessAlphaIsSet()

        interpolator1.setKeyframeValue(keyframe1, 1.0)
        self.failUnlessAlphaIsSet()

        interpolator1.removeKeyframe(keyframe2)
        self.failUnlessAlphaIsNotSet()

    def testRemoveTrackObjects(self):
        for track_obj in self.track1.track_objects:
            set_all_keyframes(track_obj, 1.0)

        self.failUnlessAlphaIsNotSet()

        track_object1 = self.track1.track_objects[0]
        track_object2 = self.track1.track_objects[1]

        # set one keyframe below 1.0
        set_one_keyframe(track_object1, 0.8)
        self.failUnlessAlphaIsSet()

        # track_object2 has no alpha < 1.0 keyframes, removing it shouldn't
        # trigger an alpha change
        self.track1.removeTrackObject(track_object2)
        self.failUnlessAlphaIsSet()

        # track_object1 does have an alpha < 1.0 keyframe, removing it should
        # trigger an alpha change
        self.track1.removeTrackObject(track_object1)

        self.failUnlessAlphaIsNotSet()

    def testRequestPads(self):
        # requesting a new pad should never trigger an alpha change

        template = gst.PadTemplate("sink_%u", gst.PAD_SINK, gst.PAD_REQUEST,
                gst.Caps("video/x-raw-yuv;video/x-raw-rgb"))

        for track_obj in self.track1.track_objects:
            set_all_keyframes(track_obj, 1.0)

        # when unset, should remain unset
        self.failUnlessAlphaIsNotSet()
        test_pad1 = self.svmbin.do_request_new_pad(template)
        self.failUnlessAlphaIsNotSet()

        obj = self.track1.track_objects[0]
        set_one_keyframe(obj, 0.8)

        # when set, should remain set
        self.failUnlessAlphaIsSet()
        test_pad2 = self.svmbin.do_request_new_pad(template)
        self.failUnlessAlphaIsSet()

    def testTransitions(self):
        for track_obj in self.track1.track_objects:
            set_all_keyframes(track_obj, 1.0)
        self.failUnlessAlphaIsNotSet()

        track_object1 = self.track1.track_objects[0]
        track_object2 = self.track1.track_objects[1]

        track_object1.start = 0
        track_object2.start = 10 * gst.SECOND

        old_priority = track_object2.priority
        track_object2.priority = track_object1.priority
        self.track1.updateTransitions()
        self.failUnlessAlphaIsSet()

        track_object2.priority = old_priority
        self.track1.updateTransitions()
        self.failUnlessAlphaIsNotSet()
开发者ID:Mathieu69,项目名称:Pitivi_Gargamel,代码行数:104,代码来源:test_alpha_passthrough.py


注:本文中的pitivi.timeline.track.Track.updateTransitions方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。