I have to allow users of my addon to select a path via the directory browser window of blender.
Instead of using this
I used Operator in panel to get the folder path from user as follows
I tried lot of ways and I referred this and still trying....
Here is my code, for operator to browser the folder and set it.
class OBJECT_OT_find(bpy.types.Operator):
bl_idname = "object.find"
bl_label = "Select Path "
directory = StringProperty(maxlen=1024, subtype='FILE_PATH', options={'HIDDEN', 'SKIP_SAVE'})
filter_image = BoolProperty(default=True, options={'HIDDEN', 'SKIP_SAVE'})
filter_folder = BoolProperty(default=True, options={'HIDDEN', 'SKIP_SAVE'})
filter_glob = StringProperty(default="", options={'HIDDEN', 'SKIP_SAVE'})
def execute(self, context):
# what to write
return {'FINISHED'}
def draw(self, context):
self.layout.operator('file.select_all_toggle')
def invoke(self, context, event):
wm = context.window_manager
wm.fileselect_add(self)
return {'RUNNING_MODAL'}
def register():
bpy.utils.register_class(OBJECT_OT_find)
bpy.utils.register_module(__name__)
bpy.types.Scene.FPath = StringProperty(name="Set Source to Find",
attr="custompath",
description="searching Images",
maxlen= 1024,
subtype='DIR_PATH',
default= "")
def unregister():
bpy.utils.register_class(OBJECT_OT_find)
bpy.utils.unregister_module(__name__)
del bpy.types.Scene.FPath
How can I get that path? I want to store and read it.
DIR_PATH
-typedStringProperty
? $\endgroup$