Setting custom prop to Sequences

So I try this code, create an property:

bpy.types.Sequences.fakeinput1 = bpy.props.PointerProperty(name="Input 1", type=bpy.types.Sequences)

Then draw it in panel:

col.prop(strip, "fakeinput1")

And I get following error:

rna_uiItemR: property not found: ImageSequence.fakeinput1

So I guess, ImageSequence does not inherits my property from Sequences

But when I try to set this property to ImageSequence I get following error:

TypeError: PointerProperty(...) expected an RNA type derived from ID or ID Property Group
Traceback (most recent call last):
  File "----", line 10, in <module>
  File "----", line 11, in StripSettings
ValueError: bpy_struct "ImageSequence" registration error: fakeinput1 could not register

I tried to make pointer on PropertyGroup, this works for Sequences, but for ImageSequence I got this error:

`TypeError: PointerProperty(...) expected an RNA type, failed with: RuntimeError: , missing bl_rna attribute from 'RNAMetaPropGroup' instance (may not be registered`)

How can I fix that? Maybe I can mark property as inherited?

For now I get this results:

  • Pointer for PropertyGroup or Sequences(ImageSequence) - works in Sequences (but not inherits), does not work in ImageSequence
  • BoolProperty or any simple Property - works in Sequences (but not inherits), work in ImageSequence also

This is a testscript works fine for 3 prop and get error on prop4, why?

import bpy

class MyAddonProperties(bpy.types.PropertyGroup):
    input1 : bpy.props.IntProperty()

class StripSettings(bpy.types.PropertyGroup):
    bpy.types.Sequences.prop1 = bpy.props.BoolProperty(name='Active', default=True)
    bpy.types.ImageSequence.prop2 = bpy.props.BoolProperty(name='Active', default=True)
    bpy.types.Sequences.prop3 = bpy.props.PointerProperty(type=MyAddonProperties)
    bpy.types.ImageSequence.prop4 = bpy.props.PointerProperty(type=MyAddonProperties)

bpy.utils.register_class(MyAddonProperties)
bpy.utils.register_class(StripSettings)
1 Like

I found you need to register this variable against the scene, not just inside the python script, so something like this, I define this in the init file for the add-on:

Scene.pdt_delta_x = FloatProperty(name='X Coord', default=0.0,
                                               precision=5,
                                               description="X Coord Delta", unit='LENGTH')

This is done in the register() method, and I delete any of these in the unregister() method.

Then you need to define scene in your draw() method:

def draw(self, context):
    layout = self.layout
    scene = context.scene

Then you can draw the variable:

row.prop(scene, 'pdt_delta_x', text = 'X')

Hope this helps, I struggled with this also…

Cheers, Clock.

I don’t need property in scene, I need props in sequencer strips, to store data in each individual strip

So, my property; bpy.context.scene.pdt_delta_x does not exist anywhere else after I have declared it? Maybe even bpy.context does not exist in NLA editor? Curious…

You’ll understand if I decline to offer any further help…

BTW it exists in Python Console:

You should not need to register a property to the ImageSequence type, it is a subtype of Sequence and all registered properties should carry over.
In my addon, I have registered several properties to sequences and they apply to image sequences as well.

bpy.types.Sequence.parent = bpy.props.StringProperty()

Does result in bpy.types.ImageSequence having the ‘parent’ property.

The main issue i see with your code is the first line where you do:

bpy.types.Sequences.fakeinput1 = bpy.props.PointerProperty(name="Input 1", type=bpy.types.Sequences)

You cannot set the property type to bpy.types.Sequences, you can only set it to something that is in bpy.props, or a subclass of one of those.

Thanks, I replaced Sequences to Sequence and now it works!

But I still can’t add PointerProperty to Sequence.

You say

You cannot set the property type to bpy.types.Sequences, you can only set it to something that is in bpy.props, or a subclass of one of those

But i can actually set PointerProperty to Scene, so this works:

bpy.types.Sequence.scene = bpy.props.PointerProperty(type=bpy.types.Scene)

But this does not:

bpy.types.Sequence.seq = bpy.props.PointerProperty(type=bpy.types.Sequence)

oh, sorry, i didnt notice that you started with bpy.types.Sequences… thats definitely incorrect, but I had actually been referring to the ‘type=’ variable setting.

However, it looks like this is SORTOF possible in 2.79+ (I didnt know about this), however it isnt very well documented, and it only works with ‘data-block like objects’ (what that means, I dont really know), as the documentation states:
“Custom properties can now store pointers to data-blocks like objects, materials, etc. For this the a PointerProperty with a datablock type can be created.”

So, my guess is that the ‘scene’ is a datablock type object… and sequence isnt? I guess?
Really, the PointerProperty is designed for PropertyGroup based classes, essentially letting you create a dictionary.
For instance, I used it in my addon to store the settings and temp variables in one variable, something like:

class VSEQFSetting(bpy.types.PropertyGroup):
    last_frame: bpy.props.IntProperty()

bpy.types.Scene.vseqf = bpy.props.PointerProperty(type=VSEQFSetting)

bpy.context.scene.vseqf.last_frame = 100

Anyway… since blender is really bad about giving us options to store references to the actual data, what I ended up doing in my addons is storing the data name as a reference… its not ideal since that name can change at any time, but its really the only option for that as far as I know.

Ok, now I understand the problem: I can’t make PointerProperty(type=bpy.types.Sequence) Any walkaround?

if you need the blender property special abilities, your only option is to store the sequence name and grab the sequence with that. of course, you can store the sequence in a non-blender variable, even a global var, but that wont be saved in the blend file.