0

The default options for importing obj files are destructive, which is very bad. I'd like to alter the default options.

I am aware that you can save a set of operator presets, but I can't see how to make this set the default. It defeats the purpose of saving new options, if you have to keep altering the option set every time.

Is there any way to do this?

CMK_blender
  • 147
  • 8

1 Answers1

0

TL;DR: Editing this file works:

C:\Program Files\Blender Foundation\Blender 2.83\2.83\scripts\addons\io_scene_obj\__init__.py

Long version: How to edit the file:

This file is a text description of the UI elements a user sees when selecting file > import > wavefront (.obj).

If you look through the file, you will see class ImportOBJ and within that class, several blocks of text called "BoolProperty" or "StringProperty" or "EnumProperty".

Each of these blocks of text corresponds to an element you see in the "Blender File View" window operator presets panel:

blender file view

In my case, I was looking to alter the default value for "split/keep vert order" (because changing vert order on import is very unwise, as it's destructive), which was "ON" (split) in my distro (2.83.10). I changed it to "OFF" (Keep Vert Order):

    split_mode: EnumProperty(
        name="Split",
        items=(('ON', "Split", "Split geometry, omits unused verts"),
               ('OFF', "Keep Vert Order", "Keep vertex order from file"),
               ),
        default='OFF',
        )

You can use this technique to change the way the UI appears in many ways. This is just one small example, specific to this question.

CMK_blender
  • 147
  • 8
  • Instead of downvoting this, please comment on what's wrong with the answer. – CMK_blender Mar 22 '21 at 04:36
  • 2
    Editing those python files is just a temporary solution. Every time you update Blender (happens quite often), you have to make those edits hence not recommended, even if that's a quick way in your opinion. Not the downvoter btw. – brockmann Mar 22 '21 at 07:56
  • That's true, but the 'associated' answer doesn't describe how to circumvent this, that I can see. Unless the 'solution' is to write and maintain another addon. Which seems like more work than copying this init file over to a new version. Also I rarely update Blender, because it tends to break things. – CMK_blender Mar 22 '21 at 08:25
  • 2
    It actually does, both answers are in fact a nice list of all options you have. Also, just copying your file over, can break things as well in case the source code has been changed. – brockmann Mar 22 '21 at 08:29
  • Perhaps I am missing it, but I can't understand how the final linked answer applies to this problem at all. This one: https://blender.stackexchange.com/questions/2515/how-to-pass-multiple-operator-properties-via-ui-layout – CMK_blender Mar 22 '21 at 08:43
  • Doesn't matter, atm your question is a dupe of 'How do I change the default settings of export operators?' which helps to keep the site organzied. Also your 'solution' is even mentioned in one of those answers: "Another option is to edit original addon source, or copy the source to our own addons folder give the addon a new name. Disable the original and enable our edited copy..." – brockmann Mar 22 '21 at 08:57
  • It doesn't matter that the answer is not applicable? That answer doesn't describe specifically what to do in the case of this question. This answer does. – CMK_blender Mar 22 '21 at 09:03
  • this method no longer works in blender 3.1 is there another approach to this? presets do not exist either and it would save me a lot of time if there was still some way to set custom defaults – Julinator Mar 19 '22 at 03:09