有没有办法获取时间轴上有标记的每个帧编号,并将其设置为所选对象上f曲线的噪波修改器 r的起点?
The marker data can be found in scene.timeline_markers
The fcurve data is in object.animation_data.action.fcurves
If you wanted to add a noise modifier that lasts 10 frames starting at each marker you could use -
import bpy
# data_path='location' with an index=1 is the y location curve
fc = bpy.context.object.animation_data.action.fcurves.find('location', index=1)
for m in bpy.context.scene.timeline_markers:
nmod = fc.modifiers.new(type='NOISE')
nmod.strength = 1.5
nmod.use_restricted_range = True
nmod.frame_start = m.frame
nmod.frame_end = m.frame + 10
Note that the fcurves.find()
used here is only available from blender 2.76+, for earlier versions you will need to loop through the fcurves and test the data_path
to find the one you want.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.