Convert Blender-Purge to a more generic Blender-Crawl Tool #42

Merged
Nick Alberelli merged 34 commits from feature/blender-crawl into main 2023-05-17 15:38:47 +02:00
Showing only changes of commit e1752508ed - Show all commits

View File

@ -1,71 +1,48 @@
# blender-purge
blender-purge is a command line tools to purge orphan data of blend files via the console.
# blender-crawl
blender-crawl is a command line tools to purge orphan data of blend files via the console.
## Table of Contents
- [Prerequisite](#prerequisite)
- [Installation](#installation)
- [How to get started](#how-to-get-started)
- [Development](#development)
## Prerequisite
In order to use this tool you need:
- python3
- pip
- svn
## Run without Installation
1. Clone repository
2. run `cd blender-crawl` to enter directory
3. Run program with `python blender-crawl /directory/`
## Installation
Download or clone this repository.
This repository is a command line tool that can be installed with the python packaging manager.
In the root of this project you can find a `install.sh` script which simplifies this process on linux.
This repository is a command line tool that can be installed with the python packaging manager.
This script does the following (follow this if you want to do this manually or on another platform):
1. Install pip
2. Open a terminal in the root of the project directory
3. Run `python3 setup.py bdist_wheel` which builds a wheel in ./dist
4. Run `pip3 install dist/<name_of_wheel> --user`
1. Clone repository
2. Run `cd blender-crawl` to enter directory
3. Install with `python setup.py install`
4. Run with `sudo python -m blender-crawl /directory/`
5. Get help with `sudo python3 -m blender-crawl -h`
Ensure your $PATH variable contains:
Linux/MacOs:
- `$HOME/.local/lib/python3.8/site-packages`
- `$HOME/.local/bin`
Windows:
- TODO
Open a new console and write `bpurge` to verify successful install.
## How to get started
After install you can write `bpurge` in to the console.
Run directly out of repo folder or follow above installation instructions.
If you use the tool the first time it will ask you to specify a path to a blender executable and a path to the svn project directory, which will be saved in a configuration file:
Linux/MacOs:
- `$home/.config/blender-purge/config.json`
Windows:
- `$home/blender-purge/config.json`
Give `bpurge` a path to a .blend file or a folder as first argument.
Give `blender-crawl` a path to a .blend file or a folder as first argument.
The detected blend files will be opened in the background, their orphan data will be
purged recursively, the file gets saved and closed again. This will happen twice for each .blend file.
You can modify the tool by providing these command line arguments:
If blender is not installed at the default location of your computer, you need to provide a blender executable
using the --exec flag.
- first arguments needs to be a path to a .blend file or a folder
- **-R / --recursive**: If -R is provided in combination with a folder path will perform recursive purge.
- **-N / --nocommit**: If -N is provided there will be no svn commit prompt with the purged files.
- **--regex**: Provide any regex pattern that will be performed on each found filepath with re.search().
- **--yes**: If --yes is provided there will be no confirmation prompt.
- --script Path to blender python script(s) to execute inside .blend files during crawl. Execution is skipped if no script is provided
- -r, --recursive If -R is provided in combination with a folder path will perform recursive crawl
- -f --filter Provide a string to filter the found .blend files
- -a, --ask If --ask is provided there will be no confirmation prompt before running script on .blend files.
- -p, --purge Run 'built-in function to purge data-blocks from all .blend files found in crawl.'.
- --exec EXEC If --exec user must provide blender executable path, OS default blender will not be used if found.
- -h, --help show the above help message and exit
## Development
In the project root you will find a `pyproject.toml` and `peotry.lock` file.
With `poetry` you can easily generate a virtual env for the project which should get you setup quickly.
Basic Usage: https://python-poetry.org/docs/basic-usage/