0
$\begingroup$

I'm creating a simple add-on that allows you to give each frame a custom description and keywords, which I hope to write to a frame_name.txt file when the frame is saved.

I've got the basic option set-up working, but I can't seem to figure out how to get the option to reflect the current frame. Ideally, each frame should have a separate value to be input.

So:

Frame 1:

  • Title: This is frame one.
  • Description: This is some guy doing something.
  • Keywords: Running, Race, etc

Frame 2:

  • Title: This is frame two.
  • Description: This is some guy doing something else.
  • Keywords: Jumping, Leaping, etc

I attempted to add custom names to each field using

current_frame = bpy.context.scene.frame_current

But that does not work since the values are only registered once. Perhaps I'm going about it all wrong? Its a simple frame-based information system.

What am I doing wrong to get this input-system frame-based and per object?

import bpy  
from bpy.types import Operator  
from bpy.props import FloatVectorProperty, FloatProperty, StringProperty   

"""
NOTES
current_frame = bpy.context.scene.frame_current

"""


class PaperDoll(bpy.types.Operator):
    """Sequential Paperdoll Character Class"""

    bl_idname  = "object.paperdoll_operator"
    bl_label   = "Paperdoll Sequence"
    bl_options = {'REGISTER','UNDO','PRESET'}  

    root_title = StringProperty(
        name    = "Title",
        default = "Enter a Title"
        )

    root_description = StringProperty(
        name    = "Description",
        default = "Enter a Description"
        )

    root_keywords = StringProperty(
        name    = "Keywords",
        default = "Enter Keywords"
        ) 

    def execute(self, context, event):  
        print("HERE")
        return {'FINISHED'}    

    def execute(self, context):  
        print("HERE")
        return {'FINISHED'}  

def add_object_button(self, context):  
    self.layout.operator(  
    PaperDoll.bl_idname,  
    text=PaperDoll.__doc__,  
    icon='PLUGIN')  

def register():  
    bpy.utils.register_class(PaperDoll)  
    bpy.types.VIEW3D_MT_object.append(add_object_button)  

if __name__ == "__main__":  
    register()        
$\endgroup$
1
$\begingroup$

A StringProperty gives you a single value for the scene, to get a new value for each frame you will need a list or collection to hold all the values for each frame.

Blender does offer a CollectionProperty which should suit your needs. You want to have a value for your string then an index or key that will be the frame that value is good for.

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.