32 lines
		
	
	
		
			758 B
		
	
	
	
		
			Python
		
	
	
	
	
	
			
		
		
	
	
			32 lines
		
	
	
		
			758 B
		
	
	
	
		
			Python
		
	
	
	
	
	
| """
 | |
| Operator Example
 | |
| ++++++++++++++++
 | |
| 
 | |
| A common use of custom properties is for python based :class:`Operator` classes.
 | |
| """
 | |
| 
 | |
| import bpy
 | |
| 
 | |
| 
 | |
| class DialogOperator(bpy.types.Operator):
 | |
|     bl_idname = "object.dialog_operator"
 | |
|     bl_label = "Property Example"
 | |
| 
 | |
|     my_float = bpy.props.FloatProperty(name="Some Floating Point")
 | |
|     my_bool = bpy.props.BoolProperty(name="Toggle Option")
 | |
|     my_string = bpy.props.StringProperty(name="String Value")
 | |
| 
 | |
|     def execute(self, context):
 | |
|         print("Dialog Runs")
 | |
|         return {'FINISHED'}
 | |
| 
 | |
|     def invoke(self, context, event):
 | |
|         wm = context.window_manager
 | |
|         return wm.invoke_props_dialog(self)
 | |
| 
 | |
| 
 | |
| bpy.utils.register_class(DialogOperator)
 | |
| 
 | |
| # test call
 | |
| bpy.ops.object.dialog_operator('INVOKE_DEFAULT')
 |