Please help?! Change Texture directories through Command Prompt with Python

Hello,

I am working on an art project, and I want to get my materials to change texture directories and render when I call the python in command prompt. For example:

Blender.exe -b C:\Example.blend -P C:\NewDir.py – “C:/textures/new_directory_goes_here”

From what I have learned:

import bpy
import sys

mypath = sys.argv.index(’’)

bpy.data.images[‘example.jpg’].filepath = (mypath)
bpy.ops.render.render(animation=True, write_still=True)

I want to be able to specify a directory in the command prompt when I call the -P, so that mypath will change to the directory listed in the command from command prompt.

See the background_template.py from the text editor templates menu.


argv = sys.argv[:]
argv = argv[argv.index("--") + 1:]  # get all args after "--"

then do…
mypath = argv[0]

Hy god. you are a genius. Works perfectly.
JOY!

how do I give you stars!

Wonderful information and so fun to read! Thank you. Technology helps make this an amazing world – or does it just help make the world?