• This is a reminder of 3 IMPORTANT RULES:

    1- External self-promotion websites or apps are NOT allowed here, like Discord/Twitter/Patreon/etc.

    2- Do NOT post in other languages. English-only.

    3- Crack/Warez/Piracy talk is NOT allowed.

    Breaking any of the above rules will result in your messages being deleted and you will be banned upon repetition.

    Please, stop by this thread SoccerGaming Forum Rules And Guidelines and make sure you read and understand our policies.

    Thank you!

Scripts for Blender made by ChatGPT

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
 

SimIT!

Club Supporter
Please try others scripts, I'm sure there is more.

Its just accessing https://chat.openai.com/ and ask ChatGPT to make scripts and test.

Like for example:

"create a script on blender 2.71 to apply shadeless material option for all my objects"

"create a script on blender 2.71 to add a new UV map for selected objects"

Sometimes the script will not work but then you can ask ChatGPT to renerate response or change some words on the question to be more understandable for AI.
 

SimIT!

Club Supporter
If you find others Scripts please insert here. Its a open ocean here.

How can I make this thread stick?
 

saul.silva

Youth Team
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
This is amazing, my friend, I never thought about it nor did I imagine that ChatGPT could do something specific like that lol
 

The Wizard

Reserve Team
I tried to run a script but I get this error:


Any idea?
 

badgerbadger

Club Supporter
So this thread is the start for everyone to learn some Python.

Blender is written with Python language. Any plugin made for Blender is written with Python. Python works with indentation. Check here more.


After if obj.type == 'MESH' line you need to put one indent to next line.

Then put 2 indents to the line starts with uv_map

so basically

if line
(indent) if line
(indent) (indent) command

How to put indents? Press Tab.
 

V.K

Starting XI
This is kind of crazy lol. Imagine FIFA16 developers back in 2015 thinking that AI chat bot would be writing scripts for custom FIFA16 stadiums.

(but tbh I'm most pleased to see @gonzaga like this post, meaning he's not disappeared, and the greatly needed and anticipated remaining Qatar 2022 stadiums still have the chance to appear for F14 :D )
 

socaltexan

Club Supporter
Humberto, do you have any scripts that help create crowds for your Madden conversions? I recently developed one that has helped save an enormous amount of time making crowds for NCAA conversions.
 

SimIT!

Club Supporter
Humberto, do you have any scripts that help create crowds for your Madden conversions? I recently developed one that has helped save an enormous amount of time making crowds for NCAA conversions.
Hey mate, I dont. Can you share? I made one more script to allocate the uvmap in the diffuse texture automatically. Tried others but didint work
 

Vndrew

Youth Team
can someone share their .txt files with these scripts?
because i can't get them working, i have lots of errors
 

SimIT!

Club Supporter
Guys,

So here it is an upgrade of the Scripts that I use in blender to make things faster:

To use this you have to go on "Text Editor", click on "Text" and then on "Open Text Block". It will open the code than if you follow the instructions of each script you can click on "Run Script". Remember that I use Blender 2.71 in all of these.

The file contains this scripts:

Add_Map_1st_texture.txt

This will add a map to the first texture of all selected objects. By default it will add a map called "map0", but you can change in the code in the last three lines to whatever you want. (map0, UVmap, etc..)

Add_Transparency.txt

This will tick Transparency in the material tab for all objects selected.

Add_UV_map.txt

This will add another UVmap for all the objects selected. by default the name of the UVmap will be "map1". Change on the code if you want a different code.

Add_vertex_color.txt

This will add a vertex color in all objects selected. The Vertex Color will be named "normalmap" by default.

dds_to_png.txt

This will change all dds textures files to png textures files of all selected objects. The dds must be converted externally to a png. The files (dds and png) must have the same name and must be saved in the texture folder that was created together with your saved blender file.

Diffuse_Intensity.txt

This will change the diffuse intensity of all selected objects to 1. This helps me when baking objects to have a brighter result.

rename_Uvmap_Map0.txt

This will rename the UVmap of the selected objects to "map0". You can change the name changing the code if you want.

shadeless.txt

This will tick the option shadeless to all objects selected.

One last advice: Save your blender file first and use at your own risk! I have used tons of times and it works, I have others that I'm still testing and can be upgraded in the future.

I hope this will help you convert stadiums.


Download:


@The Wizard @gonzaga @saul.silva
 

gonzaga

Reserve Team
Guys,

So here it is an upgrade of the Scripts that I use in blender to make things faster:

To use this you have to go on "Text Editor", click on "Text" and then on "Open Text Block". It will open the code than if you follow the instructions of each script you can click on "Run Script". Remember that I use Blender 2.71 in all of these.

The file contains this scripts:

Add_Map_1st_texture.txt

This will add a map to the first texture of all selected objects. By default it will add a map called "map0", but you can change in the code in the last three lines to whatever you want. (map0, UVmap, etc..)

Add_Transparency.txt

This will tick Transparency in the material tab for all objects selected.

Add_UV_map.txt

This will add another UVmap for all the objects selected. by default the name of the UVmap will be "map1". Change on the code if you want a different code.

Add_vertex_color.txt

This will add a vertex color in all objects selected. The Vertex Color will be named "normalmap" by default.

dds_to_png.txt

This will change all dds textures files to png textures files of all selected objects. The dds must be converted externally to a png. The files (dds and png) must have the same name and must be saved in the texture folder that was created together with your saved blender file.

Diffuse_Intensity.txt

This will change the diffuse intensity of all selected objects to 1. This helps me when baking objects to have a brighter result.

rename_Uvmap_Map0.txt

This will rename the UVmap of the selected objects to "map0". You can change the name changing the code if you want.

shadeless.txt

This will tick the option shadeless to all objects selected.

One last advice: Save your blender file first and use at your own risk! I have used tons of times and it works, I have others that I'm still testing and can be upgraded in the future.

I hope this will help you convert stadiums.


Download:


@The Wizard @gonzaga @saul.silva
Awesome! Thanks, buddy!
 


Top