Ok found another tutorial out there that did a great job of providing all properties on a Blender Panel.
go down to end here https://blender.stackexchange.com/questions/57306/how-to-create-a-custom-ui
My code is part of an add on that I really dont understand everything 100% but it works. so if anyone is interested you can take a look at it below. There are a lot of things commented out I just wanted something that would work since Ive been at this for several weeks now.
bl_info = {
"name": "JLE Tools",
"author": "James Erickson - JLE Studios",
"version": (3, 0),
"blender": (2, 79, 0),
"location": "VIEW3D > Tool Shelf > JleTools",
"description": "Curve vertex selection, total selection, import and export",
"category": "Selection and Import"
}
import bpy
from bpy.props import (StringProperty,
BoolProperty,
IntProperty,
FloatProperty,
EnumProperty,
PointerProperty,
)
from bpy.types import (Panel,
Operator,
PropertyGroup,
)
# ------------------------------------------------------------------------
# Scene Properties
# ------------------------------------------------------------------------
class MySettings(PropertyGroup):
#my_bool = BoolProperty(
# name="Enable or Disable",
# description="A bool property",
# default = False
# )
#my_int = IntProperty(
# name = "Int Value",
# description="A integer property",
# default = 23,
# min = 10,
# max = 100
# )
#my_float = FloatProperty(
# name = "Float Value",
# description = "A float property",
# default = 23.7,
# min = 0.01,
# max = 30.0
# )
my_string = StringProperty(
name="NewName",
description=":",
default="",
maxlen=1024,
)
#my_enum = EnumProperty(
# name="Dropdown:",
# description="Apply Data to attribute.",
# items=[ ('OP1', "Option 1", ""),
# ('OP2', "Option 2", ""),
# ('OP3', "Option 3", ""),
# ]
# )
def selectPoints(context, select_type):
ob = bpy.context.object
points = ob.data.splines.active.bezier_points
current_idx = 0
#need the total points in case the next index is past
total_points = len(points) - 1
#find the selected point by using enumerate that allows the array to have a searchable index
for idx, point in enumerate(points):
if point.select_control_point:
current_idx = idx
#set the previous and next index
prev_idx = current_idx - 1
next_idx = current_idx + 1
if prev_idx < 0:
prev_idx = total_points
if next_idx > total_points:
next_idx = 0
#everything is stored you can now check the parameter
#and run the selection requested
if select_type == "next":
points[current_idx].select_control_point = False
points[next_idx].select_control_point = True
if select_type == "prev":
points[current_idx].select_control_point = False
points[prev_idx].select_control_point = True
if select_type == "all":
for point in points:
point.select_control_point = True
#end the function for selection
# ------------------------------------------------------------------------
# Operators
# ------------------------------------------------------------------------
class obj_import_class(bpy.types.Operator):
bl_idname = "wm.import_obj"
bl_label = "Import Obj"
def execute(self, context):
scene = context.scene
mytool = scene.my_tool
md = bpy.context.mode
if md == 'EDIT_CURVE':
bpy.ops.object.mode_set(mode='OBJECT')
if md == "EDIT_MESH":
bpy.ops.object.mode_set(mode='OBJECT')
if md == "SCULPT":
bpy.ops.object.mode_set(mode='OBJECT')
# print the values to the console
print("Hello World")
#print("bool state:", mytool.my_bool)
#print("int value:", mytool.my_int)
#print("float value:", mytool.my_float)
print("string value:", mytool.my_string)
File_loc = 'M:\M_Daz\Blender\!!toBlender33.obj'
bpy.ops.import_scene.obj(
filepath=File_loc,
filter_glob="*.obj;*.mtl",
use_edges=True,
use_smooth_groups=True,
use_split_objects=False,
use_split_groups=False,
use_groups_as_vgroups=True,
use_image_search=True,
split_mode='OFF',
axis_forward='-Z',
axis_up='Y')
#get the current object
ob = bpy.context.selected_objects[0]
bpy.ops.object.shade_smooth()
ob.name = mytool.my_string
#print("enum state:", mytool.my_enum)
return {'FINISHED'}
class SelectNextVertexFunction(bpy.types.Operator):
"""Tooltip"""
bl_idname = "myops.select_next_vertex_function"
bl_label = "Select Next Curve Vertex"
def execute(self, context):
selectPoints(context, "next")
return {'FINISHED'}
class SelectPrevVertexFunction(bpy.types.Operator):
"""Tooltip"""
bl_idname = "myops.select_prev_vertex_function"
bl_label = "Select Prev Curve Vertex"
def execute(self, context):
selectPoints(context, "prev")
return {'FINISHED'}
class SelectAllVertexFunction(bpy.types.Operator):
"""Tooltip"""
bl_idname = "myops.select_all_vertex_function"
bl_label = "Select All Curve Vertex"
def execute(self, context):
selectPoints(context, "all")
return {'FINISHED'}
# ------------------------------------------------------------------------
# Menus
# ------------------------------------------------------------------------
#class OBJECT_MT_CustomMenu(bpy.types.Menu):
# bl_idname = "object.custom_menu"
# bl_label = "Select"
#
# def draw(self, context):
# layout = self.layout
#
# # Built-in example operators
# layout.operator("object.select_all", text="Select/Deselect All").action = 'TOGGLE'
# layout.operator("object.select_all", text="Inverse").action = 'INVERT'
# layout.operator("object.select_random", text="Random")
# ------------------------------------------------------------------------
# Panel in Object Mode
# ------------------------------------------------------------------------
class OBJECT_PT_CustomPanel(Panel):
bl_idname = "object.custom_panel"
bl_label = "Custom Tools"
bl_space_type = "VIEW_3D"
bl_region_type = "TOOLS"
bl_category = "JLE_Tools"
#bl_context = "objectmode"
#@classmethod
#def poll(self,context):
# return context.object is not None
def draw(self, context):
layout = self.layout
scene = context.scene
mytool = scene.my_tool
#layout.prop(mytool, "my_bool")
#layout.prop(mytool, "my_enum", text="")
#layout.prop(mytool, "my_int")
#layout.prop(mytool, "my_float")
layout.prop(mytool, "my_string")
layout.operator("wm.import_obj")
#layout.menu(OBJECT_MT_CustomMenu.bl_idname, text="Presets", icon="SCENE")
layout.separator()
#Next Vertex Group
row = layout.row()
row.label(text="Select Next Vertex", icon='CURVE_DATA')
row = layout.row()
row.operator("myops.select_next_vertex_function")
#Prev Vertex Group
row = layout.row()
row.label(text="Select Prev Vertex", icon='CURVE_DATA')
row = layout.row()
row.operator("myops.select_prev_vertex_function")
#All Vertex Group
row = layout.row()
row.label(text="Select All Vertexes", icon='CURVE_DATA')
row = layout.row()
row.operator("myops.select_all_vertex_function")
# ------------------------------------------------------------------------
# Registration
# ------------------------------------------------------------------------
classes = [SelectNextVertexFunction, SelectPrevVertexFunction, SelectAllVertexFunction, obj_import_class]
def register():
for cls in classes:
bpy.utils.register_class(cls)
bpy.utils.register_module(__name__)
bpy.types.Scene.my_tool = PointerProperty(type=MySettings)
print("registered")
def unregister():
for cls in classes:
bpy.utils.unregister_class(cls)
bpy.utils.unregister_module(__name__)
del bpy.types.Scene.my_tool
print("deleted tool")
if __name__ == "__main__":
register()
Thanks again to all who helped.