Code: Select all
import bpy
class CustomDrawOperator(bpy.types.Operator):
bl_idname = "object.custom_draw"
bl_label = "Simple Modal Operator"
filepath = bpy.props.StringProperty(subtype="FILE_PATH")
def execute(self, context):
print("Test", self)
return {'FINISHED'}
def invoke(self, context, event):
context.window_manager.fileselect_add(self)
return {'RUNNING_MODAL'}
class HelloWorldPanel(bpy.types.Panel):
bl_label = "Hello World Panel"
bl_idname = "OBJECT_PT_hello"
bl_space_type = "PROPERTIES"
bl_region_type = "WINDOW"
bl_context = "object"
my_test_bool = bpy.props.BoolProperty(name="my_test_bool", description="a bool property", default=False, options={'ANIMATABLE'}, subtype='NONE', update=None)
def draw(self, context):
layout = self.layout
obj = context.object
row = layout.row()
row.label(text="Hello world!", icon='WORLD_DATA')
row = layout.row()
row.label(text="Active object is: " + obj.name)
row = layout.row()
row.prop(obj, "name")
row = layout.row()
row.prop(self, "bl_context")
row = layout.row()
row.prop(self, "my_test_bool")
row = layout.row()
row.operator("object.custom_draw")
def register():
bpy.utils.register_class(CustomDrawOperator)
bpy.utils.register_class(HelloWorldPanel)
def unregister():
bpy.utils.unregister_class(CustomDrawOperator)
bpy.utils.unregister_class(HelloWorldPanel)
if __name__ == "__main__":
register()
Code: Select all
row.prop(self, "my_test_bool")
OBS1 - in the console is this info: "property not found: OBJECT_PT_hello.my_test_bool" <- very strange
OBS2 - I have Blender 2.6.2 running on Windows7.
Thanks in advance for any info about my not working code code.