I am making icons in Blender for Freecad and it works really well I only want to do different Icon color schemes. Which I can do easily with changing the materials in Blender.
But the only thing that I have not automated is the rendering.
I was first thinking about using scenes where I can set the render output name and do a animation of 1 frame. Then use the command line render to render all the scenes.
But it’s kinda hard managing 100+ scenes.
Other Idea was to make the icons appear on certain frames then use a command line render to output the specific frame to a specific file name.
And a third idea was to use different Blend files and then link the material and studio setup too one file, which is basically the same as using scenes, but maybe a bit easier to manage. Then again render them using a command line script.
But maybe there are better idea’s?
It now looks like this:
if you “just” want to change materials of different objects i would use a small python script to automate the renders
1 Like
Thanks for the tip I did some research into python scripts in stead of the option I was looking for and found some options:
and here:
OK I have too bump this I am trying to modify the script that Ì got working on objects to work on collections. But I fail to do this.
This is the script that render every object in the blend file:
import bpy
def hideRenderForAll():
for obj in bpy.data.objects:
if "PartDesign" in obj.name: # we know its a block as it has x in the name
obj.hide_render = True
for obj in bpy.data.objects:
if "PartDesign" in obj.name: # we know its a block as it has x in the name
hideRenderForAll()
obj.hide_render = False
bpy.data.scenes["Scene"].render.filepath = 'C:\\Users\\marij\\AppData\\Roaming\\FreeCAD\\Gui\\IconSets\\renders\\{0}.png'.format(obj.name)
bpy.ops.render.render( write_still=True )
Now I also found a script that searches for a collection and prints if it exist…
import bpy
collectionFound = False
print("START **************")
for myCol in bpy.data.collections:
print(myCol.name)
if myCol.name == "Personal Collection":
collectionFound = True
print ("Collection found in scene")
break
if collectionFound == False:
myCol = bpy.data.collections.new("Personal Collection")
bpy.context.scene.collection.children.link(myCol) #Creates a new collection
print("created")
else:
print("exists already")
But I somehow am not able to smash these together. I assume
bpy.data.collections.hide_render
Would work but I have no clue.