[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [53715] trunk/blender: Depsgraph hack feature - experimental
Ton Roosendaal
ton at blender.org
Thu Jan 10 19:20:29 CET 2013
Revision: 53715
http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=53715
Author: ton
Date: 2013-01-10 18:20:29 +0000 (Thu, 10 Jan 2013)
Log Message:
-----------
Depsgraph hack feature - experimental
Many depsgraph failures are because some data in the graph is being
recalculated too early (or not at all).
Since we better support animators with working renders, here's a hack to
allow manual additional updates on frame changes.
In Property Editor, Object, Panel "Relations Extra" you now have two
buttons:
- Extra Object Update
- Extra Data Update
This will do an extra update of object and/or its data ONLY on frame changes.
Update happens as last.
Tested on files collected in Wiki todo, several cases now work OK, especially
the lags on updates.
Modified Paths:
--------------
trunk/blender/release/scripts/startup/bl_ui/properties_object.py
trunk/blender/source/blender/blenkernel/intern/scene.c
trunk/blender/source/blender/makesdna/DNA_object_types.h
trunk/blender/source/blender/makesrna/intern/rna_object.c
Modified: trunk/blender/release/scripts/startup/bl_ui/properties_object.py
===================================================================
--- trunk/blender/release/scripts/startup/bl_ui/properties_object.py 2013-01-10 18:11:56 UTC (rev 53714)
+++ trunk/blender/release/scripts/startup/bl_ui/properties_object.py 2013-01-10 18:20:29 UTC (rev 53715)
@@ -289,7 +289,10 @@
row.active = ((ob.parent is not None) and (ob.use_slow_parent))
row.prop(ob, "slow_parent_offset", text="Offset")
+ layout.prop(ob, "extra_recalc_object")
+ layout.prop(ob, "extra_recalc_data")
+
from bl_ui.properties_animviz import (MotionPathButtonsPanel,
OnionSkinButtonsPanel)
Modified: trunk/blender/source/blender/blenkernel/intern/scene.c
===================================================================
--- trunk/blender/source/blender/blenkernel/intern/scene.c 2013-01-10 18:11:56 UTC (rev 53714)
+++ trunk/blender/source/blender/blenkernel/intern/scene.c 2013-01-10 18:20:29 UTC (rev 53715)
@@ -1031,6 +1031,47 @@
}
}
+/* deps hack - do extra recalcs at end */
+static void scene_depsgraph_hack(Scene *scene, Scene *scene_parent)
+{
+ Base *base;
+
+ scene->customdata_mask = scene_parent->customdata_mask;
+
+ /* sets first, we allow per definition current scene to have
+ * dependencies on sets, but not the other way around. */
+ if (scene->set)
+ scene_depsgraph_hack(scene->set, scene_parent);
+
+ for (base = scene->base.first; base; base = base->next) {
+ Object *ob = base->object;
+
+ if (ob->depsflag) {
+ int recalc = 0;
+ // printf("depshack %s\n", ob->id.name+2);
+
+ if (ob->depsflag & OB_DEPS_EXTRA_OB_RECALC)
+ recalc |= OB_RECALC_OB;
+ if (ob->depsflag & OB_DEPS_EXTRA_DATA_RECALC)
+ recalc |= OB_RECALC_DATA;
+
+ ob->recalc |= recalc;
+ BKE_object_handle_update(scene_parent, ob);
+
+ if (ob->dup_group && (ob->transflag & OB_DUPLIGROUP)) {
+ GroupObject *go;
+
+ for (go = ob->dup_group->gobject.first; go; go = go->next) {
+ if (go->ob)
+ go->ob->recalc |= recalc;
+ }
+ group_handle_recalc_and_update(scene_parent, ob, ob->dup_group);
+ }
+ }
+ }
+
+}
+
static void scene_update_tagged_recursive(Main *bmain, Scene *scene, Scene *scene_parent)
{
Base *base;
@@ -1066,6 +1107,7 @@
/* update masking curves */
BKE_mask_update_scene(bmain, scene, FALSE);
+
}
/* this is called in main loop, doing tagged updates before redraw */
@@ -1158,6 +1200,8 @@
/* BKE_object_handle_update() on all objects, groups and sets */
scene_update_tagged_recursive(bmain, sce, sce);
+ scene_depsgraph_hack(sce, sce);
+
/* notify editors and python about recalc */
BLI_callback_exec(bmain, &sce->id, BLI_CB_EVT_SCENE_UPDATE_POST);
BLI_callback_exec(bmain, &sce->id, BLI_CB_EVT_FRAME_CHANGE_POST);
Modified: trunk/blender/source/blender/makesdna/DNA_object_types.h
===================================================================
--- trunk/blender/source/blender/makesdna/DNA_object_types.h 2013-01-10 18:11:56 UTC (rev 53714)
+++ trunk/blender/source/blender/makesdna/DNA_object_types.h 2013-01-10 18:20:29 UTC (rev 53715)
@@ -178,7 +178,7 @@
short ipoflag; // xxx deprecated... old animation system
short scaflag; /* ui state for game logic */
char scavisflag; /* more display settings for game logic */
- char pad5;
+ char depsflag;
int dupon, dupoff, dupsta, dupend;
@@ -530,6 +530,10 @@
#define OB_BODY_TYPE_NAVMESH 7
#define OB_BODY_TYPE_CHARACTER 8
+/* ob->depsflag */
+#define OB_DEPS_EXTRA_OB_RECALC 1
+#define OB_DEPS_EXTRA_DATA_RECALC 2
+
/* ob->scavisflag */
#define OB_VIS_SENS 1
#define OB_VIS_CONT 2
Modified: trunk/blender/source/blender/makesrna/intern/rna_object.c
===================================================================
--- trunk/blender/source/blender/makesrna/intern/rna_object.c 2013-01-10 18:11:56 UTC (rev 53714)
+++ trunk/blender/source/blender/makesrna/intern/rna_object.c 2013-01-10 18:20:29 UTC (rev 53715)
@@ -2469,6 +2469,15 @@
RNA_def_property_ui_text(prop, "Slow Parent Offset", "Delay in the parent relationship");
RNA_def_property_update(prop, NC_OBJECT | ND_TRANSFORM, "rna_Object_internal_update");
+ /* depsgraph hack */
+ prop = RNA_def_property(srna, "extra_recalc_object", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "depsflag", OB_DEPS_EXTRA_OB_RECALC);
+ RNA_def_property_ui_text(prop, "Extra Object Update", "Refresh this object again on frame changes, dependency graph hack");
+
+ prop = RNA_def_property(srna, "extra_recalc_data", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "depsflag", OB_DEPS_EXTRA_DATA_RECALC);
+ RNA_def_property_ui_text(prop, "Extra Data Update", "Refresh this object's data again on frame changes, dependency graph hack");
+
/* duplicates */
prop = RNA_def_property(srna, "dupli_type", PROP_ENUM, PROP_NONE);
RNA_def_property_enum_bitflag_sdna(prop, NULL, "transflag");
More information about the Bf-blender-cvs
mailing list