[SOLVED]Any way to rename same object property in multiple objects in the editor?

A have ~500 objects(text fields) with a property ‘color’ , I want to rename it to ‘color_’ because 2.78 returns a warning that ‘color’ is a system property. Is there a way to rename this property in all objects at once? I searched into “Game” drop down menu - copy/merge/clear…etc none of them are working for renaming.
Also renaming does not affect logic bricks. Say I have ‘color’ prop and I rename it to ‘color_’, this does not affect the property sensors with ‘color’ property in it, only mark it(red) as not exiting.

select all the objects, select one last, edit it how you need it

then do space bar copy logic bricks from selected and the spacebar copy game properties from selected

its easy to copy a game object property to all objects. Create the new property [“color_”] on an object. Select all other objects first, then lastly your game object with the color_ property last. Then copy game object property from the drop down. As far as renaming, removing them. I cant find a way to do it. Might have to bite the bullet and do it one by one and get it over with =(.

just edit the logic brick in 1 copy superflip

spacebar - copy logic bricks

When you do copy game property there are some options in the left hand box (the one revealed by pressing “t”)
You can copy, replace etc… same with clear game properties etc…

try this:


import bpy
sensor_name="sensorname"
for obj in bpy.data.objects:
    for prop in  obj.game.properties:
        if prop.name== "color":
            prop.name="color_"
          #  prop.value="asd"
            bpy.data.objects[obj.name].game.sensors[sensor_name].property=prop.name

i assume all the objects sensor have the same name

try this:
Code:
import bpy
sensor_name=“sensorname”
for obj in bpy.data.objects:
for prop in obj.game.properties:
if prop.name== “color”:
prop.name=“color_”
# prop.value=“asd”
bpy.data.objects[obj.name].game.sensors[sensor_name].property=prop.name
i assume all the objects sensor have the same name

Thanks! That is exactly what I needed.

Hmm…TIL =)

Edit: but bpy in game engine??

because of i was testing the script i forgot to replace this line:
bpy.data.objects[obj.name].game.sensors[sensor_name].property=prop.name
with this:
obj.game.sensors[sensor_name].property=prop.name
but it works the same

@superflip he needed to change property name and sensors property name in abot 500 objects not while the game runs but to fix an “error” cause he chose wrong name for property, so bpy was what he needed

Edit: but bpy in game engine??

I didn’t needed it in the game engine, I needed it in the editor, as mentioned above.
bpy.data.objects[obj.name].game.sensors[sensor_name].property=prop.name … is the right line.

I often use bpy for renaming or multiple edits like when dealing with sprites or components of a larger system.
But most of what bpy can do you can do with the “space” menu key if you can find the right comand.

It’s worth learning bpy as it can save hours of work sometimes in the rare cases that aren’t covered by Blender’s UI.

It’s worth learning bpy as it can save hours of work sometimes in the rare cases that aren’t covered by Blender’s UI.

Nothing like having several hundred objects to make you realise how tedious some things are to do by hand eh? BPY is fantastic when setting up a large game.