I'm trying to add a folder dialog box in the add-on I'm working on. I managed to add a button that opens a folder dialog and setup the path, but I'd like to be able to see that path rather than just printing it in the console.
Something like that :
I'm currently using an operator and I found out that I need to use a Property, here's what I tried :
class project_path(bpy.types.PropertyGroup): path: bpy.props.StringProperty(subtype="DIR_PATH")
and then tried to call it in my Panel with :
class PT_Panel(Panel): bl_space_type = "VIEW_3D" bl_region_type ="UI" bl_label = "Operations" bl_category = "Tools" def draw(self, context): layout = self.layout sce = context.scene box = layout.box() box.label( text = "Project Path") row = box.row() row.prop(sce.project_path,"path",text='Project Path')
But then I got that error :
AttributeError: 'Scene' object has no attribute 'project_path'
Can't find any help on that, I guess I'm not using the correct attribute, but I've tried a bunch of different things without success, am I not supposed to use the class as an attribute ?
I found this question that is relevant, but it's also not explaining where the attribute is taken from.