Remove cache on new modifier.

This commit is contained in:
Lubos Lenco 2016-11-07 00:31:48 +01:00
parent 8be2efc8eb
commit 8acd7bad43
2 changed files with 15 additions and 4 deletions

View file

@ -21,6 +21,12 @@ def on_scene_update_post(context):
global last_time
global last_operator
ops = bpy.context.window_manager.operators
operators_changed = False
if len(ops) > 0 and last_operator != ops[-1]:
last_operator = ops[-1]
operators_changed = True
if time.time() - last_time >= (1 / bpy.context.scene.render.fps): # Use frame rate for update frequency for now
last_time = time.time()
@ -41,13 +47,10 @@ def on_scene_update_post(context):
barmory.draw()
# Auto patch on every operator change
ops = bpy.context.window_manager.operators
if state.chromium_running and \
bpy.data.worlds['Arm'].arm_play_live_patch and \
bpy.data.worlds['Arm'].arm_play_auto_build and \
len(ops) > 0 and \
last_operator != ops[-1]:
last_operator = ops[-1]
operators_changed:
# Othwerwise rebuild scene
if bridge.send_operator(last_operator) == False:
make.patch_project()
@ -106,6 +109,12 @@ def on_scene_update_post(context):
elif edit_obj.type == 'ARMATURE':
edit_obj.data.data_cached = False
obj = bpy.context.object
if obj != None and operators_changed:
# Modifier was added, recache mesh
if ops[-1].bl_idname == 'OBJECT_OT_modifier_add':
obj.data.mesh_cached = False
@persistent
def on_load_post(context):
props.init_properties_on_load()

View file

@ -118,6 +118,8 @@ class ModifiersPropsPanel(bpy.types.Panel):
if obj == None:
return
layout.operator("arm.invalidate_cache")
# Assume as first modifier
if len(obj.modifiers) > 0 and obj.modifiers[0].type == 'OCEAN':
layout.prop(bpy.data.worlds['Arm'], 'generate_ocean_base_color')