Not sure why this simple code does not work. I tried several things... but it only works if the values are statics . In this example I put one dinamic value (does not work) and another that works but is burned.
Code:
import bpy
#create prop_group
props = {
"name" : [],
"type" : [],
}
#add props
props["name"].append( "fl_prop" )
props["type"].append( "float" )
print("---" )
class CustomPropGr(bpy.types.PropertyGroup):
global props
for name in props[ "name"] :
for type in props[ "type" ] :
if type == "float" :
print("debug:: name : ", name, " type: " ,type )
name : bpy.props.FloatProperty( name = name )
# end if
# end for
# end for
no_dinamic_prop : bpy.props.FloatProperty( name = "test" )
# end CustomPropGr
bpy.utils.register_class( CustomPropGr )
#make it enable and discovery for all objects
bpy.types.Object.custom_prop_gr = bpy.props.PointerProperty(type=CustomPropGr)
so = bpy.context.active_object
so.custom_prop_gr.no_dinamic_prop = 5.90
so.custom_prop_gr.fl_prop = 90.5
print( "no_dinamic_prop : ", so.custom_prop_gr.no_dinamic_prop )
#comment the below line to see the outputs
print( "dina prop (fl_prop): ", so.custom_prop_gr.fl_prop )
print("---" )