A Text Counter Plugin

Hello,

I need a text counter plugin. I don’t think it’s gonna be very hard to make. After this is made and I paid the creator, I will make it available as GPL. I want to make it easier for Blender users to make motion graphics like heads-up-display or speed gauge.

I made a sample picture on how I think it should be:

After you load the plugin from settings -> addons… it will add a new section called “Counter Effect” or “Text Counter” in Font data tab of every font object. You will select the font you want to animate and it will have that section.

To enable it, you have to check the “Counter Effect” then move to start frame and key “Counter” slider. Then move to end frame and change the “Counter” slider and key it again… Then it will count automatically. That slider should be able to count from positive to negative or negative to positive… so any combination. “Padding” will add padding to the counting number and “Decimal” check mark will enable decimal counting and “Decimal” slider will change the number of decimals…

Please let me know if anyone wants to take this paid project.

Hi, PM sent.

It would great to have dynamic text for things like dimensions and moving objects. A frame counter with different units would be great also.

What would be the variables for the dynamic text that the user can change?

I like the frame counter idea.

Hi,
I like dellis idea so I decided to implement it.

I forgot to show that counter values can be modified in Graph Editor as any other curves.

ziel, it looks awesome. WOW the dynamic section is CRAZY! :smiley:

Can’t wait to test it.

We run into this problem in 3ds MAX all the time. We do a lot of motor vehicle accidents, where we need a counter that shows the closing distance between two vehicles, as well as their speeds and the time increment. Sometimes the lawyers want the timer to count down to impact (zero), sometimes in seconds or tenths of a second. Having a prefix and a suffix option is really cool. Maybe check boxes that would do the different time increments (ie. frames, seconds etc)

Quick question…is it possible to just call on the objects position instead of limiting it to one axis. This is how we do it in maxscript.

Great work by the way!!!

I am just learning blender and python and thought I would have a go at this just as a learning exercise.

ziel has obviously produced a really good solution. I juts did a simple counter to see how it would be done and learn. I then had the idea that as well as just showing the number it could be used as a line number and reference a text block.

This was quite easy to implement once I had a countdown script.

This video shows my implementation, the new text bit starts at about 1:30:

It is quite simple but allows quick and dirty subtitles. The video itself has a text overlay done using this plugin. The text is moving and scaling slowly just using standard blender anim.

The code is here and perhaps ziel can integrate in to his better counter addon. I am happy that you use the code as long as the final plugin is GPL as the OP stated it would be.

bl_info = {
    "name": "Text Animation",
    "author": "Stuart Marsden",
    "version": (1, 0),
    "blender": (2, 69, 0),
    "location": "Properties > Font > Text Animation",
    "description": "Lets you animate text content",
    "warning": "",
    "wiki_url": "",
    "category": "Font"}


import bpy #needed in a script-text-window!


def set_func(self, value):
    self['countVal'] = value
    if self.is_timer:
        if self.is_animText:
            lineNum = clamp(int(value), 1, len(bpy.data.texts[self.animText].lines)) - 1
            self.data.body = bpy.data.texts[self.animText].lines[lineNum].body
        else:
            self.data.body = "%d" % value
    
def get_func(self):
    return self['countVal']


def set_timer(self, context):
    if 'countVal' not in self:
        self.countVal = 1.0
        
def set_textFile(self,context):
    set_func(self, self.countVal)
    
def clamp(n, minn, maxn):
    return max(min(maxn, n), minn)
 
class textAnimPanel(bpy.types.Panel):                 # panel to display new property
    """Timer Panel"""
    bl_label = "Countdown Timer"
    bl_idname = "FONT_PT_timer"
    bl_space_type = 'PROPERTIES'
    bl_region_type = 'WINDOW'
    # bl_context = "data"


    @classmethod
    def poll(cls, context):
        return (context.object and context.object.type in {'FONT'} and context.curve)
 
    def draw_header(self, context):
        obj = context.object
        self.layout.prop(obj, "is_timer", text="")
    
    def draw(self, context):
        obj = context.object
        if obj.is_timer:
            col = self.layout.column()
            col.prop(obj, "countVal", text="Count Value")
            col.prop(obj, "is_animText", text="Use text file for animation")
            if obj.is_animText:
                col.prop_search(obj, "animText", bpy.data, "texts", text="Anim Text")
                col.label(text="Length of file: %d" % len(bpy.data.texts[obj.animText].lines))
 
def register():
    bpy.utils.register_class(textAnimPanel)               # register panel
    bpy.types.Object.countVal = bpy.props.IntProperty(set=set_func, get=get_func)
    bpy.types.Object.is_timer = bpy.props.BoolProperty(default=False, description="Make countdown timer", update=set_timer)
    bpy.types.Object.is_animText = bpy.props.BoolProperty(default=False, description="Animate using Text File")
    bpy.types.Object.animText = bpy.props.StringProperty(description="Text to use for animation", update=set_textFile)


def unregister():
    bpy.utils.unregister_class(textAnimPanel)


if __name__ == "__main__":
    register()

Nice idea! I asked leomoon84 when addon is going to be released.

Code is released:


Happy blending!

1 Like

Thank You! This is just what I needed for a project I am working on.

Hello!

Any plans on updating this lovely little plugin?

I was just looking for this solution and was very happy to find it, until I realized that I could not install it under latest Blender (2.73a). I tried 2.72 and 2.71 to with no luck. Seems that 2.7 is the latest version that was verified. I would really need it to work from 2.72…

Crossing my fingers here!

Cheers

::mb

I tested this and it works. Get it from Github. What is the error you get when installing?

Hi, thanks for this amazing plug-in! Unfortunately, I can’t get it to install. I tried clicking “install from file” in Blender 2.73a and then on “blender-text-counter-master.zip”, then pressing “Install from file”, but nothing happens. I also tried downloading just “animation_text_counter.py” and doing the same process, but nothing happens. Do you have to have a particular version of Python installed? I never installed any Python versions, just Blender 2.73a on Windows 8.1.

Thanks!
~Adam

I got it to work:

Apparently, the “Install from file” action was causing the “blender-text-counter-master” folder to be added to

C:\Users(USERNAME)\AppData\Roaming\Blender Foundation\Blender\2.73\scripts\addons

but the “animation_text_counter.py” file was being left inside the “blender-text-counter-master” folder. All I had to do was cut and paste the “animation_text_counter.py” file from there back into

C:\Users(USERNAME)\AppData\Roaming\Blender Foundation\Blender\2.73\scripts\addons

And it worked!! (You just have to enable it in Blender’s user preferences / addons tab. Search for “text” if you don’t see it.)

Awesome plug-in… incredible! Thank you!

Happy to hear that it worked.

Hi @leomoon84,

Do you maybe have a Blender 2.8 update of the Blender Text Counter add-on? I’d love to use it.

Many thanks.

I converted this a while back , forgot to post it.
blender-text-counter.py (12.8 KB)

1 Like

Cool, thanks! :+1:

Thank you for doing this.

I’m trying to make it to run on 2.7x and 2.8x. Please use @ramboblender’s version for now.

Thanks again.

1 Like