[Bf-blender-cvs] [9b20bbc3bff] master: LibOverride: PointCache: Add UI feedback about need to enable Disk Cache.

Bastien Montagne noreply at git.blender.org
Tue Nov 17 21:35:26 CET 2020


Commit: 9b20bbc3bff62ae94f7b2e692724ab83a7c1d600
Author: Bastien Montagne
Date:   Tue Nov 17 21:33:28 2020 +0100
Branches: master
https://developer.blender.org/rB9b20bbc3bff62ae94f7b2e692724ab83a7c1d600

LibOverride: PointCache: Add UI feedback about need to enable Disk Cache.

Note that I chose to modify the label of the main `Bake` button instead
of adding an extra label line, as that would disturb the UI in a
annoying way.

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

M	release/scripts/startup/bl_ui/properties_physics_common.py
M	source/blender/editors/physics/physics_pointcache.c

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

diff --git a/release/scripts/startup/bl_ui/properties_physics_common.py b/release/scripts/startup/bl_ui/properties_physics_common.py
index b8c0035ee6b..1ffaa47168f 100644
--- a/release/scripts/startup/bl_ui/properties_physics_common.py
+++ b/release/scripts/startup/bl_ui/properties_physics_common.py
@@ -126,6 +126,7 @@ def point_cache_ui(self, cache, enabled, cachetype):
     layout.context_pointer_set("point_cache", cache)
 
     is_saved = bpy.data.is_saved
+    is_liboverride = cache.id_data.override_library is not None
 
     # NOTE: TODO temporarily used until the animate properties are properly skipped.
     layout.use_property_decorate = False  # No animation (remove this later on).
@@ -221,7 +222,9 @@ def point_cache_ui(self, cache, enabled, cachetype):
         col = flow.column()
         col.active = can_bake
 
-        if cache.is_baked is True:
+        if is_liboverride and not cache.use_disk_cache:
+            col.operator("ptcache.bake", icon='ERROR', text="Bake (Disk Cache mandatory)")
+        elif cache.is_baked is True:
             col.operator("ptcache.free_bake", text="Delete Bake")
         else:
             col.operator("ptcache.bake", text="Bake").bake = True
diff --git a/source/blender/editors/physics/physics_pointcache.c b/source/blender/editors/physics/physics_pointcache.c
index e827a3fbb2d..f0cf1f2fbf9 100644
--- a/source/blender/editors/physics/physics_pointcache.c
+++ b/source/blender/editors/physics/physics_pointcache.c
@@ -66,10 +66,13 @@ static bool ptcache_poll(bContext *C)
   }
 
   if (ID_IS_OVERRIDE_LIBRARY_REAL(id) && (point_cache->flag & PTCACHE_DISK_CACHE) == false) {
+    CTX_wm_operator_poll_msg_set(C,
+                                 "Library override data-blocks only support Disk Cache storage");
     return false;
   }
 
   if (ID_IS_LINKED(id) && (point_cache->flag & PTCACHE_DISK_CACHE) == false) {
+    CTX_wm_operator_poll_msg_set(C, "Linked data-blocks do not allow to edit caches");
     return false;
   }
 
@@ -88,6 +91,8 @@ static bool ptcache_add_remove_poll(bContext *C)
   }
 
   if (ID_IS_OVERRIDE_LIBRARY_REAL(id) || ID_IS_LINKED(id)) {
+    CTX_wm_operator_poll_msg_set(
+        C, "Linked or library override data-blocks do not allow to add or remove caches");
     return false;
   }



More information about the Bf-blender-cvs mailing list