Skip to content

Commit

Permalink
Little updates in preparation for release of v1.0.
Browse files Browse the repository at this point in the history
  • Loading branch information
Jason van Gumster committed May 25, 2021
1 parent 2912de6 commit 9a8cae4
Show file tree
Hide file tree
Showing 8 changed files with 558 additions and 10 deletions.
18 changes: 14 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
# Export to .blend

![Export to .blend](./img/export_to_blend.png)

A relatively simple exporter to take selected objects, collections, or nodes and export them to their own private .blend file... with a couple neat little bonus features.

Current features:
Expand Down Expand Up @@ -31,14 +33,18 @@ The most simple usage here is as expected, like most exporter add-ons.

This is the default behavior, exporting objects from your current 3D scene to a new `.blend` file. The File Browser that appears when executing this operator gives you the following export options:

![Export options](./img/export_options.png)

* **Export Selected** (enabled by default): Probably smart to just keep this on. Otherwise, you're basically just doing a "Save As" operation.
* **Export as Collection**: Optionally bundle your selected objects in a collection prior to exporting. (*Note: This collection only exists in your export file. It will not persist in your current file.*)
* **Collection Name**: If you choose to export your selection as a collection, you can name it here. By default, it has the super-exciting name, `export_collection`.
* **Mark as Asset**: *Blender 2.93+ only*. Optionally choose to mark your selected objects as assets when exporting. If you export to an Asset folder that Blender recognizes, your export should appear in your Asset Browser. (*Note: If you choose to export your objects as a collection, only that collection will be marked as an asset, not all of the constituent objects in that collection.*)
* **Mark as Asset**: *Only available in development versions of Blender*. Optionally choose to mark your selected objects as assets when exporting. If you export to an Asset folder that Blender recognizes, your export should appear in your Asset Browser. (*Note: If you choose to export your objects as a collection, only that collection will be marked as an asset, not all of the constituent objects in that collection.*)
* **Backlink**: This is a fun one. If you enable this option, after exporting your objects (or objects bundled in a collection) to a separate .blend file, all of the selected objects in your scene will be replaced with a linked library asset that points to the file you just exported.

### Exporting from the Outliner

![Export from the Outliner](./img/export_from_outliner.png)

This add-on also adds export options to the Outliner's context menu. If you select multiple objects in the Outliner, you can right-click your selection and choose *Export to .blend*. The File Browser will appear as described in the previous section.

Additionally, if you select a collection in the Outliner (currently this add-on only supports exporting one collection at a time), the *Export to .blend* option will also appear in the context menu. In this case, the File Browser options are much more limited. Currently, you can only choose if that collection is to be marked as an Asset when exporting.
Expand All @@ -47,19 +53,23 @@ Additionally, if you select a collection in the Outliner (currently this add-on

This add-on also provides the ability to export selected nodes to a separate `.blend` file. From any Node Editor (Shader Editor, Compositor, Texture Node Editor, Geometry Node Editor), you can navigate to Node > Export to .blend. When activating this operator, you get a File Browser with the following option:

![Options for exporting nodes](./img/export_options-nodes.png)

* **Export Selected** (enabled by default): Keeping this option enabled exports all selected nodes to their own `.blend` file. If you disable this option, the whole active node tree will be exported, but only the node tree in the current Node Editor.
* **Export as Node Group**: Similar to the Export as Collection option for objects, you can choose to optionally bundle your selected nodes in a group prior to exporting.
* **Group Name**: If you choose to export your nodes as a group, you can name it here. By default, the default name is `export_group`.
* **Backlink**: If you choose to bundle your nodes in a group when exporting, you have the option of replacing them with an instance of the node group you just exported, just like the corresponding option for objects and collections.

(*Note: In your exported file, you have an empty scene. The node tree you exported has a fake user. In order to see that node tree, you need to add whatever asset would make use of your node tree. For example, if your nodes belong to to a shader, then you need to add an object to the 3D scene and give it the shader you exported.*)

## Known issues

* You *really* should be in Object mode for any of this to work properly
* Currently, when enabling the *Mark as Asset* option, the text size of menu items in Blender's UI gets much larger. This is related to [T83896](https://developer.blender.org/T83896) and should [hopefully] be fixed prior to the release of Blender 2.93.
* If an object is part of multiple collections, that information is retained on export. However, if you backlink and make a proxy, the proxy object doesn't know about other collections.
* When exporting nodes as a node group, you will likely need to manage input and output sockets yourself.
* If you try to export a node that is within an existing node group, this add-on doesn't quite function as expected. Currently, it clears out just the other nodes within that group, but nothing in the group's parent tree.
* Exporting Compositor nodes is not currently supported. Blender crashes as per [T88402](https://developer.blender.org/T88402). Hopefully that's fixed before 2.93's release.
* When enabled, Compositor nodes will likely only export selected and be forced to be exported as a group.
* Exporting groups from custom nodes (e.g. Sverchok, Animation Nodes) is currently untested.
* Currently, when enabling the *Mark as Asset* option, the text size of menu items in Blender's UI gets much larger. This is related to [T83896](https://developer.blender.org/T83896) and should [hopefully] be fixed prior to the release of Blender 2.93.

## Wishlist

Expand Down
2 changes: 1 addition & 1 deletion __init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
bl_info = {
"name": "Export .blend",
"author": "Jason van Gumster (Fweeb)",
"version": (0, 9),
"version": (1, 0),
"blender": (2, 83, 0),
"location": "File > Export > Blender (.blend)/Outliner > Context Menu > Export to .blend",
"description": "Exports all or some datablocks to a separate .blend file",
Expand Down
10 changes: 5 additions & 5 deletions exporters.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ class ExportBlenderObjects(Operator, ExportHelper):
default="export_collection"
)

if bpy.app.version >= (2, 93, 0):
if bpy.app.version > (2, 93, 0):
mark_asset: BoolProperty(
name="Mark as Asset",
description="Mark selected objects as assets for visibility in the Asset Browser",
Expand All @@ -66,7 +66,7 @@ def draw(self, context):
box.prop(self, "export_as_collection")
if self.export_as_collection:
box.prop(self, "collection_name", icon="COLLECTION_NEW", icon_only=True)
if bpy.app.version >= (2, 93, 0):
if bpy.app.version > (2, 93, 0):
box.prop(self, "mark_asset")
box.prop(self, "backlink")

Expand All @@ -79,7 +79,7 @@ def execute(self, context):
"collection_name": self.collection_name,
"backlink": self.backlink
}
if bpy.app.version >= (2, 93, 0):
if bpy.app.version > (2, 93, 0):
export_settings["mark_asset"] = self.mark_asset
else:
export_settings["mark_asset"] = False
Expand All @@ -101,7 +101,7 @@ class ExportBlenderCollection(Operator, ExportHelper):
)

# Operator properties
if bpy.app.version >= (2, 93, 0):
if bpy.app.version > (2, 93, 0):
mark_asset: BoolProperty(
name="Mark as Asset",
description="Mark selected collection as an asset for visibility in the Asset Browser",
Expand All @@ -127,7 +127,7 @@ def execute(self, context):
"collection_name": context.selected_ids[0].name, #XXX Assumes only one collection is selected
"backlink": self.backlink
}
if bpy.app.version >= (2, 93, 0):
if bpy.app.version > (2, 93, 0):
export_settings["mark_asset"] = self.mark_asset
else:
export_settings["mark_asset"] = False
Expand Down
Binary file added img/export_from_outliner.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added img/export_options-nodes.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added img/export_options.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added img/export_to_blend.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading

0 comments on commit 9a8cae4

Please sign in to comment.