Last active
January 16, 2025 14:58
-
-
Save catprisbrey/6e2ffa7af1b70c745daffa490ac461a2 to your computer and use it in GitHub Desktop.
Blender to Godot - Rename Meshs to match their Object name
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import bpy | |
## I can't remember why i wanted this, but i wanted the meshes to match their object names. | |
## In case that's useful for anybody else, here it is. | |
# Iterate through all objects in the scene | |
for obj in bpy.context.scene.objects: | |
# Check if the object is a mesh and its name ends with "-col" | |
if obj.type == 'MESH' and obj.name.endswith('-col'): | |
# Remove the "-col" suffix from the object name | |
new_name = obj.name.replace('-col', '') | |
# Check if there is a mesh data block associated with the object | |
if obj.data: | |
# Rename the mesh data block to match the new object name | |
obj.data.name = new_name |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment