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
  • 2
    $\begingroup$ Suggest looking at Text Editor > Templates > Python > Operator Import Export examples. $\endgroup$ – batFINGER Mar 22 '20 at 10:54
0
$\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
  • 3
    $\begingroup$ Hi :). I think he wants to do it using a script. Maybe he's making an addon... $\endgroup$ – Jachym Michal Mar 20 '20 at 22:07
  • $\begingroup$ Okay, then I can't help with that, since I don't know any programming language. $\endgroup$ – 2Way Mar 20 '20 at 22:08
  • $\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$ – jfilipedias Mar 21 '20 at 23:43
  • $\begingroup$ That's a brilliant plugin idea! When it's done, please do share it! $\endgroup$ – 2Way Mar 23 '20 at 15:46

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.