I am trying to create an add-on to create parametric objects (Blender 2.8rc1)
I have defined a custom
def _update(self, context): print(repr(self)) class FurnigenProperties(types.PropertyGroup): width: FloatProperty( update=_update, unit='LENGTH' ) length: FloatProperty( update=_update, unit='LENGTH' )
When I change property I can see out of
What I essentially want to get access to would be
bpy.data.objects['GeneratedObject'] however I am unclear how to get from
self in callback function to actual object that property we just modified.
Looking at documentation for bpy.props.FloatProperty there isn't much detail on what I should expect
context to be.
context be the place to retrieve object reference? I was thinking about
context.object, but I am not clear how
object is determined. Is that object selected by user in viewport? In which case it wouldn't work if I modified property from some other Python code (as it would be most likely for a collection of objects of which none would be selected by user).
context.object in callback guaranteed to point to object that
self belongs to in above callback?
context.object doesn't seem to work. I just tried setting value of one of my properties through Python console and the object that I get from
context.object is (as I expected) object selected in viewport and not the object I modified property of.