def assign_defaults(obj): from rna_prop_ui import rna_idprop_ui_prop_default_set rna_properties = {prop.identifier for prop in obj.bl_rna.properties if prop.is_runtime} for prop, value in obj.items(): if prop not in rna_properties: rna_idprop_ui_prop_default_set(obj, prop, value)
def assign_defaults(obj): from rna_prop_ui import rna_idprop_ui_prop_default_set rna_properties = {'_RNA_UI'} | {prop.identifier for prop in obj.bl_rna.properties if prop.is_runtime} for prop, value in obj.items(): if prop not in rna_properties: rna_idprop_ui_prop_default_set(obj, prop, value)
def injectFloatProp( target, pname, userfmin=0.0, userfmax = 1.0 ): target[ pname ] = 0.0 from rna_prop_ui import ( rna_idprop_ui_prop_get, rna_idprop_ui_prop_clear, rna_idprop_ui_prop_update, rna_idprop_ui_prop_default_set, rna_idprop_value_item_type, ) #id_data #prop_type, is_array = rna_idprop_value_item_type( target[ pname ] ) prop_ui = rna_idprop_ui_prop_get( target, pname ) prop_ui["min"] = 0.0; prop_ui["max"] = 1.0; #prop_ui["subtype"] = 'COLOR';#('COLOR', "Linear Color", "Color in the linear space"); rna_idprop_ui_prop_default_set( target, pname, target[ pname ] )
def injectColorProp( target, pname ): target[ pname ] = [ 0.0, 0.0, 0.0 ]; from rna_prop_ui import ( rna_idprop_ui_prop_get, rna_idprop_ui_prop_clear, rna_idprop_ui_prop_update, rna_idprop_ui_prop_default_set, rna_idprop_value_item_type, ) #id_data #prop_type, is_array = rna_idprop_value_item_type( target[ pname ] ) prop_ui = rna_idprop_ui_prop_get( target, pname ) prop_ui["min"] = 0.0; prop_ui["max"] = 1.0; prop_ui["subtype"] = 'COLOR';#('COLOR', "Linear Color", "Color in the linear space"); rna_idprop_ui_prop_default_set( target, pname, target[ pname ] ) #target[ pname ].typecode = 'f' #??? other crap is inferred like min, max, subtype??? #print( dir( target[ pname ] ) ); #print( dir( target[ pname ][0] ) ); #WM_OT_properties_edit -> wm.py # rna_vector_subtype_items # 'COLOR' #call operator WM_OT_properties_edit on this target; # #MAYBE even call THIS operator: # WM_OT_properties_add # data_path # # rna_idprop_ui_create(item, prop, default=1.0) # # #self._init_subtype(prop_type, is_array, subtype) #Hoooowww to access and add in subtype??? #target[ pname ].subtype = ('COLOR', "Linear Color", "Color in the linear space"); """