hello guys, I’m extensively rendering animations with command line (also making separate files with compositing via command line = huge speed boost!)
I have an issue while loading .py files with needed settings
I usually copy-paste from the info window the commands I need, then change “bpy.context.scene” into “bpy.data.scenes[my_scene_name_here].etc”.
The settings get recognized, but there are exceptions, and when they occur the .py file is read up to that line and the rest is ignored.
[/I][/I]these three lines return error[I]s, respectively:
AttributeError: ‘Scene’ object has no attribute ‘file_format’ AttributeError: ‘Scene’ object has no attribute ‘format’ AttributeError: ‘Scene’ object has no attribute ‘use_lossless_output’
[/I]
another example:
bpy.data.scenes[my_scene_name_here].color_mode = ‘RGB’
(obtained in the info window after clicking on the RGB button in output settings panel) returns: AttributeError: ‘Scene’ object has no attribute ‘color_mode’
but if I use bpy.data.scenes[my_scene_name_here].render.image_settings.color_mode = ‘RGB’
it works as I want.
so where that “render.image_settings” comes from? How am i Supposed to know it has to be there if the info window doesn’t tell me?
So, for most commands, the info window is my friend, but when I encounter an issue i can’t tell what command I should write, and python tooltips don’t help either.
Where can I found documentation for this? Or, what other method should i use?
rd = context.scene.render… this you already know
ffmpeg = rd.ffmpeg
this shows that ffmpeg is an option under bpy.context.scene.render.ffmpeg
if you want to test if your command works or not, use the python console and use the control-space hotkey for autocomplete / list available commands under the current tree… works a treat for exploration for the correct api function.
console window, use autocomplete function (ctrl+space) and guess what you need.
Still i wonder why in the info window some commands are incomplete??!
Wouldn’t it just be easier if instead of bpy.context.scene[I].color_mode = ‘RGB’
it was
[I]bpy.context.scene.render.image_settings.color_mode = ‘RGB’
???
what is the use of this abbreviated and not-working command?
EDIT:
thanks doublebishop, i found the solution while you answered “in the background”
[/I][/I]
hey thanks. I already am working with win batches. it’s a bless.
I don’t know much commands, but I think that the more I use it, the more i’ll look into a more complex use of it. Actually i learned last night about forwarding parameters into .py files and that might be very useful
main.py:
import bpy
bpy.ops.wm.addon_enable(module=“io_import_scene_mhx”)
bpy.ops.import_scene.makehuman_mhx(filepath="~/Desktop/first_gen.mhx")blender --background --enable-autoexec --python main.py
GIVES THE ERROR: Error when loading MHX file ~/Desktop/first_gen.mhx: Auto Run Python Scripts must be turned on. It is found under File > User Preferences > File Error: Not freed memory blocks: 4, total unfreed memory 0.000687 MB
I’ve installed blender on aws where I do not have access to the GUI to go tick the Auto Execution in File > User Preference > File . How do I do it from the command line ? --enable_autoexec does not seem to work. Are there other ways of setting UserPreferencesSystem.use_scripts_auto_execute to True ?