• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

Python utils.getAction函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Python中sound_drivers.utils.getAction函数的典型用法代码示例。如果您正苦于以下问题:Python getAction函数的具体用法?Python getAction怎么用?Python getAction使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



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

示例1: draw_tweaks

    def draw_tweaks(self, layout, context):

        scene = context.scene

        # Create a simple row.

        row = layout.row()
        '''
        row.context_pointer_set("scene", context.scene)
        row.context_pointer_set("area", context.screen.areas[0])
        row.context_pointer_set("window", context.window)
        row.context_pointer_set("screen", context.screen)
        row.context_pointer_set("region", context.screen.areas[0].regions[-1])
        op = row.operator("graph.clean")
        '''
        op = row.operator("soundaction.tweak", text="CLEAN")
        op.type = 'CLEAN'
        op = row.operator("soundaction.tweak", text="SMOOTH")
        op.type = 'SMOOTH'
        
        row = layout.row()
        #row.prop(op, "threshold")
        action = getAction(context.scene.speaker)
        for xx in action.tweaks:
            row = layout.row()
            row.label("[%s] %s " % (xx.channel_name, xx.type))

            #row.label("%.4f" % xx.threshold)
            row.label("%d" % xx.fcurve_count)
            row.label("%d" % xx.samples_count)
            row.label("%d" % xx.keyframe_count)
开发者ID:batFINGER,项目名称:batFINGER-blender-addons,代码行数:31,代码来源:sound_action.py


示例2: draw_sound_widgets

def draw_sound_widgets(context, wlist):
    speaker = context.scene.speaker
    action = getAction(speaker)
    # action = context.area.sound_action # NEW IDEA REFACTO

    for w in wlist:
        w.draw_action_header_text(speaker, action)
开发者ID:batFINGER,项目名称:batFINGER-blender-addons,代码行数:7,代码来源:BGL_draw_visualiser.py


示例3: visualise

    def visualise(self, context):
        area = context.area
        speaker = context.scene.speaker
        action = getAction(speaker)
        scene = context.scene
        frame = scene.frame_current
        """
        print("MHHM")
        action = context.screen.sound_driver_areas["VIEW_3D_4"].action
        print("THIS WORKING", action)
        #action = context.area.sound_action # NEW IDEA REFACTO
        """
        if action is None:
            return None

        area_settings = self.area_settings(context)
        if area_settings is None:
            return None
        (x, y) = area_settings.loc
        fw = context.area.regions[-1].width - (x + 20)
        fh = context.area.regions[-1].height - 50
        area_settings = self.area_settings(context)

        AMP = area_settings.height * fh / 100
        if action.get("MIDI"):

            bgl.glEnable(bgl.GL_BLEND)
            self.draw_box(x, y + AMP, 3 * fw, 20, color=self.gridcol)
            bgl.glDisable(bgl.GL_BLEND)
            self.draw_action_header_text(x, y + AMP, speaker, action)
            self.draw_midi_keyboard(x, y, fw, AMP, action=action, frame=frame)
        else:
            self.draw_spectrum(context, x, y, speaker, action)
开发者ID:batFINGER,项目名称:batFINGER-blender-addons,代码行数:33,代码来源:BGL_draw_visualiser.py


示例4: draw

    def draw(self, context):
        layout = self.layout
        layout.enabled = not bpy.types.BakeSoundPanel.baking
        speaker = getSpeaker(context)
        action = getAction(speaker)

        #checks
        if speaker.sound is None:
            layout.label("Speaker has No Sound", icon='INFO')
            return
        if action is None:
            layout.label("No Action Baked", icon='INFO')
            return
        elif action is None:
            layout.label("No Action Baked", icon='INFO')
            return
        elif action['wavfile'] != speaker.sound.name:
            layout.label("No Action Baked", icon='INFO')
            layout.label("for %s" % speaker.sound.name)
            return
        '''
        layout.label(repr(action))
        if action:
            layout.label(action['wavfile'])

        '''
        if not bpy.types.BakeSoundPanel.baking:
            if action.vismode == 'SLIDER':
                self.Sliders(context)
            elif action.vismode == 'FCURVE':
                self.FCurveSliders(context)
            elif action.vismode == 'VERTICAL':
                self.EBT(context)
            elif action.vismode == 'TABSTER':
                self.EBT(context)
开发者ID:batFINGER,项目名称:batFINGER-blender-addons,代码行数:35,代码来源:soundaction_visualiser.py


示例5: execute

    def execute(self, context):
        action = getAction(context.scene.speaker)
        c = {}
        graph = get_context_area(context, c, 'GRAPH_EDITOR')
        '''
        c["area"] = graph
        c["screen"] = context.screen
        c["region"] = graph.regions[-1]
        c["window"] = context.window
        c["scene"] = context.scene
        '''
        #hs = action.tweaks.add()
        #hs.type = self.type

        if self.type == 'CLEAN':
            bpy.ops.graph.clean(c, threshold=self.threshold)
            print("clean")
            #hs.threshold = self.threshold

        elif self.type == 'SMOOTH':
            bpy.ops.graph.smooth(c)
            print("smooth")

        self.sd_tweak_type = self.type
        self.add_to_tweaks(action)
        return {'FINISHED'}
开发者ID:batFINGER,项目名称:batFINGER-blender-addons,代码行数:26,代码来源:sound_action.py


示例6: xxxx

def xxxx(self, context):
    id_data = self.id_data
    p = self.path_from_id()
    p = p[:p.find(".channels")]
    driver_gui = self.id_data.path_resolve(p)
    idx = int(driver_gui.name[3:])
    dm = context.driver_manager
    ed = dm.find(idx)
    if ed is not None:
        sp = context.scene.speaker
        a = getAction(sp)
        a = bpy.data.actions.get(driver_gui.action)
        if a is None:
            return None
        cn = a["channel_name"]
        cn = driver_gui.channel

        if not self.value:
            bpy.ops.dm.remove_driver_var(varname=self.name, dindex=ed.index) #REFACTO
        else:
            channel_list = [ch.name for ch in driver_gui.channels if
                            ch.value and ch.name.startswith(cn)]
            main(driver_gui, context, ed, sp, a, channel_list)

    return None
开发者ID:Italic-,项目名称:blenderpython,代码行数:25,代码来源:sounddriver.py


示例7: poll

    def poll(cls, context):

        if not hasattr(context, "speaker"):
            return False

        speaker = getSpeaker(context)
        action = getAction(speaker)

        return (context.speaker and speaker and action\
                and cls.vismode in speaker.vismode)
开发者ID:batFINGER,项目名称:batFINGER-blender-addons,代码行数:10,代码来源:sound_action.py


示例8: mix_buffer

def mix_buffer(context):
    dprint("mix BUff")
    #make a buffer from the channel mix
    # set up a buffer with the same dictionary structure as the
    device = aud.device()
    scene = context.scene
    fps = scene.render.fps / scene.render.fps_base
    if not context:
        return None

    if scene.use_preview_range:
        frame_start = scene.frame_preview_start
        frame_end = scene.frame_preview_end
    else:
        frame_start = scene.frame_start
        frame_end = scene.frame_end
    # get
    g = None
    for name, value in scene.sound_channels.items():
        mix = sound_buffer.get(name)
        if mix is None:
            continue
        speaker_name, action_name = name.split("[email protected]__")
        speaker = bpy.data.speakers.get(speaker_name)
        if not speaker:
            continue
        action = getAction(speaker)
        if not speaker.filter_sound \
               or action_name != action.name:  # using the mute as a flag
            continue

        channel_name = action["channel_name"]
        fs = int(max(frame_start, action.frame_range.x))
        fe = min(frame_end, action.frame_range.y)
        if True:

            for i in range(action["start"], action["end"]):
                ch = "channel%02d" % i
                if value.get(ch):  # channel selected for mix
                    f = mix.get(ch)
                    if g:
                        #f = f.join(g) # join
                        f = f.mix(g)
                    g = f

    if g:
        #factory_buffered =
        #aud.Factory.buffer(g.limit((fs-1) / fps, (fe-1) / fps))
        bpy.app.driver_namespace["ST_buffer"] = g
        factory_buffered = aud.Factory.buffer(g)
        dprint("buffered")
        return factory_buffered

    return None
开发者ID:Dieselmjk,项目名称:batFINGER-blender-addons,代码行数:54,代码来源:filter_playback.py


示例9: draw_header

    def draw_header(self, context):
        layout = self.layout
        speaker = getSpeaker(context)
        action = getAction(speaker)
        if not action:
            layout.label("", icon='SEQ_HISTOGRAM')
            return

        op = layout.operator("action.visualiser", icon='SEQ_HISTOGRAM',
                             emboss=False, text="")
        op.action_name = action.name
开发者ID:batFINGER,项目名称:batFINGER-blender-addons,代码行数:11,代码来源:soundaction_visualiser.py


示例10: draw

    def draw(self, context):
        wm = context.window_manager
        scene = context.scene
        a = getAction(context.scene.speaker)
        channels = a["Channels"]
        ob = context.object
        VisualiserRowsColumns.channels = channels
        if "VIS" in ob.keys():
            self.edit_draw(ob, context)
            self.retarget_draw(ob, context)
            row = self.layout.row()
            row.operator("sounddriver.create_visualiser")
            return

        n = channels
        # rcs = [(x, n/x) for x in range(1, int(sqrt(n))+1) if n % x == 0]
        rcs = [(x, n / x) for x in range(1, n+1) if n % x == 0]

        layout = self.layout
        row = layout.row()
        row.prop(wm, "visualiser_type")
        row = layout.row()
        col = row.column()
        '''
        col.label("TEST")

        for obj in context.selected_objects:
            orow = col.row()
            orow.label(obj.name)
        '''
        col = row.column()
        row = col.row()

        scene = context.scene
        if wm.visualiser_type == "GRID":
            col.menu("visualiser.rows_columns", text="Rows x Cols")

        elif wm.visualiser_type == "SOUNDSURFACE":
            row = layout.row()
            row.label("NIY: Not Implemented Yet")

        if wm.visualiser_type == "CURVESURFACE":
            actions = [a for a in bpy.data.actions if 'wavfile' in a.keys()]
            for a in actions:
                row = layout.row()
                txt = "%s %s channels:%d" % (a.name,
                                             a["channel_name"],
                                             a["Channels"])

                op = row.operator("soundaction.create_visualiser", text=txt)
                op.type = 'CURVESURFACE'
                op.action = a.name
开发者ID:batFINGER,项目名称:batFINGER-blender-addons,代码行数:52,代码来源:visualiser.py


示例11: execute

    def execute(self, context):
        action = bpy.data.actions.get(self.action)
        if action is None:
            action = getAction(context.scene.speaker)
        if self.area_index > -1:
            area = context.screen.areas[self.area_index]
            # s = ScreenAreaAction(context.screen) # REFACTO
            s = context.sound_vis_areas
            s.set_action_to_area(area, action)
            area.type = "VIEW_3D"
            return {"FINISHED"}

        return {"FINISHED"}
开发者ID:batFINGER,项目名称:batFINGER-blender-addons,代码行数:13,代码来源:BGL_draw_visualiser.py


示例12: drawnormalise

 def drawnormalise(self, context):
     layout = self.layout
     action = getAction(getSpeaker(context))
     row = layout.row(align=True)
     row.prop(action, "normalise", expand=True)
     row = layout.row()
     row.scale_y = row.scale_x = 0.5
     row.label("min: %6.2f" % action["min"])
     row.label("max: %6.2f" % action["max"])
     sub = layout.row()
     sub.enabled = action.normalise != 'NONE'
     sub.prop(action, "normalise_range", text="", expand=True)
     return
开发者ID:batFINGER,项目名称:batFINGER-blender-addons,代码行数:13,代码来源:sound_action.py


示例13: draw

    def draw(self, context):
        speaker = getSpeaker(context)
        layout = self.layout
        if not speaker:
            return {'CANCELLED'}
        soundaction = getAction(speaker)

        soundaction = bpy.data.actions.get(self.action, None)
        #soundaction = bpy.data.actions.get(self.action)
        #layout.enabled = False
        #layout.menu("soundtest.menu", text=soundaction.get("channel_name", "AA"))
        layout.enabled = True
        layout.operator("wm.call_menu", text=soundaction.get("channel_name", "AA"), emboss=True).name = "soundtest.menu"
开发者ID:batFINGER,项目名称:batFINGER-blender-addons,代码行数:13,代码来源:sound_action.py


示例14: setup_buffer

def setup_buffer(context):
    dprint("Setup BUffer")
    # set up a buffer with the same dictionary structure as the
    device = aud.device()
    scene = context.scene
    fps = scene.render.fps / scene.render.fps_base
    if not context:
        return False

    if scene.use_preview_range:
        frame_start = scene.frame_preview_start
        frame_end = scene.frame_preview_end
    else:
        frame_start = scene.frame_start
        frame_end = scene.frame_end
    # get
    for name, value in scene.sound_channels.items():
        mix = sound_buffer[name] = {}
        speaker_name, action_name = name.split("[email protected]__")
        speaker = bpy.data.speakers.get(speaker_name)
        if speaker is None:
            continue
        action = getAction(speaker)
        if action is None:
            continue
        if not speaker.filter_sound \
               or action_name != action.name:  # using the mute as a flag
            continue

        channel_name = action["channel_name"]
        rna_ui = speaker['_RNA_UI']
        fs = int(max(frame_start, action.frame_range.x))
        fe = min(frame_end, action.frame_range.y)
        if True:

            for i in range(action["start"], action["end"]):
                if True:
                    low = rna_ui['%s%d' % (channel_name, i)]['low']
                    high = rna_ui['%s%d' % (channel_name, i)]['high']
                    f = speaker.sound.factory
                    #f = aud.Factory(speaker.sound.filepath)
                    f = f.lowpass(low).highpass(high).buffer()
                    mix["channel%02d" % i] = f

    return True
开发者ID:Dieselmjk,项目名称:batFINGER-blender-addons,代码行数:45,代码来源:filter_playback.py


示例15: draw

    def draw(self, context):
        space = context.space_data
        if space.use_pin_id:
            speaker = space.pin_id
        else:
            speaker = context.speaker

        layout = self.layout
        action = getAction(speaker)
        layout.label("NOT IMPLEMENTED YET", icon="INFO")
        layout.separator()
        layout.label("Spatial Layouts ie (STEREO, 5.1 Surround)")
        return

        speakerL = None
        speakerR = None
        actionL = None
        actionR = None
        """
开发者ID:meta-androcto,项目名称:blenderpython,代码行数:19,代码来源:speaker.py


示例16: ColSliders

    def ColSliders(self, context):
        layout = self.layout
        speaker = getSpeaker(context)
        action = getAction(speaker)
        if not (action and speaker):
            return None

        channel_name = action["channel_name"]
        start = action["start"]
        end = action["end"]
        box = layout.box()
        #row  = box.row()
        #box.scale_y = 0.4
        cf = box.column()
        cf.scale_y = action["row_height"]
        for i in range(start, end + 1):
            channel = "%s%d" % (channel_name, i)
            cf.prop(speaker, '["%s"]' % channel, slider=True,
                       emboss=True, text="")
开发者ID:batFINGER,项目名称:batFINGER-blender-addons,代码行数:19,代码来源:sound_action.py


示例17: draw

    def draw(self, context):
        scene = context.scene
        layout = self.layout
        if context.space_data.use_pin_id:
            speaker = context.space_data.pin_id
        else:
            speaker = context.object.data

        action = getAction(speaker)
        area = layout.row()

        if True:
            area.prop(context.scene, "frame_current", text="Start")
            self.layout.operator("anim.loadlipsync")
            phon = speaker.papagayo_phonemes
            layout.prop(speaker, "papagayo_phonemes", expand=True)
            #st = context.object.animation_data.nla_tracks[phon].strips[phon]
            #layout.template_ID(st, "action", new="action.new")

            row = layout.row()
            row.template_ID(context.scene.objects, "active")

            frame = context.scene.frame_current
            timemarkers = [marker
                           for marker in action.pose_markers
                           if marker.frame == frame]
            row = layout.row()
            if True:
                row.prop(speaker, "papagayo_phonemes", expand=True)
            row = layout.row()
            if len(timemarkers) and True:
                row.label(text="%s" % timemarkers[0].name, icon='MOD_MASK')
                row.prop(timemarkers[0], "frame", text="")
            else:
                timemarkers = [marker
                               for marker in action.pose_markers
                               if marker.frame > frame]
                if len(timemarkers):
                    row.label(text="NEXT %s" % timemarkers[0].name)
                else:
                    row.label("-")
        layout.prop(context.scene, "frame_current", emboss=True)
开发者ID:IBaaNB,项目名称:blenderpython,代码行数:42,代码来源:NLALipsync.py


示例18: FCurveSliders

    def FCurveSliders(self, context):
        layout = self.layout
        speaker = getSpeaker(context)
        action = getAction(speaker)
        if not (action and speaker):
            return None

        channel_name = action["channel_name"]

        start = action["start"]
        end = action["end"]
        box = layout.box()
        #row  = box.row()
        #box.scale_y = 0.4
        cf = box.column_flow(columns=1)
        #cf.scale_y = action["row_height"]
        fcurves = action.fcurves
        for i in range(start, end + 1):
            channel = "%s%d" % (channel_name, i)
            v = speaker[channel]
            MIN = speaker["_RNA_UI"][channel]['min']
            MAX = speaker["_RNA_UI"][channel]['max']
            diff = MAX - MIN
            pc = 0.0
            if diff > 0.0000001:
                pc = (v - MIN) / diff
            #row = cf.row()
            #row.scale_y = action["row_height"]
            if pc < 0.00001:
                split = cf.split(percentage=0.0001)
                split.scale_y = action["row_height"]
                split.label("")
                continue
            split = cf.split(percentage=pc)
            split.scale_y = action["row_height"]
            split.prop(fcurves[i], "color", text="")
        row = box.row()
        row.scale_y = 0.2
        row.label(icon='BLANK1')
开发者ID:batFINGER,项目名称:batFINGER-blender-addons,代码行数:39,代码来源:sound_action.py


示例19: __init__

    def __init__(self, op, context, areatype):
        # Calculate scroller width, dpi and pixelsize dependent
        self.pixel_size = context.user_preferences.system.pixel_size
        self.dpi = context.user_preferences.system.dpi
        self.dpi_fac = self.pixel_size * self.dpi / 72
        # A normal widget unit is 20, but the scroller is apparently 16
        self.scroller_width = 16 * self.dpi_fac
        self.region = context.area.regions[-1]
        self.context = context

        self.op = op
        self.areatype = areatype
        speaker = context.scene.speaker
        a = getAction(speaker)
        # a = context.area.sound_action # NEW IDEA REFACTO
        self.handle = self.create_handle(context)
        theme = context.user_preferences.themes[0]
        self.gridcol = [getattr(theme.view_3d.grid, c) for c in "rgb"]
        self.gridcol.append(1.0)
        self.curfc = [getattr(theme.timeline.frame_current, c) for c in "rgb"]
        self.curfc.append(1.0)
        self.theme = theme
开发者ID:batFINGER,项目名称:batFINGER-blender-addons,代码行数:22,代码来源:BGL_draw_visualiser.py


示例20: SoundActionMenu

 def SoundActionMenu(self, context, speaker=None,
                     action=None, has_sound=True):
     speaker = getSpeaker(context)
     action = getAction(speaker)
     layout = self.layout
     if action is None:
         layout.label("NO ACTION", icon='INFO')
         return
     channel_name = action.get("channel_name")
     if channel_name is None:
         return
     row = layout.row(align=True)
     if has_sound:
         sub = row.row()
         sub.alignment = 'LEFT'
         #col.alignment = 'LEFT'
         sub.menu("soundtest.menu", text=channel_name)
         #sub = row.row()
         row.prop(action, "name", text="")
         sub = row.row()
         sub.alignment = 'RIGHT'
         sub.prop(action, "use_fake_user",
                    toggle=True, text="F")
开发者ID:batFINGER,项目名称:batFINGER-blender-addons,代码行数:23,代码来源:sound_action.py



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Python libsoundplay.SoundClient类代码示例发布时间:2022-05-27
下一篇:
Python sound.play_effect函数代码示例发布时间:2022-05-27
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap