Skip to content
This repository has been archived by the owner on Nov 10, 2024. It is now read-only.

Reports: ability to modify selection #55

Closed
Vinc3r opened this issue Jan 21, 2020 · 1 comment
Closed

Reports: ability to modify selection #55

Vinc3r opened this issue Jan 21, 2020 · 1 comment
Assignees
Labels
enhancement make life easier again

Comments

@Vinc3r
Copy link
Owner

Vinc3r commented Jan 21, 2020

No description provided.

@Vinc3r Vinc3r added the enhancement make life easier again label Jan 21, 2020
@Vinc3r Vinc3r added this to the Blender 2.8 public release milestone Jan 21, 2020
@Vinc3r Vinc3r self-assigned this Jan 21, 2020
@Vinc3r
Copy link
Owner Author

Vinc3r commented Jan 21, 2020

check https://blender.stackexchange.com/questions/35007/how-can-i-add-a-checkbox-in-the-tools-ui

bl_info = {
    "name": "tester",
    "description": "",
    "author": "poor",
    "version": (0, 0, 2),
    "blender": (2, 70, 0),
    "location": "UV/Image Editor > Tool Shelf (T)",
    "warning": "", # used for warning icon and text in addons panel
    "wiki_url": "",
    "tracker_url": "",
    "category": "Test"
}

import bpy

from bpy.props import (StringProperty,
                       BoolProperty,
                       IntProperty,
                       FloatProperty,
                       FloatVectorProperty,
                       EnumProperty,
                       PointerProperty,
                       )
from bpy.types import (Panel,
                       Operator,
                       AddonPreferences,
                       PropertyGroup,
                       )


# ------------------------------------------------------------------------
#    store properties in the active scene
# ------------------------------------------------------------------------

class MySettings(PropertyGroup):

    my_bool = BoolProperty(
        name="Enable or Disable",
        description="A bool property",
        default = False
        )

    my_int = IntProperty(
        name = "Set a value",
        description="A integer property",
        default = 23,
        min = 10,
        max = 100
        )

    my_float = FloatProperty(
        name = "Set a value",
        description = "A float property",
        default = 23.7,
        min = 0.01,
        max = 30.0
        )

# ------------------------------------------------------------------------
#    myTool in the image editor
# ------------------------------------------------------------------------

class UV_OT_my_panel(Panel):
    bl_idname = "UV_OT_my_panel"
    bl_label = "My Tool"
    bl_category = "My Category"
    bl_space_type = 'IMAGE_EDITOR'
    bl_region_type = 'TOOLS'

    def draw(self, context):
        layout = self.layout
        scene = context.scene
        mytool = scene.my_tool

        # display the properties
        layout.prop(mytool, "my_bool", text="Bool Property")
        layout.prop(mytool, "my_int", text="Integer Property")
        layout.prop(mytool, "my_float", text="Float Property")

        # check if bool property is enabled
        if (mytool.my_bool == True):
            print ("Property Enabled")
        else:
            print ("Property Disabled")


# ------------------------------------------------------------------------
# register and unregister functions
# ------------------------------------------------------------------------

def register():
    bpy.utils.register_module(__name__)
    bpy.types.Scene.my_tool = PointerProperty(type=MySettings)

def unregister():
    bpy.utils.unregister_module(__name__)
    del bpy.types.Scene.my_tool

if __name__ == "__main__":
    register()

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
enhancement make life easier again
Projects
None yet
Development

No branches or pull requests

1 participant