I copied the same code from this thread. I pasted code, then select it all, and then selected the “Preformatted text” button. We don’t have code option like old forum.
You can see all code from this thread is also color.
bl_info = {
"name": "addon name",
"author": "author",
"version": (1, 0),
"blender": (2, 7, 9),
"location": "",
"description": "",
"warning": "",
"wiki_url": "",
"tracker_url": "",
"category": "OBJECT"}
import bpy
# Addon Prefs
class AddonPreferences (bpy.types.AddonPreferences):
bl_idname = __name__
enumprop_pref = bpy.props.EnumProperty(
name = "enumprop_pref",
items = [('ONE','One', ''),('TWO','Two','')],
default = 'ONE'
)
# Register Addon Prefs
bpy.utils.register_class (AddonPreferences)
# Rest of the Addon
class PanelSettings (bpy.types.PropertyGroup):
enumprop = bpy.props.EnumProperty(
name = "enumprop",
items = [('ONE','One', ''),('TWO','Two','')],
default = bpy.context.user_preferences.addons[__name__].preferences.enumprop_pref
)
# Register Addon
def register():
bpy.utils.register_class (PanelSettings)
def unregister ():
bpy.utils.unregister_class (PanelSettings)
if __name__ == "__main__":
register()