1
$\begingroup$

I'm trying to open a file browser (similar the browser in the image bellow) where the user can chose a folder and file name to save a new .blend file with the selected objects.

I want make a addon to easely save a new blender file e.g to select a collection and save a new blender file with the collection name and all objects inside there or select only two object and save a new file with that.

To do that I'm using the code bellow but all I get is some errors. Someone know a simple way to open that browser. I read some parts of the blender api documentation but I'm really confusing with some functions that I found in there.

The code I'm using:

class FileExporter(Operator):
    bl_idname = "export.file_exporter"
    bl_label = "Save"
    bl_options = {'REGISTER'}

    def export(self, context):
        self.file_path = bpy.path.relpath

        bpy.ops.wm.path_open(filepath=self.file_path)

    def execute(self, context):
        self.export(context)

        return {'FINISHED'}

Browser opened when chose File > Save As... option

$\endgroup$
1
  • 3
    $\begingroup$ Suggest looking at Text Editor > Templates > Python > Operator Import Export examples. $\endgroup$
    – batFINGER
    Commented Mar 22, 2020 at 10:54

1 Answer 1

-2
$\begingroup$

There is no need to use code to save stuff. It's quite simple, actually. Blender's file browser isn't like the one built-into your computer. You have to go through your drive's file system from the root to locate the destination folder that you would like to save your project to. First, select your main drive. While there, you will see a "users" folder. Double click on it, and then select the folder with the account name that you are using. Then you will find a long list of many folders. You'll also see folders such as documents, music, videos, and any other library. Click on the library that you wish to store your project in, and then select your folder, and name your file, then click "Save As" (or press enter) to save.

Hope that helps!

$\endgroup$
4
  • 5
    $\begingroup$ Hi :). I think he wants to do it using a script. Maybe he's making an addon... $\endgroup$ Commented Mar 20, 2020 at 22:07
  • $\begingroup$ Okay, then I can't help with that, since I don't know any programming language. $\endgroup$
    – 2Way
    Commented Mar 20, 2020 at 22:08
  • 1
    $\begingroup$ Hi 2Way, thank to reply. As Jachym mensioned above I want make a script to easely save a new blender file e.g to select a collection and save a new blender file with the collection name and all objects inside there or select only two object and save a new file with that. $\endgroup$ Commented Mar 21, 2020 at 23:43
  • 1
    $\begingroup$ That's a brilliant plugin idea! When it's done, please do share it! $\endgroup$
    – 2Way
    Commented Mar 23, 2020 at 15:46

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .