Advertisement
Guest User

Untitled

a guest
Dec 4th, 2019
240
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 1.45 KB | None | 0 0
  1. import bpy
  2. bl_info = {
  3.     "name" : "Test",
  4.     "version": (0, 0, 1),
  5.     "description" : "",
  6.     "blender" : (2, 80, 0),
  7.     "location" : "",
  8.     "warning" : "",
  9.     "category" : "Scene"
  10. }
  11.  
  12. class ThisThingOperator(bpy.types.Operator):
  13.     bl_idname = "scene.tester"        # Unique identifier for buttons and menu items to reference.    
  14.     bl_label = "Export tester project" # Display name in the interface.
  15.    
  16.     prop_directory : bpy.props.StringProperty(
  17.         name="Root Folder",
  18.         description="TesterButton.",
  19.         subtype="DIR_PATH"
  20.         )
  21.  
  22.     @classmethod
  23.     def poll(cls, context):
  24.         return (context.mode == 'OBJECT')
  25.  
  26.     def execute(self, context):        
  27.         return {'FINISHED'}
  28.        
  29.     def invoke(self, context, event): # Used for user interaction
  30.         wm = context.window_manager
  31.         return wm.invoke_props_dialog(self)
  32.  
  33.     def draw(self, context): # Draw options
  34.         row = self.layout
  35.         row.prop(self, "prop_directory", text="Bla")
  36.  
  37. def menu_func(self, context):
  38.     self.layout.operator(ThisThingOperator.bl_idname)
  39.  
  40. def register():
  41.     bpy.utils.register_class(ThisThingOperator)
  42.     bpy.types.TOPBAR_MT_render.append(menu_func)
  43.     bpy.types.Scene.directory = bpy.props.StringProperty(subtype='DIR_PATH')
  44.  
  45. def unregister():
  46.     bpy.utils.unregister_class(ThisThingOperator)
  47.     bpy.types.TOPBAR_MT_render.remove(menu_func)
  48.  
  49. if __name__ == "__main__":
  50.     register()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement