SimIT!
Club Supporter
Guys,
Yesterday I tested ChatGPT for making scripts to accelerate stadiums tasks on Blender. And the result is very good so far.
I tested 5 scripts for common tasks that we have to make many times when converting. Now its everything automatic. This is just easy ones, I'm sure ChatGPT can make more complex scripts now and in the future.
Try at your own risk! I made some testing and it did work.
1st Script - Add an extra UV map on all selected objects - This one will add a new UVmap (Called UVmap1) to all selected objects, than you can unrwap, bake and put the ambient textures. Remember to select the objects!
import bpy
# Set the name of the new UV map
new_uv_map_name = "UVMap1"
# Get the selected objects
selected_objects = bpy.context.selected_objects
# Iterate through the selected objects
for obj in selected_objects:
# Check if the object has a mesh data
if obj.type == "MESH":
# Check if the UV map already exists
if new_uv_map_name not in obj.data.uv_textures:
# Create a new UV map
uv_map = obj.data.uv_textures.new(name=new_uv_map_name)
2nd Script - Add a new vertex color - This one will add the vertex color to all selected objects, something that is also mandatory when making stadiums Remember to select the objects!
import bpy
# Set the name of the new vertex color layer
new_vertex_color_name = "normalmap"
# Get the selected objects
selected_objects = bpy.context.selected_objects
# Iterate through the selected objects
for obj in selected_objects:
# Check if the object has a mesh data
if obj.type == "MESH":
# Check if the vertex color layer already exists
if new_vertex_color_name not in obj.data.vertex_colors:
# Create a new vertex color layer
vertex_color_layer = obj.data.vertex_colors.new(name=new_vertex_color_name)
3rd Script - Apply shadeless option for all objects - This one will apply shadeless option for all objects.
import bpy
# Set the shadeless material option
shadeless = True
# Get the current scene
scene = bpy.context.scene
# Iterate through all objects in the scene
for obj in scene.objects:
# Check if the object has a material
if obj.type == "MESH" and obj.data.materials:
# Iterate through all materials of the object
for material in obj.data.materials:
# Set the shadeless option for each material
material.use_shadeless = shadeless
4th Script - Apply transparency option for all objects - This one will apply transparency option for all objects.
import bpy
# Set the transparency value (between 0.0 and 1.0)
transparency = 1.0
# Get the current scene
scene = bpy.context.scene
# Iterate through all objects in the scene
for obj in scene.objects:
# Check if the object has a material
if obj.type == "MESH" and obj.data.materials:
# Iterate through all materials of the object
for material in obj.data.materials:
# Enable transparency
material.use_transparency = True
# Set the transparency value
material.alpha = transparency
5th Script - Change Diffuse Intensity to 1.0- This one will change diffuse intensity to 1.0, this is something that I do to make the baking less gray.
import bpy
# Set the diffuse intensity
diffuse_intensity = 1.0
# Get the current scene
scene = bpy.context.scene
# Iterate through all objects in the scene
for obj in scene.objects:
# Check if the object has a material
if obj.type == "MESH" and obj.data.materials:
# Iterate through all materials of the object
for material in obj.data.materials:
# Set the diffuse intensity for each material
material.diffuse_intensity = diffuse_intensity
To apply this scripts you must select "text editor" on blender, click on "create text block" and paste the script. Then click on "Run Script" and check the results.
@The Wizard @saul.silva @gonzaga @Vndrew @Colgado @drlatorre @badgerbadger
Yesterday I tested ChatGPT for making scripts to accelerate stadiums tasks on Blender. And the result is very good so far.
I tested 5 scripts for common tasks that we have to make many times when converting. Now its everything automatic. This is just easy ones, I'm sure ChatGPT can make more complex scripts now and in the future.
Try at your own risk! I made some testing and it did work.
1st Script - Add an extra UV map on all selected objects - This one will add a new UVmap (Called UVmap1) to all selected objects, than you can unrwap, bake and put the ambient textures. Remember to select the objects!
import bpy
# Set the name of the new UV map
new_uv_map_name = "UVMap1"
# Get the selected objects
selected_objects = bpy.context.selected_objects
# Iterate through the selected objects
for obj in selected_objects:
# Check if the object has a mesh data
if obj.type == "MESH":
# Check if the UV map already exists
if new_uv_map_name not in obj.data.uv_textures:
# Create a new UV map
uv_map = obj.data.uv_textures.new(name=new_uv_map_name)
2nd Script - Add a new vertex color - This one will add the vertex color to all selected objects, something that is also mandatory when making stadiums Remember to select the objects!
import bpy
# Set the name of the new vertex color layer
new_vertex_color_name = "normalmap"
# Get the selected objects
selected_objects = bpy.context.selected_objects
# Iterate through the selected objects
for obj in selected_objects:
# Check if the object has a mesh data
if obj.type == "MESH":
# Check if the vertex color layer already exists
if new_vertex_color_name not in obj.data.vertex_colors:
# Create a new vertex color layer
vertex_color_layer = obj.data.vertex_colors.new(name=new_vertex_color_name)
3rd Script - Apply shadeless option for all objects - This one will apply shadeless option for all objects.
import bpy
# Set the shadeless material option
shadeless = True
# Get the current scene
scene = bpy.context.scene
# Iterate through all objects in the scene
for obj in scene.objects:
# Check if the object has a material
if obj.type == "MESH" and obj.data.materials:
# Iterate through all materials of the object
for material in obj.data.materials:
# Set the shadeless option for each material
material.use_shadeless = shadeless
4th Script - Apply transparency option for all objects - This one will apply transparency option for all objects.
import bpy
# Set the transparency value (between 0.0 and 1.0)
transparency = 1.0
# Get the current scene
scene = bpy.context.scene
# Iterate through all objects in the scene
for obj in scene.objects:
# Check if the object has a material
if obj.type == "MESH" and obj.data.materials:
# Iterate through all materials of the object
for material in obj.data.materials:
# Enable transparency
material.use_transparency = True
# Set the transparency value
material.alpha = transparency
5th Script - Change Diffuse Intensity to 1.0- This one will change diffuse intensity to 1.0, this is something that I do to make the baking less gray.
import bpy
# Set the diffuse intensity
diffuse_intensity = 1.0
# Get the current scene
scene = bpy.context.scene
# Iterate through all objects in the scene
for obj in scene.objects:
# Check if the object has a material
if obj.type == "MESH" and obj.data.materials:
# Iterate through all materials of the object
for material in obj.data.materials:
# Set the diffuse intensity for each material
material.diffuse_intensity = diffuse_intensity
To apply this scripts you must select "text editor" on blender, click on "create text block" and paste the script. Then click on "Run Script" and check the results.
@The Wizard @saul.silva @gonzaga @Vndrew @Colgado @drlatorre @badgerbadger