What's the purpose of Blenders Python 'properties' ?

So I’m just getting started with Python and Blender scripting, and looking at example scripts I’m seeing a lot of people using ‘properties’, ie. IntProperty, FloatProperty, StringProperty, PropertyGroup, etc.

What benefit do they have over just normal int/float/string variables? I just don’t get it…

(please don’t say “look in the documentation”, already looked at it and still don’t get their purpose)

Good example of a post that could use an informative title! :slight_smile:

in short these are defined inside BL for objects ect…
so has to do with internal API
and nothing to do with external variables

happy bl

Property definitions reflect the Blender data structures, which are independent from Python. Most importantly, you need properties if you want to get something displayed in the UI. UI elements like sliders etc. are displayed by calling something like:

layout.prop(object,“property_name”)

That’s it - your property now shows up as some widget in the UI, depending on what it is. For this reason, property definitions also let you define a description, value ranges, etc. You don’t deal with instantiating UI widgets and adding event listeners or anything like that. You can generate UI procedurally just from looking at property definitions on types.

Also, data stored in properties is saved in the blend file without any effort on your part. If you want to integrate with animation drivers, you also need to define properties.

in blender game engine, I use properties to store data, from dictionaries, to kd tree, to images, and they are immensely useful…

own[‘Target’] can be a reference to a game object to operate on, etc.

if 'Hand' not in own:
    for child in own.children:
        if 'handTag' in child:
            own['Hand']= child