like driving integrator seed with #frame.
The scene drivers are evaluated continuously, which would be nice to fix but
complicated, now it compares the RNA value to see if it actually changed, and
avoids the update in that case, which is a useful optimization by itself.
(merged from tomato branch)
/* set value - only for animatable numerical values */
if (RNA_property_animateable(&new_ptr, prop)) {
int array_len = RNA_property_array_length(&new_ptr, prop);
/* set value - only for animatable numerical values */
if (RNA_property_animateable(&new_ptr, prop)) {
int array_len = RNA_property_array_length(&new_ptr, prop);
if (array_len && array_index >= array_len) {
if (G.debug & G_DEBUG) {
if (array_len && array_index >= array_len) {
if (G.debug & G_DEBUG) {
switch (RNA_property_type(prop)) {
case PROP_BOOLEAN:
switch (RNA_property_type(prop)) {
case PROP_BOOLEAN:
- if (array_len)
- RNA_property_boolean_set_index(&new_ptr, prop, array_index, ANIMSYS_FLOAT_AS_BOOL(value));
- else
- RNA_property_boolean_set(&new_ptr, prop, ANIMSYS_FLOAT_AS_BOOL(value));
+ if (array_len) {
+ if (RNA_property_boolean_get_index(&new_ptr, prop, array_index) != ANIMSYS_FLOAT_AS_BOOL(value)) {
+ RNA_property_boolean_set_index(&new_ptr, prop, array_index, ANIMSYS_FLOAT_AS_BOOL(value));
+ written = TRUE;
+ }
+ }
+ else {
+ if (RNA_property_boolean_get(&new_ptr, prop) != ANIMSYS_FLOAT_AS_BOOL(value)) {
+ RNA_property_boolean_set(&new_ptr, prop, ANIMSYS_FLOAT_AS_BOOL(value));
+ written = TRUE;
+ }
+ }
- if (array_len)
- RNA_property_int_set_index(&new_ptr, prop, array_index, (int)value);
- else
- RNA_property_int_set(&new_ptr, prop, (int)value);
+ if (array_len) {
+ if (RNA_property_int_get_index(&new_ptr, prop, array_index) != (int)value) {
+ RNA_property_int_set_index(&new_ptr, prop, array_index, (int)value);
+ written = TRUE;
+ }
+ }
+ else {
+ if (RNA_property_int_get(&new_ptr, prop) != (int)value) {
+ RNA_property_int_set(&new_ptr, prop, (int)value);
+ written = TRUE;
+ }
+ }
- if (array_len)
- RNA_property_float_set_index(&new_ptr, prop, array_index, value);
- else
- RNA_property_float_set(&new_ptr, prop, value);
+ if (array_len) {
+ if (RNA_property_float_get_index(&new_ptr, prop, array_index) != value) {
+ RNA_property_float_set_index(&new_ptr, prop, array_index, value);
+ written = TRUE;
+ }
+ }
+ else {
+ if (RNA_property_float_get(&new_ptr, prop) != value) {
+ RNA_property_float_set(&new_ptr, prop, value);
+ written = TRUE;
+ }
+ }
- RNA_property_enum_set(&new_ptr, prop, (int)value);
+ if (RNA_property_enum_get(&new_ptr, prop) != (int)value) {
+ RNA_property_enum_set(&new_ptr, prop, (int)value);
+ written = TRUE;
+ }
break;
default:
/* nothing can be done here... so it is unsuccessful? */
break;
default:
/* nothing can be done here... so it is unsuccessful? */
/* RNA property update disabled for now - [#28525] [#28690] [#28774] [#28777] */
#if 0
/* buffer property update for later flushing */
/* RNA property update disabled for now - [#28525] [#28690] [#28774] [#28777] */
#if 0
/* buffer property update for later flushing */
- if (RNA_property_update_check(prop)) {
+ if (written && RNA_property_update_check(prop)) {
short skip_updates_hack = 0;
/* optimization hacks: skip property updates for those properties
short skip_updates_hack = 0;
/* optimization hacks: skip property updates for those properties
/* as long as we don't do property update, we still tag datablock
* as having been updated. this flag does not cause any updates to
* be run, it's for e.g. render engines to synchronize data */
/* as long as we don't do property update, we still tag datablock
* as having been updated. this flag does not cause any updates to
* be run, it's for e.g. render engines to synchronize data */
+ if (written && new_ptr.id.data) {
ID *id = new_ptr.id.data;
id->flag |= LIB_ID_RECALC;
DAG_id_type_tag(G.main, GS(id->name));
ID *id = new_ptr.id.data;
id->flag |= LIB_ID_RECALC;
DAG_id_type_tag(G.main, GS(id->name));