Skip to content

Extract Selection - Complete Documentation

The "Extract Selection" tool in DAMTools allows extracting selected objects to a new .blend file, including materials and textures if desired. It's ideal for separating parts of a scene, creating independent files, or preparing assets for sharing.


Index


What is Extract Selection?

It allows extracting selected objects to a new .blend file, optionally copying materials and textures. The process is safe and automated, ideal for splitting large scenes or creating reusable assets.


Workflow

  1. Select the objects to extract.
  2. Activate the "Extract Selection to New File" operator from the sidebar panel or pie menu.
  3. Choose whether to include materials and textures in the pop-up dialog.
  4. The addon saves the current file, creates a new one, and transfers the selected objects.
  5. The dialog to save the new .blend file opens.

Shortcuts and Access

  • DAMTools Sidebar Panel: "Extract Selection to New File" option.
  • DAMTools Pie Menu (Shift+W): "Extract Selection" option.
  • Operator: object.extract_selected

Functionality Explanation

Extraction with Materials and Textures

  • Allows choosing whether to include materials and textures of the selected objects.
  • Ideal for preparing complete assets or lightweight versions.

Saving and File Dialog

  • The workflow automates saving the current file and creating the new file.
  • A sequential name is suggested for the new file.

State Restoration

  • The operator manages the selection and file state to prevent data loss.
  • Includes handlers to continue the process after opening the new file.

Key Code Snippets

Extraction and Saving Handler

@bpy.app.handlers.persistent
def extract_handler(dummy):
    # Imports the selected objects into the new file and opens the save dialog

Operator Execution

def execute(self, context):
    # Saves the current file, creates a temporary file, transfers objects, and opens the new file

For technical details and explanation of each file, see the technical documentation in the [DOCUMENTATION] folder.