[Bf-blender-cvs] [91c263f] alembic_pointcache: Simple operator to force rebuilding of a dupligroup cache.
Lukas Tönne
noreply at git.blender.org
Thu Mar 12 12:24:10 CET 2015
Commit: 91c263f49227635778444a5893cd787cbc9acf5a
Author: Lukas Tönne
Date: Thu Mar 12 12:22:21 2015 +0100
Branches: alembic_pointcache
https://developer.blender.org/rB91c263f49227635778444a5893cd787cbc9acf5a
Simple operator to force rebuilding of a dupligroup cache.
This is a placeholder for proper depsgraph integration. Eventually frame
changes and some other updates should rebuild dupligroup caches
automatically using the depsgraph. Until then this operator is a quick
way to test the IO from caches and the further drawing and rendering
(TODO).
===================================================================
M release/scripts/startup/bl_ui/properties_object.py
M source/blender/editors/io/io_cache_library.c
M source/blender/editors/io/io_cache_library.h
M source/blender/editors/io/io_ops.c
===================================================================
diff --git a/release/scripts/startup/bl_ui/properties_object.py b/release/scripts/startup/bl_ui/properties_object.py
index 3ff7a24..15c25a7 100644
--- a/release/scripts/startup/bl_ui/properties_object.py
+++ b/release/scripts/startup/bl_ui/properties_object.py
@@ -294,6 +294,7 @@ class OBJECT_PT_duplication(ObjectButtonsPanel, Panel):
elif ob.dupli_type == 'GROUP':
layout.prop(ob, "dupli_group", text="Group")
+ layout.operator("cachelibrary.rebuild_dupligroup")
class OBJECT_PT_relations_extras(ObjectButtonsPanel, Panel):
diff --git a/source/blender/editors/io/io_cache_library.c b/source/blender/editors/io/io_cache_library.c
index a91931d..7d0378f 100644
--- a/source/blender/editors/io/io_cache_library.c
+++ b/source/blender/editors/io/io_cache_library.c
@@ -45,6 +45,7 @@
#include "DNA_modifier_types.h"
#include "DNA_object_types.h"
+#include "BKE_anim.h"
#include "BKE_depsgraph.h"
#include "BKE_cache_library.h"
#include "BKE_context.h"
@@ -573,3 +574,43 @@ void CACHELIBRARY_OT_archive_info(wmOperatorType *ot)
RNA_def_boolean(ot->srna, "use_popup", false, "Show Popup", "Display archive info in a popup");
RNA_def_boolean(ot->srna, "use_clipboard", false, "Copy to Clipboard", "Copy archive info to the clipboard");
}
+
+/* ========================================================================= */
+
+static int cache_library_rebuild_dupligroup_poll(bContext *C)
+{
+ Object *ob = CTX_data_active_object(C);
+
+ if (!(ob && (ob->transflag & OB_DUPLIGROUP) && ob->dup_group))
+ return false;
+
+ return true;
+}
+
+static int cache_library_rebuild_dupligroup_exec(bContext *C, wmOperator *UNUSED(op))
+{
+ Scene *scene = CTX_data_scene(C);
+ Object *ob = CTX_data_active_object(C);
+ EvaluationContext eval_ctx;
+
+ eval_ctx.mode = DAG_EVAL_VIEWPORT;
+
+ BKE_object_dupli_cache_update(scene, ob, &eval_ctx);
+
+ return OPERATOR_FINISHED;
+}
+
+void CACHELIBRARY_OT_rebuild_dupligroup(wmOperatorType *ot)
+{
+ /* identifiers */
+ ot->name = "Rebuild Dupligroup";
+ ot->description = "Explicitly rebuild dupligroup from cache";
+ ot->idname = "CACHELIBRARY_OT_rebuild_dupligroup";
+
+ /* api callbacks */
+ ot->exec = cache_library_rebuild_dupligroup_exec;
+ ot->poll = cache_library_rebuild_dupligroup_poll;
+
+ /* flags */
+ ot->flag = OPTYPE_REGISTER;
+}
diff --git a/source/blender/editors/io/io_cache_library.h b/source/blender/editors/io/io_cache_library.h
index 29c2e68..72b45ee 100644
--- a/source/blender/editors/io/io_cache_library.h
+++ b/source/blender/editors/io/io_cache_library.h
@@ -38,6 +38,7 @@ void CACHELIBRARY_OT_delete(struct wmOperatorType *ot);
void CACHELIBRARY_OT_item_enable(struct wmOperatorType *ot);
void CACHELIBRARY_OT_bake(struct wmOperatorType *ot);
+void CACHELIBRARY_OT_rebuild_dupligroup(struct wmOperatorType *ot);
void CACHELIBRARY_OT_archive_info(struct wmOperatorType *ot);
diff --git a/source/blender/editors/io/io_ops.c b/source/blender/editors/io/io_ops.c
index 4f4d3e7..de6d675 100644
--- a/source/blender/editors/io/io_ops.c
+++ b/source/blender/editors/io/io_ops.c
@@ -43,6 +43,7 @@ void ED_operatortypes_io(void)
WM_operatortype_append(CACHELIBRARY_OT_delete);
WM_operatortype_append(CACHELIBRARY_OT_item_enable);
WM_operatortype_append(CACHELIBRARY_OT_bake);
+ WM_operatortype_append(CACHELIBRARY_OT_rebuild_dupligroup);
WM_operatortype_append(CACHELIBRARY_OT_archive_info);
#ifdef WITH_COLLADA
More information about the Bf-blender-cvs
mailing list