2

I have created a file browser operator using ImportHelper. What I want is I want to see the selected file details in the same window as I have shown in the screenshot. And the properties should update as I select any other file.

enter image description here

import bpy
from bpy_extras.io_utils import ImportHelper

class test_filebrowser(bpy.types.Operator, ImportHelper): bl_idname = 'test.file_browser' bl_label = 'Custom File Browser'

filter_glob : bpy.props.StringProperty(default = '*.mp4',options={'HIDDEN'})
resolution : bpy.props.IntVectorProperty(name='Resolution',size=2)

def execute(self, context):

    return {'FINISHED'}
def draw(self, context):
    layout = self.layout
    layout.label(text=f"Video Resolution: {self.resolution[0:2]}")

def register(): bpy.utils.register_class(test_filebrowser)

def unregister(): bpy.utils.register_class(test_filebrowser)

if name == "main": register()

Muzammil
  • 828
  • 2
  • 14
  • You need to use ffmpeg module. https://stackoverflow.com/questions/51342429/how-to-extract-metadata-of-video-files-using-python-3-7 – Karan Feb 28 '23 at 04:11
  • It works fine with VS code but the Blender python console is not working with it https://i.stack.imgur.com/7ulNE.png https://i.stack.imgur.com/2vW4T.png – Muzammil Feb 28 '23 at 17:48
  • Yes, you have to install ffmpeg module inside the blender python module. Read this: https://blender.stackexchange.com/questions/272610/how-to-install-python-module-before-installing-addon – Karan Feb 28 '23 at 19:22
  • Blender has a separate python lib, so you have to install ffmpeg in that lib so that it can be used in blender's interactive python console or by your addon – Karan Feb 28 '23 at 19:25

0 Answers0