bpy.props.EnumProperty - python examples

Here are the examples of the python api bpy.props.EnumProperty taken from open source projects. By voting up you can indicate which examples are most useful and appropriate.

23 Examples 7

3 View Complete Implementation : pluginmanager.py
Copyright GNU General Public License v2.0
Author : HBPNeurorobotics
    @staticmethod
    def register_property_group(base=None):

        propertyTypes = (bpy.props.EnumProperty, bpy.props.StringProperty, bpy.props.BoolProperty,
                         bpy.props.StringProperty,
                         bpy.props.PointerProperty)

        def decorator(cls):
            if issubclast(cls, bpy.types.PropertyGroup):
                # RD_logger.info("Dependencies: %s", base)
                PluginManager._property_groups_to_register.append((cls, base))
            return cls

        return decorator

3 View Complete Implementation : light_preview_list.py
Copyright GNU General Public License v3.0
Author : leomoon-studios
def register():
    from bpy.types import WindowManager
    from bpy.props import EnumProperty

    WindowManager.bls_tex_previews = EnumProperty(
            items=enum_previews_from_directory_items,
            get=preview_enum_get,
            set=preview_enum_set,
            )

    import bpy.utils.previews
    pcoll = bpy.utils.previews.new()
    pcoll.bls_tex_previews = ()
    pcoll.initiated = False
    pcoll.dir_update_time = os.path.getmtime(directory)

    preview_collections["main"] = pcoll

3 View Complete Implementation : finger.py
Copyright GNU General Public License v3.0
Author : Microvellum
def add_parameters(params):
    """ Add the parameters of this rig type to the
        RigifyParameters PropertyGroup
    """
    items = [('X', 'X', ''), ('Y', 'Y', ''), ('Z', 'Z', ''), ('-X', '-X', ''), ('-Y', '-Y', ''), ('-Z', '-Z', '')]
    params.primary_rotation_axis = bpy.props.EnumProperty(items=items, name="Primary Rotation Axis", default='X')

    params.separate_extra_layers = bpy.props.BoolProperty(name="Separate Secondary Control Layers:", default=False, description="Enable putting the secondary controls on a separate layer from the primary controls")
    params.extra_layers = bpy.props.BoolVectorProperty(size=32, description="Layers for the secondary controls to be on")

    params.use_digit_twist = bpy.props.BoolProperty(name="Digit Twist", default=True, description="Generate the dual-bone twist setup for the first finger digit")

3 View Complete Implementation : palm.py
Copyright GNU General Public License v3.0
Author : Microvellum
def add_parameters(params):
    """ Add the parameters of this rig type to the
        RigifyParameters PropertyGroup

    """
    items = [('X', 'X', ''), ('Z', 'Z', '')]
    params.palm_rotation_axis = bpy.props.EnumProperty(items=items, name="Palm Rotation Axis", default='X')

3 View Complete Implementation : super_finger.py
Copyright GNU General Public License v3.0
Author : Microvellum
def add_parameters(params):
    """ Add the parameters of this rig type to the
        RigifyParameters PropertyGroup
    """
    items = [('X', 'X', ''), ('Y', 'Y', ''), ('Z', 'Z', ''), ('-X', '-X', ''), ('-Y', '-Y', ''), ('-Z', '-Z', '')]
    params.primary_rotation_axis = bpy.props.EnumProperty(items=items, name="Primary Rotation Axis", default='X')

3 View Complete Implementation : super_palm.py
Copyright GNU General Public License v3.0
Author : Microvellum
def add_parameters(params):
    """ Add the parameters of this rig type to the
        RigifyParameters PropertyGroup

    """
    items = [('X', 'X', ''), ('Z', 'Z', '')]
    params.palm_rotation_axis = bpy.props.EnumProperty(
            items=items,
            name="Palm Rotation Axis",
            default='X',
            )

3 View Complete Implementation : material.py
Copyright GNU Lesser General Public License v2.1
Author : OGRECave
    @clastmethod # only call after parsing all material scripts
    def reset_rna(self, callback=None):
        bpy.types.Material.ogre_parent_material = EnumProperty(
            name="Script Inheritence",
            description='ogre parent material clast',
            items=self.ENUM_ITEMS,
            #update=callback
        )

0 View Complete Implementation : globals.py
Copyright GNU General Public License v2.0
Author : HBPNeurorobotics
    def __init__(self):

        # Holds the current selected kinematics model (armature) name
        self.model_name = PropertyHandler(StringProperty(name='Name', update=self.name_update))
        self.old_name = PropertyHandler(StringProperty(name='Name'))

        # Holds the name of the currently selected segment (Bone)
        self.segment_name = PropertyHandler(StringProperty(update=self.updateBoneName))

        # Holds the name of the currently selected geometry (Mesh object)
        self.mesh_name = PropertyHandler(StringProperty(update=self.update_geometry_name))

        # Holds the name of the currently selected physics frame (Empty object)
        self.camera_sensor_name = PropertyHandler(StringProperty())

        # Used to realize the main tab in the GUI
        self.gui_tab = PropertyHandler(EnumProperty(
            items=[('armatures', 'Robot', 'Modify the Robot'),
                   ('bones', 'Segments', 'Modify segements'),
                   ('meshes', 'Geometries', 'astign meshes to segments'),
                   ('sensors', 'Sensors', 'astign sensors to the robot'),
                   ('muscles', 'Muscles', 'astign muscles to the robot'),
                   # ('markers', 'Markers', 'astign markers to bones'),
                   # ('controller', 'Controller', 'Modify controller parameter'),
                   ('tools', 'Tools', 'Tools'),
                   ('files', 'Files', 'Export Armature')],
        ))

        # Holds the selection to operate on colission geometries OR visual geometries
        self.mesh_type = PropertyHandler(EnumProperty(
            items=[('DEFAULT', 'Visual geometries', 'Edit visual geometries'),
                   ('COLLISION', 'Collision geometries', 'Edit collision geometries')]
        ))

        self.sensor_type = PropertyHandler(EnumProperty(
            items=[('CAMERA_SENSOR','Cameras', 'Edit camera sensors'),
                   ('LASER_SENSOR', 'Laser scanners', 'Edit laser scanners')]
                   # ('POSITION', 'Position sensors', 'Edit position sensors')]
        ))

        self.active_sensor = PropertyHandler(StringProperty(name="Active sensor", default=""))

        self.physics_type = PropertyHandler(EnumProperty(items=[('PHYSICS_FRAME', 'Mast object', 'Mast object')]))

        self.display_physics_selection = PropertyHandler(BoolProperty(name="Show Physics Frames", description="Show or hide physics frames", default=True, update=self.display_physics))


        # Holds the selection to list connected or unastigned meshes in dropdown menus
        self.list_meshes = PropertyHandler(EnumProperty(
            items=[("all", 'List all', 'Show all meshes in menu', 'RESTRICT_VIEW_OFF', 1),
                   ("connected", 'List connected', 'Show only connected meshes in menu', 'OUTLINER_OB_ARMATURE', 2),
                   ('disconnected', 'List disconnected', 'Show only disconnected meshes in menu',
                    'ARMATURE_DATA', 3)]))

        self.astign_collision = PropertyHandler(BoolProperty(name="astign as Collision Mesh", description="Adds a collision tag to the mesh", default=False))

        # Holds the selection of wheter do hide/display connected/unastigned meshes in the 3D viewport
        self.display_mesh_selection = PropertyHandler(EnumProperty(
            items=[('all', 'All',
                    'Show all objects in viewport'),
                   ('collision', 'Collision',
                    'Show only connected collision models'),
                   ('visual', 'Visual',
                    'Show only connected visual models'),
                   ('none', "None", "Show no connected model")],
            update=self.display_geometries))

        # Holds the selection to list connected or unastigned segments in dropdown menus
        self.list_segments = PropertyHandler(EnumProperty(
            items=[("all", 'List all', 'Show all bones in menu', 'RESTRICT_VIEW_OFF', 1),
                   ("connected", 'List connected', 'Show only bones with connected meshes in menu',
                    'OUTLINER_OB_ARMATURE', 2,),
                   ('disconnected', 'List disconnected',
                    'List only bones without connected meshes in menu', 'ARMATURE_DATA', 3)]))

        self.storage_mode = PropertyHandler(EnumProperty(items=[('temporary', 'Non-persistant GIT',
                                                           'Stores/retrieves files from GIT temporary' +
                                                           ' repository'),
                                                                ('git', 'Persitant GIT',
                                                           'Stores/retrieves files from persistent GIT repository'),
                                                                ('local', 'Local',
                                                           'Stores/retrieves from local hard disk')]))
        self.git_url = PropertyHandler(StringProperty(name='GIT URL'))
        self.git_repository = PropertyHandler(StringProperty(name='GIT Repository'))

        self.segment_tab = PropertyHandler(EnumProperty(
            items=[('kinematics', 'Kinematics', 'Edit kinematic properties'),
                   ('dynamics', 'Dynamics', 'Edit Dynamic properties'),
                   ('controller', 'Controller', 'Edit Controller properties')],
            name="asdf"))

        self.bone_length = PropertyHandler(FloatProperty(name="Global bone length", default=1, min=0.001,
                                                         update=self.updateGlobals))
        self.do_kinematic_update = PropertyHandler(BoolProperty(name="Import Update", default=True))

        self.gazebo_tags = PropertyHandler(StringProperty(name="Gazebo tags", default=""))

        self.operator_debug_level = PropertyHandler(EnumProperty(
            items=[('debug', 'Debug', 'Log everything including debug messages (verbose)'),
                   ('info', 'Info', 'Log information'),
                   ('warning', 'Warning', 'Log only warnings'),
                   ('error', 'Error', 'Log only errors')], update=self.debug_level_callback))

        self.active_muscle = PropertyHandler(StringProperty(name="Active Muscle", default=""))

        self.display_muscle_selection = PropertyHandler(EnumProperty(
            items=[('all', 'All', 'Show all muscles'),
            #       ('MYOROBOTICS', 'Myorobotics', 'Show only Myorobotics Muscles'),
                   ('MILLARD_EQUIL', 'Millard Equilibrium 2012', 'Show only Millard Equilibrium 2012 Muscles'),
                   ('MILLARD_ACCEL', 'Millard Acceleration 2012', 'Show only Millard Acceleration 2012 Muscles'),
                   ('THELEN', 'Thelen 2003', 'Show only Thelen 2003 Muscles'),
                   ('RIGID_TENDON', 'Rigid Tendon', 'Show only Rigid Tendon Muscles'),
                   ('none', "None", "Show no muscles")],
            update=self.display_muscles))

        self.muscle_dim = PropertyHandler(FloatProperty(name="Muscle Dimension:", default=0.05, update=self.muscle_dim_update))

0 View Complete Implementation : extentions.py
Copyright MIT License
Author : michaeldegroot
def register():
    Scene.armature = EnumProperty(
        name='Armature',
        description='Select the armature which will be used by Cats',
        items=Common.get_armature_list,
        update=Common.update_material_list
    )

    Scene.zip_content = EnumProperty(
        name='Zip Content',
        description='Select the model you want to import',
        items=Importer.get_zip_content
    )

    Scene.keep_upper_chest = BoolProperty(
        name='Keep Upper Chest',
        description="VrChat now partially supports the Upper Chest bone, so deleting it is no longer necessary."
                    "\n\nWARNING: Currently this breaks Eye Tracking, so don't check this if you want Eye Tracking",
        default=False
    )

    Scene.combine_mats = BoolProperty(
        name='Combine Same Materials',
        description="Combines similar materials into one, reducing draw calls.\n\n"
                    'Your avatar should visibly look the same after this operation.\n'
                    'This is a very important step for optimizing your avatar.\n'
                    'If you have problems with this, uncheck this option and tell us!\n',
        default=True
    )

    Scene.remove_zero_weight = BoolProperty(
        name='Remove Zero Weight Bones',
        description="Cleans up the bones hierarchy, deleting all bones that don't directly affect any vertices.\n"
                    'Uncheck this if bones you want to keep got deleted',
        default=True
    )

    Scene.keep_end_bones = BoolProperty(
        name='Keep End Bones',
        description="Saves end bones from deletion."
                    '\n\nThis can improve skirt movement for dynamic bones, but increases the bone count.'
                    '\nThis can also fix issues with crumbled finger bones in Unity.'
                    '\nMake sure to always uncheck "Add Leaf Bones" when exporting or use the CATS export button',
        default=False
    )

    Scene.join_meshes = BoolProperty(
        name='Join Meshes',
        description='Joins all meshes of this model together.'
                    '\nIt also:'
                    '\n  - Applies all transformations'
                    '\n  - Repairs broken armature modifiers'
                    '\n  - Applies all decimation and mirror modifiers'
                    '\n  - Merges UV maps correctly'
                    '\n'
                    '\nINFO: You should always join your meshes',
        default=True
    )

    Scene.connect_bones = BoolProperty(
        name='Connect Bones',
        description="This connects all bones to their child bone if they have exactly one child bone.\n"
                    "This will not change how the bones function in any way, it just improves the aesthetic of the armature",
        default=True
    )

    Scene.fix_materials = BoolProperty(
        name='Fix Materials',
        description="This will apply some VRChat related fixes to materials",
        default=True
    )

    Scene.use_google_only = BoolProperty(
        name='Use Old Translations (not recommended)',
        description="Ignores the internal dictionary and only uses the Google Translator for shape key translations."
                    "\n"
                    '\nThis will result in slower translation speed and worse translations, but the translations will be like in CATS version 0.9.0 and older.'
                    "\nOnly use this if you have animations which rely on the old translations and you don't want to convert them to the new ones",
        default=False
    )

    Scene.show_more_options = BoolProperty(
        name='Show More Options',
        description="Shows more model options",
        default=False
    )

    Scene.merge_mode = EnumProperty(
        name="Merge Mode",
        description="Mode",
        items=[
            ("ARMATURE", "Merge Armatures", "Here you can merge two armatures together."),
            ("MESH", "Attach Mesh", "Here you can attach a mesh to an armature.")
        ]
    )

    Scene.merge_armature_into = EnumProperty(
        name='Base Armature',
        description='Select the armature into which the other armature will be merged\n',
        items=Common.get_armature_list
    )

    Scene.merge_armature = EnumProperty(
        name='Merge Armature',
        description='Select the armature which will be merged into the selected armature above\n',
        items=Common.get_armature_merge_list
    )

    Scene.attach_to_bone = EnumProperty(
        name='Attach to Bone',
        description='Select the bone to which the armature will be attached to\n',
        items=Common.get_bones_merge
    )

    Scene.attach_mesh = EnumProperty(
        name='Attach Mesh',
        description='Select the mesh which will be attached to the selected bone in the selected armature\n',
        items=Common.get_top_meshes
    )

    Scene.merge_same_bones = BoolProperty(
        name='Merge All Bones',
        description='Merges all bones together that have the same name instead of only the base bones (Hips, Spine, etc).'
                    '\nYou will have to make sure that all the bones you want to merge have the same name.'
                    '\n'
                    "\nIf this is checked, you won't need to fix the model with CATS beforehand but it is still advised to do so."
                    "\nIf this is unchecked, CATS will only merge the base bones (Hips, Spine, etc)."
                    "\n"
                    "\nThis can have unintended side effects, so check your model afterwards!"
                    "\n",
        default=False
    )

    Scene.apply_transforms = BoolProperty(
        name='Apply Transforms',
        description='Check this if both armatures and meshes are already at their correct positions.'
                    '\nThis will cause them to stay exactly like they are when merging',
        default=False
    )

    Scene.merge_armatures_join_meshes = BoolProperty(
        name='Join Meshes',
        description='This will join all meshes.'
                    '\nNot checking this will always apply transforms',
        default=True
    )

    # Decimation
    Scene.decimation_mode = EnumProperty(
        name="Decimation Mode",
        description="Decimation Mode",
        items=[
            ("SAFE", "Safe", 'Decent results - no shape key loss\n'
                             '\n'
                             "This will only decimate meshes with no shape keys.\n"
                             "The results are decent and you won't lose any shape keys.\n"
                             'Eye Tracking and Lip Syncing will be fully preserved.'),

            ("HALF", "Half", 'Good results - minimal shape key loss\n'
                             "\n"
                             "This will only decimate meshes with less than 4 shape keys as those are often not used.\n"
                             'The results are better but you will lose the shape keys in some meshes.\n'
                             'Eye Tracking and Lip Syncing should still work.'),

            ("FULL", "Full", 'Best results - full shape key loss\n'
                             '\n'
                             "This will decimate your whole model deleting all shape keys in the process.\n"
                             'This will give the best results but you will lose the ability to add blinking and Lip Syncing.\n'
                             'Eye Tracking will still work if you disable Eye Blinking.'),

            ("CUSTOM", "Custom", 'Custom results - custom shape key loss\n'
                                 '\n'
                                 "This will let you choose which meshes and shape keys should not be decimated.\n")
        ],
        default='HALF'
    )

    Scene.selection_mode = EnumProperty(
        name="Selection Mode",
        description="Selection Mode",
        items=[
            ("SHAPES", "Shape Keys", 'Select all the shape keys you want to preserve here.'),
            ("MESHES", "Meshes", "Select all the meshes you don't want to decimate here.")
        ]
    )

    Scene.add_shape_key = EnumProperty(
        name='Shape',
        description='The shape key you want to keep',
        items=Common.get_shapekeys_decimation
    )

    Scene.add_mesh = EnumProperty(
        name='Mesh',
        description='The mesh you want to leave untouched by the decimation',
        items=Common.get_meshes_decimation
    )

    Scene.decimate_fingers = BoolProperty(
        name="Save Fingers",
        description="Check this if you don't want to decimate your fingers!\n"
                    "Results will be worse but there will be no issues with finger movement.\n"
                    "This is probably only useful if you have a VR headset.\n"
                    "\n"
                    "This operation requires the finger bones to be named specifically:\n"
                    "Thumb(0-2)_(L/R)\n"
                    "IndexFinger(1-3)_(L/R)\n"
                    "MiddleFinger(1-3)_(L/R)\n"
                    "RingFinger(1-3)_(L/R)\n"
                    "LittleFinger(1-3)_(L/R)"
    )

    Scene.decimate_hands = BoolProperty(
        name="Save Hands",
        description="Check this if you don't want to decimate your full hands!\n"
                    "Results will be worse but there will be no issues with hand movement.\n"
                    "This is probably only useful if you have a VR headset.\n"
                    "\n"
                    "This operation requires the finger and hand bones to be named specifically:\n"
                    "Left/Right wrist\n"
                    "Thumb(0-2)_(L/R)\n"
                    "IndexFinger(1-3)_(L/R)\n"
                    "MiddleFinger(1-3)_(L/R)\n"
                    "RingFinger(1-3)_(L/R)\n"
                    "LittleFinger(1-3)_(L/R)"
    )

    Scene.max_tris = IntProperty(
        name='Tris',
        description="The target amount of tris after decimation",
        default=70000,
        min=1,
        max=200000
    )

    # Eye Tracking
    Scene.eye_mode = EnumProperty(
        name="Eye Mode",
        description="Mode",
        items=[
            ("CREATION", "Creation", "Here you can create eye tracking."),
            ("TESTING", "Testing", "Here you can test how eye tracking will look ingame.")
        ],
        update=Eyetracking.stop_testing
    )

    Scene.mesh_name_eye = EnumProperty(
        name='Mesh',
        description='The mesh with the eyes vertex groups',
        items=Common.get_meshes
    )

    Scene.head = EnumProperty(
        name='Head',
        description='The head bone containing the eye bones',
        items=Common.get_bones_head
    )

    Scene.eye_left = EnumProperty(
        name='Left Eye',
        description='The models left eye bone',
        items=Common.get_bones_eye_l
    )

    Scene.eye_right = EnumProperty(
        name='Right Eye',
        description='The models right eye bone',
        items=Common.get_bones_eye_r
    )

    Scene.wink_left = EnumProperty(
        name='Blink Left',
        description='The shape key containing a blink with the left eye',
        items=Common.get_shapekeys_eye_blink_l
    )

    Scene.wink_right = EnumProperty(
        name='Blink Right',
        description='The shape key containing a blink with the right eye',
        items=Common.get_shapekeys_eye_blink_r
    )

    Scene.lowerlid_left = EnumProperty(
        name='Lowerlid Left',
        description='The shape key containing a slightly raised left lower lid.\n'
                    'Can be set to "Basis" to disable lower lid movement',
        items=Common.get_shapekeys_eye_low_l
    )

    Scene.lowerlid_right = EnumProperty(
        name='Lowerlid Right',
        description='The shape key containing a slightly raised right lower lid.\n'
                    'Can be set to "Basis" to disable lower lid movement',
        items=Common.get_shapekeys_eye_low_r
    )

    Scene.disable_eye_movement = BoolProperty(
        name='Disable Eye Movement',
        description='IMPORTANT: Do your decimation first if you check this!\n'
                    '\n'
                    'Disables eye movement. Useful if you only want blinking.\n'
                    'This creates eye bones with no movement bound to them.\n'
                    'You still have to astign "LeftEye" and "RightEye" to the eyes in Unity',
        subtype='DISTANCE'
    )

    Scene.disable_eye_blinking = BoolProperty(
        name='Disable Eye Blinking',
        description='Disables eye blinking. Useful if you only want eye movement.\n'
                    'This will create the necessary shape keys but leaves them empty',
        subtype='NONE'
    )

    Scene.eye_distance = FloatProperty(
        name='Eye Movement Range',
        description='Higher = more eye movement\n'
                    'Lower = less eye movement\n'
                    'Warning: Too little or too much range can glitch the eyes.\n'
                    'Test your results in the "Eye Testing"-Tab!\n',
        default=0.8,
        min=0.0,
        max=2.0,
        step=1.0,
        precision=2,
        subtype='FACTOR'
    )

    Scene.eye_rotation_x = IntProperty(
        name='Up - Down',
        description='Rotate the eye bones on the vertical axis',
        default=0,
        min=-19,
        max=25,
        step=1,
        subtype='FACTOR',
        update=Eyetracking.set_rotation
    )

    Scene.eye_rotation_y = IntProperty(
        name='Left - Right',
        description='Rotate the eye bones on the horizontal axis.'
                    '\nThis is from your own point of view',
        default=0,
        min=-19,
        max=19,
        step=1,
        subtype='FACTOR',
        update=Eyetracking.set_rotation
    )

    Scene.iris_height = IntProperty(
        name='Iris Height',
        description='Moves the iris away from the eye ball',
        default=0,
        min=0,
        max=100,
        step=1,
        subtype='FACTOR'
    )

    Scene.eye_blink_shape = FloatProperty(
        name='Blink Strength',
        description='Test the blinking of the eye',
        default=1.0,
        min=0.0,
        max=1.0,
        step=1.0,
        precision=2,
        subtype='FACTOR'
    )

    Scene.eye_lowerlid_shape = FloatProperty(
        name='Lowerlid Strength',
        description='Test the lowerlid blinking of the eye',
        default=1.0,
        min=0.0,
        max=1.0,
        step=1.0,
        precision=2,
        subtype='FACTOR'
    )

    # Visemes
    Scene.mesh_name_viseme = EnumProperty(
        name='Mesh',
        description='The mesh with the mouth shape keys',
        items=Common.get_meshes
    )

    Scene.mouth_a = EnumProperty(
        name='Viseme AA',
        description='Shape key containing mouth movement that looks like someone is saying "aa".\nDo not put empty shape keys like "Basis" in here',
        items=Common.get_shapekeys_mouth_ah,
    )

    Scene.mouth_o = EnumProperty(
        name='Viseme OH',
        description='Shape key containing mouth movement that looks like someone is saying "oh".\nDo not put empty shape keys like "Basis" in here',
        items=Common.get_shapekeys_mouth_oh,
    )

    Scene.mouth_ch = EnumProperty(
        name='Viseme CH',
        description='Shape key containing mouth movement that looks like someone is saying "ch". Opened lips and clenched teeth.\nDo not put empty shape keys like "Basis" in here',
        items=Common.get_shapekeys_mouth_ch,
    )

    Scene.shape_intensity = FloatProperty(
        name='Shape Key Mix Intensity',
        description='Controls the strength in the creation of the shape keys. Lower for less mouth movement strength',
        default=1.0,
        min=0.0,
        max=10.0,
        step=0.1,
        precision=2,
        subtype='FACTOR'
    )

    # Bone Parenting
    Scene.root_bone = EnumProperty(
        name='To Parent',
        description='List of bones that look like they could be parented together to a root bone',
        items=Rootbone.get_parent_root_bones,
    )

    # Optimize
    Scene.optimize_mode = EnumProperty(
        name="Optimize Mode",
        description="Mode",
        items=[
            ("ATLAS", "Atlas", "Allows you to make a texture atlas."),
            ("MATERIAL", "Material", "Some various options on material manipulation."),
            ("BONEMERGING", "Bone Merging", "Allows child bones to be merged into their parents."),
        ]
    )

    # Atlas
    # Material.add_to_atlas = BoolProperty(
    #     description='Add this material to the atlas',
    #     default=False
    # )

    # Scene.material_list_index = IntProperty(
    #     default=0
    # )

    # Scene.material_list = CollectionProperty(
    #     type=Atlas.MaterialsGroup
    # )

    # Scene.clear_materials = BoolProperty(
    #     description='Clear materials checkbox',
    #     default=True
    # )

    # Bone Merging
    Scene.merge_ratio = FloatProperty(
        name='Merge Ratio',
        description='Higher = more bones will be merged\n'
                    'Lower = less bones will be merged\n',
        default=50,
        min=1,
        max=100,
        step=1,
        precision=0,
        subtype='PERCENTAGE'
    )

    Scene.merge_mesh = EnumProperty(
        name='Mesh',
        description='The mesh with the bones vertex groups',
        items=Common.get_meshes
    )

    Scene.merge_bone = EnumProperty(
        name='To Merge',
        description='List of bones that look like they could be merged together to reduce overall bones',
        items=Rootbone.get_parent_root_bones,
    )

    # Settings
    Scene.embed_textures = BoolProperty(
        name='Embed Textures on Export',
        description='Enable this to embed the texture files into the FBX file upon export.'
                    '\nUnity will automatically extract these textures and put them into a separate folder.'
                    '\nThis might not work for everyone and it increases the file size of the exported FBX file',
        default=False,
        update=Settings.update_settings
    )
    Scene.use_custom_mmd_tools = BoolProperty(
        name='Use Custom mmd_tools',
        description='Enable this to use your own version of mmd_tools. This will disable the internal cats mmd_tools',
        default=False,
        update=Settings.update_settings
    )

    Scene.debug_translations = BoolProperty(
        name='Debug Google Translations',
        description='Tests the Google Translations and prints the Google response in case of error',
        default=False
    )

0 View Complete Implementation : __init__.py
Copyright GNU General Public License v3.0
Author : Microvellum
def register():
    bpy.utils.register_clast(measureit_main.RunHintDisplayButton)
    bpy.utils.register_clast(measureit_main.AddSegmentButton)
    bpy.utils.register_clast(measureit_main.AddAreaButton)
    bpy.utils.register_clast(measureit_main.AddSegmentOrtoButton)
    bpy.utils.register_clast(measureit_main.AddAngleButton)
    bpy.utils.register_clast(measureit_main.AddArcButton)
    bpy.utils.register_clast(measureit_main.AddLabelButton)
    bpy.utils.register_clast(measureit_main.AddNoteButton)
    bpy.utils.register_clast(measureit_main.AddLinkButton)
    bpy.utils.register_clast(measureit_main.AddOriginButton)
    bpy.utils.register_clast(measureit_main.DeleteSegmentButton)
    bpy.utils.register_clast(measureit_main.DeleteAllSegmentButton)
    bpy.utils.register_clast(measureit_main.DeleteAllSumButton)
    bpy.utils.register_clast(measureit_main.MeasureitEditPanel)
    bpy.utils.register_clast(measureit_main.MeasureitMainPanel)
    bpy.utils.register_clast(measureit_main.MeasureitConfPanel)
    bpy.utils.register_clast(measureit_main.MeasureitRenderPanel)
    bpy.utils.register_clast(measureit_main.RenderSegmentButton)
    bpy.utils.register_clast(Measure_Pref)
    update_panel(None, bpy.context)
    # Define properties
    Scene.measureit_default_color = FloatVectorProperty(
        name="Default color",
        description="Default Color",
        default=(0.173, 0.545, 1.0, 1.0),
        min=0.1,
        max=1,
        subtype='COLOR',
        size=4)
    Scene.measureit_font_size = IntProperty(name="Text Size",
                                            description="Default text size",
                                            default=14, min=10, max=150)
    Scene.measureit_hint_space = FloatProperty(name='Separation', min=0, max=100, default=0.1,
                                               precision=3,
                                               description="Default distance to display measure")
    Scene.measureit_gl_ghost = BoolProperty(name="All",
                                            description="Display measures for all objects,"
                                                        " not only selected",
                                            default=True)
    Scene.measureit_gl_txt = StringProperty(name="Text", maxlen=256,
                                            description="Short description (use | for line break)")

    Scene.measureit_gl_precision = IntProperty(name='Precision', min=0, max=5, default=2,
                                               description="Number of decimal precision")
    Scene.measureit_gl_show_d = BoolProperty(name="ShowDist",
                                             description="Display distances",
                                             default=True)
    Scene.measureit_gl_show_n = BoolProperty(name="ShowName",
                                             description="Display texts",
                                             default=False)
    Scene.measureit_scale = BoolProperty(name="Scale",
                                         description="Use scale factor",
                                         default=False)
    Scene.measureit_scale_factor = FloatProperty(name='Factor', min=0.001, max=9999999,
                                                 default=1.0,
                                                 precision=3,
                                                 description="Scale factor 1:x")
    Scene.measureit_scale_color = FloatVectorProperty(name="Scale color",
                                                      description="Scale Color",
                                                      default=(1, 1, 0, 1.0),
                                                      min=0.1,
                                                      max=1,
                                                      subtype='COLOR',
                                                      size=4)
    Scene.measureit_scale_font = IntProperty(name="Font",
                                             description="Text size",
                                             default=14, min=10, max=150)
    Scene.measureit_scale_pos_x = IntProperty(name="Position X",
                                              description="Margin on the X axis",
                                              default=5,
                                              min=0,
                                              max=100)
    Scene.measureit_scale_pos_y = IntProperty(name="Position Y",
                                              description="Margin on the Y axis",
                                              default=5,
                                              min=0,
                                              max=100)
    Scene.measureit_gl_scaletxt = StringProperty(name="ScaleText", maxlen=48,
                                                 description="Scale satle",
                                                 default="Scale:")
    Scene.measureit_scale_precision = IntProperty(name='Precision', min=0, max=5, default=0,
                                                  description="Number of decimal precision")

    Scene.measureit_ovr = BoolProperty(name="Override",
                                       description="Override colors and fonts",
                                       default=False)
    Scene.measureit_ovr_font = IntProperty(name="Font",
                                           description="Override text size",
                                           default=14, min=10, max=150)
    Scene.measureit_ovr_color = FloatVectorProperty(name="Override color",
                                                    description="Override Color",
                                                    default=(1, 0, 0, 1.0),
                                                    min=0.1,
                                                    max=1,
                                                    subtype='COLOR',
                                                    size=4)
    Scene.measureit_ovr_width = IntProperty(name='Override width', min=1, max=10, default=1,
                                            description='override line width')

    Scene.measureit_units = EnumProperty(items=(('1', "Automatic", "Use scene units"),
                                                ('2', "Meters", ""),
                                                ('3', "Centimeters", ""),
                                                ('4', "Milimiters", ""),
                                                ('5', "Feet", ""),
                                                ('6', "Inches", "")),
                                         name="Units",
                                         default="2",
                                         description="Units")
    Scene.measureit_hide_units = BoolProperty(name="hide_units",
                                              description="Do not display unit of measurement on viewport",
                                              default=False)
    Scene.measureit_render = BoolProperty(name="Render",
                                          description="Save an image with measures over"
                                                      " render image",
                                          default=False)
    Scene.measureit_render_type = EnumProperty(items=(('1', "*Current", "Use current render"),
                                                      ('2', "OpenGL", ""),
                                                      ('3', "Animation OpenGL", ""),
                                                      ('4', "Image", ""),
                                                      ('5', "Animation", "")),
                                               name="Render type",
                                               description="Type of render image")
    Scene.measureit_sum = EnumProperty(items=(('99', "-", "Select a group for sum"),
                                              ('0', "A", ""),
                                              ('1', "B", ""),
                                              ('2', "C", ""),
                                              ('3', "D", ""),
                                              ('4', "E", ""),
                                              ('5', "F", ""),
                                              ('6', "G", ""),
                                              ('7', "H", ""),
                                              ('8', "I", ""),
                                              ('9', "J", ""),
                                              ('10', "K", ""),
                                              ('11', "L", ""),
                                              ('12', "M", ""),
                                              ('13', "N", ""),
                                              ('14', "O", ""),
                                              ('15', "P", ""),
                                              ('16', "Q", ""),
                                              ('17', "R", ""),
                                              ('18', "S", ""),
                                              ('19', "T", ""),
                                              ('20', "U", ""),
                                              ('21', "V", ""),
                                              ('22', "W", ""),
                                              ('23', "X", ""),
                                              ('24', "Y", ""),
                                              ('25', "Z", "")),
                                       name="Sum in Group",
                                       description="Add segment length in selected group")

    Scene.measureit_rf = BoolProperty(name="render_frame",
                                      description="Add a frame in render output",
                                      default=False)
    Scene.measureit_rf_color = FloatVectorProperty(name="Fcolor",
                                                   description="Frame Color",
                                                   default=(0.9, 0.9, 0.9, 1.0),
                                                   min=0.1,
                                                   max=1,
                                                   subtype='COLOR',
                                                   size=4)
    Scene.measureit_rf_border = IntProperty(name='fborder ', min=1, max=1000, default=10,
                                            description='Frame space from border')
    Scene.measureit_rf_line = IntProperty(name='fline', min=1, max=10, default=1,
                                          description='Line width for border')

    Scene.measureit_glarrow_a = EnumProperty(items=(('99', "--", "No arrow"),
                                                    ('1', "Line",
                                                     "The point of the arrow are lines"),
                                                    ('2', "Triangle",
                                                     "The point of the arrow is triangle"),
                                                    ('3', "TShape",
                                                     "The point of the arrow is a T")),
                                             name="A end",
                                             description="Add arrows to point A")
    Scene.measureit_glarrow_b = EnumProperty(items=(('99', "--", "No arrow"),
                                                    ('1', "Line",
                                                     "The point of the arrow are lines"),
                                                    ('2', "Triangle",
                                                     "The point of the arrow is triangle"),
                                                    ('3', "TShape",
                                                     "The point of the arrow is a T")),
                                             name="B end",
                                             description="Add arrows to point B")
    Scene.measureit_glarrow_s = IntProperty(name="Size",
                                            description="Arrow size",
                                            default=15, min=6, max=500)

    Scene.measureit_debug = BoolProperty(name="Debug",
                                         description="Display information for debuging"
                                                     " (expand/collapse for enabling or disabling)"
                                                     " this information is only renderered for "
                                                     "selected objects",
                                         default=False)
    Scene.measureit_debug_select = BoolProperty(name="Selected",
                                                description="Display information "
                                                            "for selected vertices/faces",
                                                default=False)
    Scene.measureit_debug_vertices = BoolProperty(name="Vertices",
                                                  description="Display vertex number",
                                                  default=True)
    Scene.measureit_debug_location = BoolProperty(name="Location",
                                                  description="Display vertex location",
                                                  default=False)
    Scene.measureit_debug_faces = BoolProperty(name="Faces",
                                               description="Display face number",
                                               default=False)
    Scene.measureit_debug_normals = BoolProperty(name="Normals",
                                                 description="Display face normal "
                                                             "vector and creation order",
                                                 default=False)
    Scene.measureit_debug_normal_details = BoolProperty(name="Details",
                                                        description="Display face normal details",
                                                        default=True)
    Scene.measureit_debug_font = IntProperty(name="Font",
                                             description="Debug text size",
                                             default=14, min=10, max=150)
    Scene.measureit_debug_color = FloatVectorProperty(name="Debug color",
                                                      description="Debug Color",
                                                      default=(1, 0, 0, 1.0),
                                                      min=0.1,
                                                      max=1,
                                                      subtype='COLOR',
                                                      size=4)
    Scene.measureit_debug_color2 = FloatVectorProperty(name="Debug face color",
                                                       description="Debug face Color",
                                                       default=(0, 1, 0, 1.0),
                                                       min=0.1,
                                                       max=1,
                                                       subtype='COLOR',
                                                       size=4)
    Scene.measureit_debug_color3 = FloatVectorProperty(name="Debug vector color",
                                                       description="Debug vector Color",
                                                       default=(1.0, 1.0, 0.1, 1.0),
                                                       min=0.1,
                                                       max=1,
                                                       subtype='COLOR',
                                                       size=4)
    Scene.measureit_debug_normal_size = FloatProperty(name='Len', min=0.001, max=9,
                                                      default=0.5,
                                                      precision=2,
                                                      description="Normal arrow size")
    Scene.measureit_debug_width = IntProperty(name='Debug width', min=1, max=10, default=2,
                                              description='Vector line thickness')
    Scene.measureit_debug_precision = IntProperty(name='Precision', min=0, max=5, default=1,
                                                  description="Number of decimal precision")

    # OpenGL flag
    wm = WindowManager
    # register internal property
    wm.measureit_run_opengl = BoolProperty(default=False)