This is the addon I’m trying to modify
Fix: I was out of context.
Replacing:
context.scene.bbake.all_path
With:
bpy.context.scene.bbake.all_path
returned the string I was looking for!
I’m using it to bake and export textures for meshes that were imported as an fbx.
I want to be able to specify a folder for all the textures to be exported to, but am having problems getting a hold of the path once it’s specified.
I made the following changes:
added this property to the BBake_Scene_Data(PropertyGroup) class in batch_bake_object_data.py:
all_path = StringProperty(
name=‘All Path’,
subtype=‘DIR_PATH’,
default=‘’,
description=‘Save all images of all objects in this folder’,)
added this to the def draw call in batch_bake_ui.py:
row=box_global.row(align=False)
col.separator()
row.prop(scene_settings, ‘all_path’)
modified the testob(ob, context) function (gave it a new parameter so I could pass in the scene settings data object) in batch_bake_operators.py to this:
test = context.scene.bbake.all_path
if test:
path = test
else:
path = bpy.path.abspath(ob_settings.path)
if not os.path.isdir(path):
try:
os.makedirs(path)
except:
msg('FAILED to create bake Folder:%s
for object “%s”
Skipping.’ %(path, ob.name))
return False
I’m a newb with python, but I’ve experience with VBA.
Running this, having specified an “all_path” (just a random empty folder on the desktop) I get a “no such file or directory error”.
Here’s the render_bbake-master.zip (10.2 KB) of the modified version I’m having probs with
Note:99.9% of the code is not mine. It belongs to the former maintainers of this plugin and/or florien/fenix)
Thanks a ton for any help!