Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import bpy
- from bpy.props import EnumProperty
- def updateEnumParameter(self,context):
- print(self.my_axis)
- class cls_IntFloatString(bpy.types.PropertyGroup):
- axis_types = [
- ("0","None","None"),
- ("1","smile","smile"),
- ("2","content","content"),
- ("3","dizzy","dizzy"),
- ("4","cat","cat"),
- ("5","girl","girl"),
- ("6","yuck","yuck"),
- ("7","macho","macho"),
- ("8","pixel","pixel"),
- ("9","charming","charming"),
- ("10","cry","cry"),
- ("11","ouch","ouch"),
- ("12","ultraman","ultraman")
- ]
- my_axis= EnumProperty(name="My Face", description="The axis that will be relayed to the target.", default="0", items=axis_types, update=updateEnumParameter)
- bpy.utils.register_class(cls_IntFloatString)
- # Add these properties to every object in the entire Blender system (muha-haa!!)
- bpy.types.Object.My_List_Index = bpy.props.IntProperty(min= 0,default= 0)
- bpy.types.Object.My_List = bpy.props.CollectionProperty(type=cls_IntFloatString)
- class IntFloatStringPanel(bpy.types.Panel):
- bl_label = "Int Float String"
- bl_idname = "OBJECT_PT_hello"
- bl_space_type = "PROPERTIES"
- bl_region_type = "WINDOW"
- bl_context = "object"
- def draw(self, context):
- layout = self.layout
- ### context.object.My_List is never populated ###
- obj = context.object
- l = len(obj.My_List)
- if l > 0:
- #layout.label(text="Hello World")
- entry = obj.My_List[obj.My_List_Index]
- box1 = layout.box()
- row1 = box1.row()
- row1.label(" Label:", icon='INFO')
- # Display properties for each type.
- box1.prop(entry, 'my_axis')
- else:
- layout.label(text="Hello World")
- # This list is zero length, so let's add one.
- collection = obj.My_List
- collection.add()
- def register():
- bpy.utils.register_class(IntFloatStringPanel)
- def unregister():
- bpy.utils.unregister_class(IntFloatStringPanel)
- if __name__ == "__main__":
- register()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement