Skip to content

Makefiles

Daniel Lopez edited this page Apr 4, 2021 · 1 revision

Makefiles

Use Case 1: I want to add a step to render a blender file on a specific stage.

For this example, we'll be using the cool_scene stage found in the template.

cool_scene_render: blender/cool_scene.blend
  python3 scripts/render.py --stage cool_scene
  1. Add an extra step in Makefile found at root dir.
  2. If you're rendering a blender file:
  3. add the blend file as a dependency to that step
  4. ensure the arg for --stage is the same name as the stage in config.yaml
  5. save and run make cool_scene_render

Use Case 2: I want to run a python file within a blender file

For this example, we'll be using the scripts/get_path.py python file found in the template.

get_paths:
	docker run --rm -v ${PWD}/blender/:/blender/ -v ${PWD}/scripts:/scripts -v ${PWD}/config.yaml:/config.yaml tennisgazelle/blender-pipeline:latest blender/cool_scene.blend --python scripts/get_path.py
  1. Add an extra step inside Makefile found at root dir.
  2. Place the command found above inside it
bash what it means
docker run --rm -v run docker on an image that will execute and then die
-v ${PWD}/somedir/:/somedir/ copy this directory to the same directory inside the docker container/image; make sure to do this for both your blender directories, your config, your script, and any other dependencies you need to run
tennisgazelle/blender-pipeline:latest the docker image specific for this
blender/cool_scene.blend the blender file to render (the path is technically within the dockerfile, so wherever you place it from where you specify it (see a few bullet points ago))
--python scripts/get_path.py the file (again, technically a relative path from within the docker container)