import bpy
class CustomOperator(bpy.types.Operator):
bl_idname = "strip.custom_operator"
bl_label = "Custom Strip"
def execute(self, context):
return {'FINISHED'}
import bpy
class CustomStripProperties(bpy.types.PropertyGroup):
custom_property: bpy.props.StringProperty(name="Custom Property")
import bpy
class CustomPanel(bpy.types.Panel):
bl_idname = "panel.custom_panel"
bl_label = "Custom Panel"
bl_space_type = "SEQUENCE_EDITOR"
bl_region_type = "UI"
bl_category = "Custom Category"
def draw(self, context):
layout = self.layout
strip = context.selected_sequences[0]
layout.prop(strip, "custom_property")
import bpy
class CustomOperator(bpy.types.Operator):
bl_idname = "strip.custom_operator"
bl_label = "Custom Strip"
def execute(self, context):
return {'FINISHED'}
class CustomStripProperties(bpy.types.PropertyGroup):
custom_property: bpy.props.StringProperty(name="Custom Property")
class CustomPanel(bpy.types.Panel):
bl_idname = "panel.custom_panel"
bl_label = "Custom Panel"
bl_space_type = "SEQUENCE_EDITOR"
bl_region_type = "UI"
bl_category = "Custom Category"
def draw(self, context):
layout = self.layout
strip = context.selected_sequences[0]
layout.prop(strip, "custom_property")
def register():
bpy.utils.register_class(CustomOperator)
bpy.utils.register_class(CustomStripProperties)
bpy.utils.register_class(CustomPanel)
bpy.types.Sequence.custom_props = bpy.props.PointerProperty(type=CustomStripProperties)
def unregister():
bpy.utils.unregister_class(CustomOperator)
bpy.utils.unregister_class(CustomStripProperties)
bpy.utils.unregister_class(CustomPanel)
del bpy.types.Sequence.custom_props
import bpy
def custom_video_strip(code):
bpy.ops.sequencer.movie_strip_add()
strip = bpy.context.selected_sequences[0]
strip.custom_props.custom_property = code
import bpy
def main():
custom_video_strip("print('Hello, custom strip!')")
if __name__ == "__main__":
main()
以上是通过代码、属性和面板UI制作自定义视频条的具体和代码示例。
下一篇:Blender崩溃,请帮我解决。