Skip to content

Quicker Text Editing in Blender (Part 10): Beta 2 Release

  • by

More features!

Context

When making videos in Blender’s VSE I use a lot of text sequences for captions and the like. Doing common operations — like changing colour, location, size etc — can be slow when using the GUI, so I am writing an addon called QTE (Quicker Text Editing, pronounced ‘cutie’) to make the process faster. This series of posts outlines the process and tries to explain parts of the Blender API that I interacted with along the way.

Show all parts (click to expand) Parts:
  1. Part 1: What We Want To Do & Proof of Concept
  2. Part 2: Operators, Dynamic Classes & a Basic Script
  3. Part 3: Keymaps
  4. Part 4: User Preferences (& Panels)
  5. Part 5: QTE Alpha Release
  6. Part 6: Preferences and the right keymap
  7. Part 7: QTE Beta Release (& ‘Remove Binding’ Operator)
  8. Part 8: Bugs & Features
  9. Part 9: Prototyping Appearing Text
  10. Interlude: Why is my Blender addon panel property read only? (Solved)
  11. Part 10: Beta 2 Release (+ Development Hurdles)
  12. Part 11: Reflection and Next Steps
  13. Part 12: Preferences + Properties = Bugs
  14. Part 13: CollectionProperty, KeyMapItem ID, Preferences Pitfalls

Release

You can get the beta2 release of QTE from its GitHub page.

Split on Words Demo

You want to split a single text strip into individual strips for each word, and have those appear over time? This release is for you!

I wanted this feature for doing a promo video for ‘A Great Bunch of Lads’, a coop CK3 campaign I did a few months back.

Summary

I’ve been adding more to QTE, in particular a big feature that I would like to have for my own use: make a sentence appear one word at a time. There was also a bug in how the ‘remove preset’ keymap items reference was being accessed, so I fixed that bug too.

There were a few stumbling blocks with the API along the way to this beta release, which I’ll mention briefly below.

Development Hurdles

My operator properties Panel is frozen?!

I mentioned this in its own post:

The long and short of it is although you might think (as I did) that defining the options for the operator in the operator itself would suffice, in fact: both the panel and the operator need access to the properties.

There is a link at the end of that post to a follow-up discussion on BlenderArtists.

Getting the size of a Text Strip / TextSequence

Discussions:

To figure out how far apart the created text strips should be, we need either a heuristic or an exact measurement of how wide words and spaces are. The preferable approach is the latter, but while I was pointed at blf, there didn’t seem to be any user-accessible link between the fonts used in TextSequences (VectorFonts) and the fonts loaded by blf. I spent some time and created a debugging operator that wrote font info to a file trying to figure out if there was a link. I’m not the first to ask about this!

Workaround: Re-load the same font to get the same `fontid`, by massaging the filepath property to give an absolute path (as opposed to the ‘absolute relative path’ (??!) returned by bpy.path.abspath())

I’m not exactly thrilled with the workaround as it feels like it might break or leak ids if the underlying blender code is changed. If the latter happens I can implement my own fontid ‘cache’, but for now it works.

Updating properties without creating a circular reference

I wanted the user to be able to specify the time offset in terms of either seconds or frames, rather than forcing one or the other. Blender *-Property types have the ability to specify a callback by supplying a reference to update; so I used this to change the frame offset when the user specifies a time and vice-versa. While this ostensibly worked, it caused console complaints:

Thanks to this answer by BYOB, this is achievable via accessing properties as self["property"] instead of self.property in the update() callbacks.

Tell us what's on your mind

Discover more from Rob's Blog

Subscribe now to keep reading and get access to the full archive.

Continue reading