Registering and unregistering many properties
this may be frowned upon, but so is repetition. so whatever.def properties(): def get_color_prop(): WHITE = (1, 1, 1) return FloatVectorProperty(default=WHITE, subtype='COLOR', min=0.0, max=1.0) props = dict( display_indices=IntProperty( name="Display indices", default=0), display_sel_only=BoolProperty( name="Selected only", description="Only display indices of selected vertices/edges/faces", default=True), display_vert_index=BoolProperty( name="Vertices", description="Display vertex indices", default=True), display_face_index=BoolProperty( name="Faces", description="Display face indices"), live_mode=BoolProperty( name="Live", description="Toggle live update of the selection, can be slow", default=False), vcol_helper_color_1=get_color_prop(), vcol_helper_color_2=get_color_prop(), vcol_helper_color_3=get_color_prop(), vcol_helper_color_4=get_color_prop() ) return props def register_properties(): for prop_name, prop_config in properties().items(): setattr(Scene, prop_name, prop_config) def unregister_properties(): for prop_name in properties().keys(): exec('del Scene.{0}'.format(prop_name))