VRay Batch Bake - adding new UV maps

Hello, I updated the script from ChaosGroup Forum for Batch Bake in VRay:

that it works with latest nightly builds (I’m using nightly version 17.11.2014 of Blender 2.72 from ChaosGroup Nightlies):

import bpy

sce = bpy.context.scene

# Initial settings
sce.vray.Exporter.auto_save_render = True
sce.vray.SettingsOutput.img_dir = "//bake/"
sce.vray.BakeView.use = True
sce.vray.Exporter.wait = True
sce.vray.Exporter.autoclose = True


# Selection
for ob in bpy.context.selected_objects:
    bpy.ops.object.transform_apply(location= True, rotation= True, scale= True)
    
<b># &gt;&gt;&gt;&gt; THIS IS THE PART ABOUT UV</b>
<b># bpy.ops.uv.smart_project(angle_limit= 66, island_margin= 0.05, user_area_weight= 0)</b>
<b># &gt;&gt;&gt;&gt; END</b>


# Render
    sce.vray.BakeView.bake_node = ob.name
    sce.vray.SettingsOutput.img_file = "bake_%s"%(ob.name)
    sce.vray.SettingsOutput.img_format = 'PNG'
    sce.vray.SettingsPNG.compression = 0
    sce.vray.BakeView.uv_channel = 1
    
    bpy.ops.render.render()


# Restore settings
sce.vray.BakeView.use  = False
sce.vray.Exporter.wait = False
sce.vray.Exporter.autoclose = False

I’m looking for solution for my problem (obviously I can do it manually):

  1. 2 selected objects on scene
  2. I already have UV Map for texturing each one, so I need to add new second UV map (>>>> PART)
  3. If I run as it is, script generate 2 uv maps only for last selected object
  4. I dont want to generate texture atlas but i need them baked separately
  5. More problems in the future!

Thanks to bdancer :slight_smile: