I have encountered a problem with Python scripting for Blender.
I have a script which recieves meshes via an external source, and adds them to the scene. A specific type of mesh is added to the second layer. If such a mesh is created, a second RenderLayer is created and Freestyle-Rendering is activated. So far, all of this works as I wish. But I want to add specific Freestyle-Brush-Color to each of this meshes, and so I want to create a Lineset with a linked LineStyle for each one.
Problem now: How can I create and manage the LineSets. I can create a LineSet for the active RenderLayer but without name, and the creation method does not return a handle to that LineSet. How do I cleanly and efficiently retrive the newly created LineSet so that I can add a LineStyle and other settings to it?
My RenderLayer-related code so far:
LineRenderLayer = None if not "PolyLineLayer" in bpy.context.scene.render.layers: bpy.context.scene.render.use_freestyle = True bpy.context.scene.layers = [True] * 2 + [False] * 18 bpy.context.scene.render.layers["RenderLayer"].layers = \ [True] + [False]*19 bpy.ops.scene.freestyle_lineset_remove() LineRenderLayer = bpy.context.scene.render.layers.new("PolyLineLayer") LineRenderLayer.use_freestyle = True LineRenderLayer.layers = [False] + [True] + [False] * 18 else: LineRenderLayer = bpy.context.scene.render.layers["PolyLineLayer"] bpy.context.scene.render.layers.active = LineRenderLayer bpy.ops.scene.freestyle_lineset_add()
The last line is the main problem. It does not take a name as parameter and does not return anything. But I need that created Lineset for further configuration.
I use Blender in version 2.70
Thank you for your help!