本文整理汇总了Python中sound_drivers.utils.getAction函数的典型用法代码示例。如果您正苦于以下问题:Python getAction函数的具体用法?Python getAction怎么用?Python getAction使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了getAction函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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)
示例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)
示例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)
示例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)
示例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'}
示例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
示例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)
示例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
示例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
示例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
示例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"}
示例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
示例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"
示例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
示例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
"""