python blender-expand-enum.py
Posted
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了python blender-expand-enum.py相关的知识,希望对你有一定的参考价值。
# for http://blender.stackexchange.com/questions/58171/how-to-create-a-boolean-vector-property-that-is-single-selection
bl_info = {
"name": "Add-on Template",
"description": "",
"author": "",
"version": (0, 0, 1),
"blender": (2, 70, 0),
"location": "3D View > Tools",
"warning": "", # used for warning icon and text in addons panel
"wiki_url": "",
"tracker_url": "",
"category": "Development"
}
import bpy
# ------------------------------------------------------------------------
# store properties in the active scene
# ------------------------------------------------------------------------
class MySettings(bpy.types.PropertyGroup):
my_bool = bpy.props.BoolProperty(
name="Enable or Disable",
description="A bool property",
default = False
)
my_axis = bpy.props.EnumProperty(
name="Axis",
description="Description",
items = (('POS_X', "X", ""),
('POS_Y', "Y", ""),
('POS_Z', "Z", ""),
),
default='POS_X'
)
# ------------------------------------------------------------------------
# my tool in objectmode
# ------------------------------------------------------------------------
class OBJECT_PT_my_panel(bpy.types.Panel):
bl_idname = "OBJECT_PT_my_panel"
bl_label = "My Panel"
bl_space_type = "VIEW_3D"
bl_region_type = "TOOLS"
bl_category = "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.row().prop(mytool, "my_axis", expand=True)
# ------------------------------------------------------------------------
# register and unregister
# ------------------------------------------------------------------------
def register():
bpy.utils.register_module(__name__)
bpy.types.Scene.my_tool = bpy.props.PointerProperty(type=MySettings)
def unregister():
bpy.utils.unregister_module(__name__)
del bpy.types.Scene.my_tool
if __name__ == "__main__":
register()
以上是关于python blender-expand-enum.py的主要内容,如果未能解决你的问题,请参考以下文章
Python代写,Python作业代写,代写Python,代做Python
Python开发
Python,python,python
Python 介绍
Python学习之认识python
python初识