1
$\begingroup$

I´m using the ImportHelper template in blender 2.8 for context: I have an importer that load data from *.xml or form a plain bynary container *.ar that have a list of file. So i want when i click a container file in the file dialog panel, its update an enum and only extracts what i selected. (currently import all files of the container)

I saw this question but i can adapt any answer yet Load and update enum values

The principal problem is that i dont know how to update a filelist menu, if in the draw method or any method that is trigger when file changed , i can update the enum property i solve it.

class ImportSomeData(Operator, ImportHelper):
    """This appears in the tooltip of the operator and in the generated docs"""
    bl_idname = "import_test.some_data"  # important since its how bpy.ops.import_test.some_data is constructed
    bl_label = "Import  Splines Data(*.path.xml;*.ar.??)"

    # ImportHelper mixin class uses this
    filename_ext = "*.path.xml|*.ar.$$"



    filelist: EnumProperty(
        name="Example Enum",
        items=(
            ('OPT_A', "First Option", "Description one"),
            ('OPT_B', "Second Option", "Description two"),
        ),    
    )

    def draw(self, context):        
        layout = self.layout  
        if re.match(r".*\.ar\.\d\d$",self.filepath):            
            if(self.lasfile!=self.filepath):
                (_,self.filetuples)=ar_tools.getARFileInfo(self.filepath)
            layout.prop(self, "type",expand=True)
            for f in self.filetuples.keys():
                if re.match(r".*.path\.xml$",f):
                    layout.label(text=f)
$\endgroup$

0

You must log in to answer this question.

Browse other questions tagged .