Page MenuHome

custom property update function doesn't get called when property is animated
Closed, DuplicatePublic


Hi Campbell,
please see attached file.
The update function is only called if I change the property manually. If I animate it if does not call the update function.

(also, why do we have a subtype 'UNSIGNED' if I still need to manually set min to 0?)


To Do

Event Timeline

ps.: my real script is actually using a custom property for Textures, not object. In case the depsgraph problem is "deeper":

quick notes:
(1) to test the sample file you need to run the script (forgot to toggle "register")
(1.1) also forgot to clean some junk on top of the script file, sorry

(2) this is not urgent (for me at least). I'm using a ScriptLink (the hack with a driver calling __import__(mymodule).func()) to set all props manually:
e.g. for ob in ob.bugprop = ob.bugprop

it works like a charm (for animation, render, ... ;)

NOTE: RNA update functions are called by animsys for properties now in Pepper. Whether this applies for custom properties I'm not sure.

Unless I'm misreading this report, I think we can just mark this as "fixed" in the meantime.

Hi Joshua, it's not fixed in pepper.
What's happening is:
I created a custom property via python. While doing it I created a function to be called whenever the property is updated.
If I change the property in the ui my update function get called.
If I change the property via "playback" (or render animation) - assuming I keyframed different values for the prop - the update function doesn't get called.

I seems like a depsgraph problem to me. Re-opening ....

The problem is that Blender handles these kinds of animation system updates different than what you are expecting, and there's no python hook for it...

Property update function are never called on e.g. frame change for animation, only when changing the property in the UI, editing the fcurve, etc. The update function is intended to be quick, and builtin properties usually will tag the datablock for update in the depsgraph, and then the actual update will be done delayed before the next redraw in object_handle_update. Not sure how to solve this..

The problem is generic - and has been reported many times before. I'll add this report to the long list of similar ones in wiki:

(no cheap excuse - this needs to be tackled!)

Ton Roosendaal (ton) closed this task as Archived.Nov 2 2012, 12:49 PM
Lukas Toenne (lukastoenne) changed the task status from Archived to Duplicate.Nov 16 2013, 6:56 PM

✘ Merged into T37473.