forked from bartvdbraak/blender
merge of last commit to trunk
This commit is contained in:
parent
3409eb429e
commit
aaa7c493e4
@ -269,10 +269,9 @@ class PARTICLE_PT_cache(ParticleButtonsPanel):
|
|||||||
return psys.settings.type in ('EMITTER', 'REACTOR') or (psys.settings.type == 'HAIR' and psys.hair_dynamics)
|
return psys.settings.type in ('EMITTER', 'REACTOR') or (psys.settings.type == 'HAIR' and psys.hair_dynamics)
|
||||||
|
|
||||||
def draw(self, context):
|
def draw(self, context):
|
||||||
|
|
||||||
psys = context.particle_system
|
psys = context.particle_system
|
||||||
|
|
||||||
point_cache_ui(self, context, psys.point_cache, particle_panel_enabled(context, psys), not psys.hair_dynamics, 0)
|
point_cache_ui(self, context, psys.point_cache, True, 'HAIR' if psys.hair_dynamics else 'PSYS')
|
||||||
|
|
||||||
|
|
||||||
class PARTICLE_PT_velocity(ParticleButtonsPanel):
|
class PARTICLE_PT_velocity(ParticleButtonsPanel):
|
||||||
|
@ -142,7 +142,7 @@ class PHYSICS_PT_cloth_cache(PhysicButtonsPanel):
|
|||||||
|
|
||||||
def draw(self, context):
|
def draw(self, context):
|
||||||
md = context.cloth
|
md = context.cloth
|
||||||
point_cache_ui(self, context, md.point_cache, cloth_panel_enabled(md), 0, 0)
|
point_cache_ui(self, context, md.point_cache, cloth_panel_enabled(md), 'CLOTH')
|
||||||
|
|
||||||
|
|
||||||
class PHYSICS_PT_cloth_collision(PhysicButtonsPanel):
|
class PHYSICS_PT_cloth_collision(PhysicButtonsPanel):
|
||||||
|
@ -22,7 +22,8 @@ narrowui = 180
|
|||||||
|
|
||||||
import bpy
|
import bpy
|
||||||
|
|
||||||
def point_cache_ui(self, context, cache, enabled, particles, smoke):
|
#cachetype can be 'PSYS' 'HAIR' 'SMOKE' etc
|
||||||
|
def point_cache_ui(self, context, cache, enabled, cachetype):
|
||||||
layout = self.layout
|
layout = self.layout
|
||||||
|
|
||||||
wide_ui = context.region.width > narrowui
|
wide_ui = context.region.width > narrowui
|
||||||
@ -35,7 +36,7 @@ def point_cache_ui(self, context, cache, enabled, particles, smoke):
|
|||||||
col.operator("ptcache.remove", icon='ZOOMOUT', text="")
|
col.operator("ptcache.remove", icon='ZOOMOUT', text="")
|
||||||
|
|
||||||
row = layout.row()
|
row = layout.row()
|
||||||
if particles:
|
if cachetype in {'PSYS', 'HAIR'}:
|
||||||
row.prop(cache, "external")
|
row.prop(cache, "external")
|
||||||
|
|
||||||
if cache.external:
|
if cache.external:
|
||||||
@ -53,17 +54,17 @@ def point_cache_ui(self, context, cache, enabled, particles, smoke):
|
|||||||
split = layout.split()
|
split = layout.split()
|
||||||
col = split.column(align=True)
|
col = split.column(align=True)
|
||||||
|
|
||||||
if not particles:
|
if cachetype != 'PSYS':
|
||||||
col.enabled = enabled
|
col.enabled = enabled
|
||||||
col.prop(cache, "frame_start")
|
col.prop(cache, "frame_start")
|
||||||
col.prop(cache, "frame_end")
|
col.prop(cache, "frame_end")
|
||||||
if not smoke:
|
if cachetype != 'SMOKE':
|
||||||
col.prop(cache, "step")
|
col.prop(cache, "step")
|
||||||
|
|
||||||
if wide_ui:
|
if wide_ui:
|
||||||
col = split.column()
|
col = split.column()
|
||||||
|
|
||||||
if not smoke:
|
if cachetype != 'SMOKE':
|
||||||
sub = col.column()
|
sub = col.column()
|
||||||
sub.enabled = enabled
|
sub.enabled = enabled
|
||||||
sub.prop(cache, "quick_cache")
|
sub.prop(cache, "quick_cache")
|
||||||
@ -102,7 +103,6 @@ def point_cache_ui(self, context, cache, enabled, particles, smoke):
|
|||||||
col.operator("ptcache.free_bake_all", text="Free All Bakes")
|
col.operator("ptcache.free_bake_all", text="Free All Bakes")
|
||||||
col.operator("ptcache.bake_all", text="Update All To Frame").bake = False
|
col.operator("ptcache.bake_all", text="Update All To Frame").bake = False
|
||||||
|
|
||||||
|
|
||||||
def effector_weights_ui(self, context, weights):
|
def effector_weights_ui(self, context, weights):
|
||||||
layout = self.layout
|
layout = self.layout
|
||||||
|
|
||||||
|
@ -166,7 +166,7 @@ class PHYSICS_PT_smoke_cache(PhysicButtonsPanel):
|
|||||||
md = context.smoke.domain_settings
|
md = context.smoke.domain_settings
|
||||||
cache = md.point_cache_low
|
cache = md.point_cache_low
|
||||||
|
|
||||||
point_cache_ui(self, context, cache, (cache.baked is False), 0, 1)
|
point_cache_ui(self, context, cache, (cache.baked is False), 'SMOKE')
|
||||||
|
|
||||||
|
|
||||||
class PHYSICS_PT_smoke_highres(PhysicButtonsPanel):
|
class PHYSICS_PT_smoke_highres(PhysicButtonsPanel):
|
||||||
@ -222,7 +222,7 @@ class PHYSICS_PT_smoke_cache_highres(PhysicButtonsPanel):
|
|||||||
md = context.smoke.domain_settings
|
md = context.smoke.domain_settings
|
||||||
cache = md.point_cache_high
|
cache = md.point_cache_high
|
||||||
|
|
||||||
point_cache_ui(self, context, cache, (cache.baked is False), 0, 1)
|
point_cache_ui(self, context, cache, (cache.baked is False), 'SMOKE')
|
||||||
|
|
||||||
|
|
||||||
class PHYSICS_PT_smoke_field_weights(PhysicButtonsPanel):
|
class PHYSICS_PT_smoke_field_weights(PhysicButtonsPanel):
|
||||||
|
@ -97,7 +97,7 @@ class PHYSICS_PT_softbody_cache(PhysicButtonsPanel):
|
|||||||
|
|
||||||
def draw(self, context):
|
def draw(self, context):
|
||||||
md = context.soft_body
|
md = context.soft_body
|
||||||
point_cache_ui(self, context, md.point_cache, softbody_panel_enabled(md), 0, 0)
|
point_cache_ui(self, context, md.point_cache, softbody_panel_enabled(md), 'SOFTBODY')
|
||||||
|
|
||||||
|
|
||||||
class PHYSICS_PT_softbody_goal(PhysicButtonsPanel):
|
class PHYSICS_PT_softbody_goal(PhysicButtonsPanel):
|
||||||
|
@ -1712,14 +1712,13 @@ int BKE_ptcache_write_cache(PTCacheID *pid, int cfra)
|
|||||||
int totpoint = pid->totpoint(pid->calldata, cfra);
|
int totpoint = pid->totpoint(pid->calldata, cfra);
|
||||||
int add = 0, overwrite = 0;
|
int add = 0, overwrite = 0;
|
||||||
|
|
||||||
if(totpoint == 0 || cfra < 0
|
if(totpoint == 0 || (cfra ? pid->data_types == 0 : pid->info_types == 0))
|
||||||
|| (cfra ? pid->data_types == 0 : pid->info_types == 0))
|
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
if(cache->flag & PTCACHE_DISK_CACHE) {
|
if(cache->flag & PTCACHE_DISK_CACHE) {
|
||||||
int ofra=0, efra = cache->endframe;
|
int ofra=0, efra = cache->endframe;
|
||||||
|
|
||||||
if(cfra==0)
|
if(cfra==0 && cache->startframe > 0)
|
||||||
add = 1;
|
add = 1;
|
||||||
/* allways start from scratch on the first frame */
|
/* allways start from scratch on the first frame */
|
||||||
else if(cfra == cache->startframe) {
|
else if(cfra == cache->startframe) {
|
||||||
@ -1931,7 +1930,7 @@ void BKE_ptcache_id_clear(PTCacheID *pid, int mode, int cfra)
|
|||||||
if (strstr(de->d_name, ext)) { /* do we have the right extension?*/
|
if (strstr(de->d_name, ext)) { /* do we have the right extension?*/
|
||||||
if (strncmp(filename, de->d_name, len ) == 0) { /* do we have the right prefix */
|
if (strncmp(filename, de->d_name, len ) == 0) { /* do we have the right prefix */
|
||||||
if (mode == PTCACHE_CLEAR_ALL) {
|
if (mode == PTCACHE_CLEAR_ALL) {
|
||||||
pid->cache->last_exact = 0;
|
pid->cache->last_exact = MIN2(pid->cache->startframe, 0);
|
||||||
BLI_join_dirfile(path_full, path, de->d_name);
|
BLI_join_dirfile(path_full, path, de->d_name);
|
||||||
BLI_delete(path_full, 0, 0);
|
BLI_delete(path_full, 0, 0);
|
||||||
} else {
|
} else {
|
||||||
@ -1963,7 +1962,8 @@ void BKE_ptcache_id_clear(PTCacheID *pid, int mode, int cfra)
|
|||||||
pm= pid->cache->mem_cache.first;
|
pm= pid->cache->mem_cache.first;
|
||||||
|
|
||||||
if(mode == PTCACHE_CLEAR_ALL) {
|
if(mode == PTCACHE_CLEAR_ALL) {
|
||||||
pid->cache->last_exact = 0;
|
/*we want startframe if the cache starts before zero*/
|
||||||
|
pid->cache->last_exact = MIN2(pid->cache->startframe, 0);
|
||||||
for(; pm; pm=pm->next)
|
for(; pm; pm=pm->next)
|
||||||
ptcache_free_data(pm);
|
ptcache_free_data(pm);
|
||||||
BLI_freelistN(&pid->cache->mem_cache);
|
BLI_freelistN(&pid->cache->mem_cache);
|
||||||
@ -2880,6 +2880,6 @@ void BKE_ptcache_invalidate(PointCache *cache)
|
|||||||
{
|
{
|
||||||
cache->flag &= ~PTCACHE_SIMULATION_VALID;
|
cache->flag &= ~PTCACHE_SIMULATION_VALID;
|
||||||
cache->simframe = 0;
|
cache->simframe = 0;
|
||||||
cache->last_exact = 0;
|
cache->last_exact = MIN2(cache->startframe, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user