Here is my test code and picture:
import bpy
# Simple property reading/writing from ID properties.
# This is what the RNA would do internally.
def get_float(self):
return self["testprop"]
def set_float(self, value):
self["testprop"] = value
#bpy.types.Scene.test_float = bpy.props.FloatProperty(get=get_float,set=set_float)
bpy.types.Scene.test_float = bpy.props.FloatProperty()
bpy.context.scene.test_float = 12.34
When I don't explicitly set the "get/set" function for my property, after assigning the value, I can get the property value by 'scene["test_float"]', but if I explicitly set the "get/set" function, then if I try to type in the same commands, I will receive a error "KeyError: 'bpy_struct[key]: key "test_float" not found'" . So what should I do to get the same results by using explicitly "get/set" function?
bpy.context.scene.test_float
instead of looking it up with thebpy.context.scene["test_float"]
syntax. This works in both cases for me. $\endgroup$