Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Execution options #1

Open
wants to merge 4 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
__pycache__/
31 changes: 19 additions & 12 deletions __init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,11 +31,10 @@


import bpy
import re
from bpy.types import Operator
from bpy.props import (
BoolProperty,
EnumProperty,
IntProperty
)


Expand All @@ -60,7 +59,7 @@ class TEXT_OT_text_to_strip(Operator):
bl_label = "Text to Strip"
bl_options = {"REGISTER", "UNDO"}

type: EnumProperty(
type_: EnumProperty(
name="Text to Strip",
description="Sends line or full text to text strip",
options={"ENUM_FLAG"},
Expand All @@ -71,25 +70,32 @@ class TEXT_OT_text_to_strip(Operator):
default={"LINES"},
)

font_size: IntProperty(
name="Font Size",
default=40,
min=0,
max=2000,
soft_min=1
)

@classmethod
def poll(cls, context):
return context.area.type == "TEXT_EDITOR" and context.space_data.text

def invoke(self, context, event):
return context.window_manager.invoke_props_dialog(self)

def execute(self, context):
st = context.space_data
text = st.text.as_string()
name = st.text.name
old_line = bpy.context.space_data.text.current_line_index
trimmed = ""
instance = 0
lines = str(text).splitlines()
chan = find_completely_empty_channel()

scn = bpy.context.scene
cf = scn.frame_current
context = bpy.context

if self.type == {"FULL_TEXT"}:
if self.type_ == {"FULL_TEXT"}:
text_strip = bpy.context.scene.sequence_editor.sequences.new_effect(
name="Text Edit",
type="TEXT",
Expand All @@ -103,8 +109,8 @@ def execute(self, context):
text_strip.align_y = "CENTER"
text_strip.align_x = "LEFT"
text_strip.wrap_width = 0.68
text_strip.font_size = 40
if self.type == {"LINES"}:
text_strip.font_size = self.font_size
if self.type_ == {"LINES"}:
pos = 0
for i in range(len(lines)):
text_strip = bpy.context.scene.sequence_editor.sequences.new_effect(
Expand All @@ -120,13 +126,14 @@ def execute(self, context):
text_strip.align_y = "BOTTOM"
text_strip.align_x = "LEFT"
text_strip.wrap_width = 0.68
text_strip.font_size = 40
text_strip.font_size = self.font_size
pos += 100
return {"FINISHED"}


def menu_text_to_strip(self, context):
self.layout.operator_menu_enum("text.text_to_strip", "type")
self.layout.operator_context = 'INVOKE_DEFAULT'
self.layout.operator("text.text_to_strip")


def register():
Expand Down