On Thu, Sep 9, 2010 at 2:41 AM, Bassam Kurdali <bkurd...@freefactory.org> wrote: > Hi Campbell > <--snip> >> >> Another change to help our api be less confusing is to have operator >> properties directly accessible. >> >> class Operator(bpy.types.Operator): >> myprop = bpy.props.BoolProperty() >> def execute(self, context): >> ... this line >> print(self.properties.myprop) >> ...could be written as >> print(self.myprop) >> >> At the moment print(self.myprop) will print the property definition, >> but not the property (which is what you want!) >> I'd like to keep self.properties available since its how operators >> work internally and can be passed as keyword arguments, so this change >> is mostly for convent access. >> > The question that came to mind here (as I mentioned on irc) is that if > you *did* want to print/access the property definition, how would you do > so if self.myprop just returns the value? > cheers > Bassam > PS- thanks for the mail, it cleared up some things that had been long > confusing me re. the api.
operators define StructRNA types once registered so you can do... >>> bpy.types.IMPORT_SCENE_OT_obj.bl_rna.properties["ROTATE_X90"] <bpy_struct, BooleanProperty("ROTATE_X90")> just like... >>> bpy.types.Scene.bl_rna.properties["frame_start"] <bpy_struct, IntProperty("frame_start")> having bl_rna is ugly but needed ATM since the python class and the rna type a different (perhaps they could be made into the same type but its not trivial). _______________________________________________ Bf-committers mailing list Bf-committers@blender.org http://lists.blender.org/mailman/listinfo/bf-committers