[Bf-blender-cvs] [d391399] depsgraph_refactor: Depsgraph Debugging: Utility operators for easier debugging

Joshua Leung noreply at git.blender.org
Thu Dec 18 02:07:31 CET 2014


Commit: d391399fa92ca3b5ef5e5aea759015293dd91191
Author: Joshua Leung
Date:   Thu Dec 18 14:07:11 2014 +1300
Branches: depsgraph_refactor
https://developer.blender.org/rBd391399fa92ca3b5ef5e5aea759015293dd91191

Depsgraph Debugging: Utility operators for easier debugging

Added operators to access the rebuild and export tools to make it easier to
quickly debug any file's depsgraph without having to pull up a console first.

===================================================================

M	release/scripts/startup/bl_operators/anim.py
M	release/scripts/startup/bl_ui/space_info.py

===================================================================

diff --git a/release/scripts/startup/bl_operators/anim.py b/release/scripts/startup/bl_operators/anim.py
index 756b75b..b3eace9 100644
--- a/release/scripts/startup/bl_operators/anim.py
+++ b/release/scripts/startup/bl_operators/anim.py
@@ -27,10 +27,10 @@ if "bpy" in locals():
 import bpy
 from bpy.types import Operator
 from bpy.props import (IntProperty,
-                       BoolProperty,
-                       EnumProperty,
-                       StringProperty,
-                       )
+                    BoolProperty,
+                    EnumProperty,
+                    StringProperty,
+                    )
 
 
 class ANIM_OT_keying_set_export(Operator):
@@ -100,10 +100,10 @@ class ANIM_OT_keying_set_export(Operator):
 
             """
             - idtype_list is used to get the list of id-datablocks from
-              bpy.data.* since this info isn't available elsewhere
+            bpy.data.* since this info isn't available elsewhere
             - id.bl_rna.name gives a name suitable for UI,
-              with a capitalised first letter, but we need
-              the plural form that's all lower case
+            with a capitalised first letter, but we need
+            the plural form that's all lower case
             """
 
             idtype_list = ksp.id.bl_rna.name.lower() + "s"
@@ -211,8 +211,8 @@ class BakeAction(Operator):
             description="Which data's transformations to bake",
             options={'ENUM_FLAG'},
             items=(('POSE', "Pose", "Bake bones transformations"),
-                   ('OBJECT', "Object", "Bake object transformations"),
-                   ),
+                ('OBJECT', "Object", "Bake object transformations"),
+                ),
             default={'POSE'},
             )
 
@@ -280,7 +280,7 @@ class ClearUselessActions(Operator):
                     removed += 1
 
         self.report({'INFO'}, "Removed %d empty and/or fake-user only Actions"
-                              % removed)
+                            % removed)
         return {'FINISHED'}
 
 
@@ -365,3 +365,50 @@ class UpdateAnimatedTransformConstraint(Operator):
             text.from_string(log)
             self.report({'INFO'}, "Complete report available on '%s' text datablock" % text.name)
         return {'FINISHED'}
+
+######################################
+
+class DEPSGRAPH_OT_rebuild(Operator):
+    """Force the dependency graph to be rebuilt to account for modified dependencies"""
+    bl_idname = "depsgraph.rebuild"
+    bl_label = "Rebuild Depsgraph"
+    bl_options = {'REGISTER'}
+
+    def execute(self, context):
+        context.scene.depsgraph.debug_rebuild()
+        return {'FINISHED'}
+
+        
+class DEPSGRAPH_OT_export_graphviz(Operator):
+    """Force the dependency graph to be rebuilt to account for modified dependencies"""
+    bl_idname = "depsgraph.export_graphviz"
+    bl_label = "Export Depsgraph to Graphviz"
+    bl_options = {'REGISTER'}
+    
+    filepath = StringProperty(
+            subtype='FILE_PATH',
+            #value=bpy.path.abspath("../graphs/"),
+            )
+    filter_folder = BoolProperty(
+            name="Filter folders",
+            default=True,
+            options={'HIDDEN'},
+            )
+    filter_glob = StringProperty(
+            name="Extension Filter",
+            default="*.dot",
+            options={'HIDDEN'},
+            )
+
+    def execute(self, context):
+        if not self.filepath:
+            raise Exception("Filepath not set")
+            
+        context.scene.depsgraph.debug_graphviz(self.filepath)
+        return {'FINISHED'}
+        
+    def invoke(self, context, event):
+        wm = context.window_manager
+        wm.fileselect_add(self)
+        return {'RUNNING_MODAL'}
+
diff --git a/release/scripts/startup/bl_ui/space_info.py b/release/scripts/startup/bl_ui/space_info.py
index d09d1f2..b67e832 100644
--- a/release/scripts/startup/bl_ui/space_info.py
+++ b/release/scripts/startup/bl_ui/space_info.py
@@ -50,6 +50,13 @@ class INFO_HT_header(Header):
 
         layout.separator()
 
+        row = layout.row(align=True)
+        row.label(text="Depsgraph:", icon='RADIO')
+        row.operator("depsgraph.rebuild", text="", icon='FILE_REFRESH')
+        row.operator("depsgraph.export_graphviz", text="Export...", icon='SCRIPTWIN').filepath = "graph.dot"
+
+        layout.separator()
+
         layout.template_running_jobs()
 
         layout.template_reports_banner()




More information about the Bf-blender-cvs mailing list