[Bf-committers] Import based on extension

Dima Glibitsky dima.glib at gmail.com
Tue Oct 15 19:32:22 CEST 2013


>
> The main thing to resolve is how to show operator options (some way to
> re-initialize different operator properties when selecting a file with
> a different extension).


Hmm, would this work?
> class ImportByExtension(bpy.types.Operator, ImportHelper):
>     ...
>     def check(self, context): # is invoked on every filename change
>         reload_operator_options(self) # finds via reflection the import
operator (and its properties) by file extension
>         return _check_axis_conversion(self)
>     def draw(self, context):
>         draw_operator_options(self)
>     ...

I've actually written some time ago an export operator that uses reflection
to "wrap" other export operators (
https://raw.github.com/dairin0d/export-selected/master/io_export_selected.py).
It's kinda hacky, but it does the job. I suppose a similar thing can be
done for the extension-based import?



On Tue, Oct 15, 2013 at 7:02 PM, Jan Albartus <albartus at home.nl> wrote:

>
> I am unsure how practical this workflow would be;
>
> Import an object using the 'default' import settings. Then have in the
> toolshelf (on the left) the import options which a user can tweak.
> (changing an option will cause the current imported to be removed and
> re-import with the new settings.) This would mimic the way a new mesh,
> say a circle, where the user can change the radius/vertices as long as
> nothing has been edited.
>
> The problem becomes then that re-importing the mesh could take longer.
> (maybe an apply button?) The advantage could be that instead of making
> the selection up-front, it can be done after 'import'.
>
> I am unsure how practical (from a user's perspective) that would be
> though. Maybe setting the import options on forehand is the best way to
> go. It would be the first application to change import-settings after
> import?
> > This has come up before, and it can be done.
> >
> > The main thing to resolve is how to show operator options (some way to
> > re-initialize different operator properties when selecting a file with
> > a different extension).
> >
>
> _______________________________________________
> Bf-committers mailing list
> Bf-committers at blender.org
> http://lists.blender.org/mailman/listinfo/bf-committers
>


More information about the Bf-committers mailing list