Blender Stack Exchange is a question and answer site for people who use Blender to create 3D graphics, animations, or games. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I'm creating a custom property for each object in my scene but don't want the user to be able to edit it. Is it possible to block the property in ui ? Here is my code :

import bpy

allObjects = list(

for element in allObjects:
    element["myProp"] = "My value"
share|improve this question
up vote 6 down vote accepted

You might create a custom property and pass only a get method:

import bpy

#default getter
def get_my_prop(self):
    return self['my_prop']

#omit the setter with a given getter to make it read-only
bpy.types.Object.my_prop = bpy.props.StringProperty(get=get_my_prop)

for obj in bpy.context.selected_objects:
    #assign the value directly
    obj['my_prop'] = "My Value"

It looks like this in the properties panel in blender 2.71: getter

share|improve this answer
That works very well but when I close and open the blend file, the custom property is editable again. I tried to use the options={'HIDDEN'} in my stringProperty but it doesn't hide my property... – Caligari Jul 16 '14 at 9:44
How can I keep the property not editable by the user from a session to another? I don't need to have it visible in the interface. – Caligari Jul 16 '14 at 9:50
You can either check the Register option in the text editor to run the script when the blend file is loaded or create an addon. #1 #2 – pink vertex Jul 16 '14 at 22:18
In order to run the script upon scene loading, you could add your function in a permanent handler, with an @persistent decorator, as seen here:… This way, when you load a scene, the script runs automatically. – Pisurquatre Jul 17 '14 at 12:59

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.