Hello, everyone.
I started to code my first add-on and, probably because I can find good complete step by step and up-to-date tutorials, I accumulate simple problems that I take hours to understand.
Last in date, I have define 2 customs properties for MovieClip type to use for my add-on, CtFStart and CtFEnd, each one editable in the add-on custom panel. My concern is that CtFStart must always be lower than CtFEnd. So I looked to bpy.props Blender API references, read the «Get/Set Example» and apply to my situation, thinking I could use a custom setter method to check value before assigning it. I first created a setter method supposed to do exactly what the original does as write in the Blender references:
def set_start_frame(self, val):
'''check Start frame new Value'''
self['CtFStart'] = val
# Add to movieclip type the CtFStart property
bpy.types.MovieClip.CtFStart =bpy.props.IntProperty(
name = "First frame",
description = "…",
default = 0,
min = 0,
set=set_start_frame)
So the problem is that don’t work and I can’t understand why:confused:. When I increase CtFStart value in the UI and release the mouse button, CtFStart value is still 0. I have tried to assign value like that:
def set_start_frame(self, val):
'''check Start frame new Value'''
self.CtFStart = val
Wich result in infinite recursive call to the setter.
I have tried to print(val) before assign it to self[‘CtFStart’], and it realy seams to be the good value. Then, I tried to print self[‘CtFStart’] and get an error:«KeyError: ‘bpy_struct[key]: key “CtFStart” not found’».So I search and all answers I find still says to access it like I do in the setter function (unless I miss a detail?).
By curiosity, in set_start_frame(self,val) function, I also tried to search CtFStart in self.rna_type and find find it at self.rna_type.CtFStart and self.rna_type.properties[‘CtFStart’], but I still can’t get or set the value.
So I would be happy if some of you can enligthen me.