[Bf-blender-cvs] [ba90765] alembic_pointcache: Merge branch 'master' into pointcache

Lukas Tönne noreply at git.blender.org
Thu Oct 16 16:54:15 CEST 2014


Commit: ba90765050d81a2725714b2b31383e92ab9b36d0
Author: Lukas Tönne
Date:   Tue Oct 14 17:44:36 2014 +0200
Branches: alembic_pointcache
https://developer.blender.org/rBba90765050d81a2725714b2b31383e92ab9b36d0

Merge branch 'master' into pointcache

Conflicts:
	release/scripts/startup/bl_ui/properties_physics_common.py
	source/blender/blenkernel/BKE_blender.h
	source/blender/blenkernel/BKE_object.h
	source/blender/blenkernel/BKE_pointcache.h
	source/blender/blenkernel/intern/object.c
	source/blender/blenkernel/intern/particle.c
	source/blender/blenkernel/intern/particle_system.c
	source/blender/blenkernel/intern/pointcache.c
	source/blender/blenkernel/intern/rigidbody.c
	source/blender/blenkernel/intern/smoke.c
	source/blender/blenloader/intern/readfile.c
	source/blender/blenloader/intern/versioning_legacy.c
	source/blender/editors/physics/particle_edit.c
	source/blender/editors/physics/physics_pointcache.c
	source/blender/makesrna/intern/CMakeLists.txt
	source/blender/makesrna/intern/rna_fluidsim.c
	source/blender/modifiers/intern/MOD_cloth.c
	source/blender/modifiers/intern/MOD_collision.c
	source/blender/modifiers/intern/MOD_particleinstance.c
	source/blender/render/intern/source/pipeline.c
	source/blender/windowmanager/WM_api.h
	source/creator/CMakeLists.txt

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



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

diff --cc CMakeLists.txt
index daca84c,63dae89..ccb9202
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@@ -888,44 -981,8 +991,17 @@@ if(UNIX AND NOT APPLE
  		endif()
  	endif()
  
 +	if(WITH_ALEMBIC)
 +		find_package_wrapper(Alembic)
 +		set(ALEMBIC_LIBRARIES ${ALEMBIC_LIBRARIES} ${BOOST_LIBRARIES})
 +	endif()
 +
 +	if(WITH_HDF5)
 +		find_package_wrapper(HDF5)
 +	endif()
 +
  	# OpenSuse needs lutil, ArchLinux not, for now keep, can avoid by using --as-needed
- 	set(PLATFORM_LINKLIBS "-lutil -lc -lm -lpthread")
- 
- 	if((NOT WITH_HEADLESS) AND (NOT WITH_GHOST_SDL))
- 		find_package(X11 REQUIRED)
- 		find_path(X11_XF86keysym_INCLUDE_PATH X11/XF86keysym.h ${X11_INC_SEARCH_PATH})
- 		mark_as_advanced(X11_XF86keysym_INCLUDE_PATH)
- 
- 		set(PLATFORM_LINKLIBS "${PLATFORM_LINKLIBS} ${X11_X11_LIB}")
- 
- 		if(WITH_X11_XINPUT)
- 			if(X11_Xinput_LIB)
- 				set(PLATFORM_LINKLIBS "${PLATFORM_LINKLIBS} ${X11_Xinput_LIB}")
- 			else()
- 				set(WITH_X11_XINPUT OFF)
- 			endif()
- 		endif()
- 
- 		if(WITH_X11_XF86VMODE)
- 			# XXX, why dont cmake make this available?
- 			FIND_LIBRARY(X11_Xxf86vmode_LIB Xxf86vm   ${X11_LIB_SEARCH_PATH})
- 			mark_as_advanced(X11_Xxf86vmode_LIB)
- 			if(X11_Xxf86vmode_LIB)
- 				set(PLATFORM_LINKLIBS "${PLATFORM_LINKLIBS} ${X11_Xxf86vmode_LIB}")
- 			else()
- 				set(WITH_X11_XF86VMODE OFF)
- 			endif()
- 		endif()
- 	endif()
+ 	list(APPEND PLATFORM_LINKLIBS -lutil -lc -lm -lpthread)
  
  	if(CMAKE_SYSTEM_NAME MATCHES "Linux")
  		if(NOT WITH_PYTHON_MODULE)
diff --cc release/scripts/startup/bl_ui/properties_physics_common.py
index b8bffa8,4df8eab..77ec397
--- a/release/scripts/startup/bl_ui/properties_physics_common.py
+++ b/release/scripts/startup/bl_ui/properties_physics_common.py
@@@ -129,30 -122,26 +129,25 @@@ def point_cache_ui(self, context, cache
      if cache.use_external:
          split = layout.split(percentage=0.35)
          col = split.column()
-         col.label(text="File Name:")
-         if cache.use_external:
-             col.label(text="File Path:")
+         col.label(text="Index Number:")
+         col.label(text="File Path:")
  
          col = split.column()
-         sub = col.split(percentage=0.70, align=True)
-         sub.prop(cache, "name", text="")
-         sub.prop(cache, "index", text="")
+         col.prop(cache, "index", text="")
          col.prop(cache, "filepath", text="")
  
 -        cache_info = cache.info
 +        cache_info = cache.state.info
          if cache_info:
              layout.label(text=cache_info)
      else:
 -        if cachetype in {'SMOKE', 'DYNAMIC_PAINT'}:
 -            if not bpy.data.is_saved:
 -                layout.label(text="Cache is disabled until the file is saved")
 -                layout.enabled = False
 +        if needs_saved_file and not bpy.data.is_saved:
 +            layout.label(text="Cache is disabled until the file is saved")
 +            layout.enabled = False
  
-         layout.prop(cache, "name", text="File Name")
- 
 -    if not cache.use_external or cachetype == 'SMOKE':
 +    if show_settings:
          row = layout.row(align=True)
  
 -        if cachetype not in {'PSYS', 'DYNAMIC_PAINT'}:
 +        if supports_frame_range:
              row.enabled = enabled
              row.prop(cache, "frame_start")
              row.prop(cache, "frame_end")
diff --cc source/blender/blenkernel/BKE_pointcache.h
index 90fa504,9957908..280d85c
--- a/source/blender/blenkernel/BKE_pointcache.h
+++ b/source/blender/blenkernel/BKE_pointcache.h
@@@ -283,10 -300,11 +283,10 @@@ int     BKE_ptcache_read(PTCacheID *pid
  int     BKE_ptcache_write(PTCacheID *pid, unsigned int cfra);
  
  /******************* Allocate & free ***************/
 -struct PointCache *BKE_ptcache_add(struct ListBase *ptcaches);
 +struct PointCache *BKE_ptcache_new(void);
  void BKE_ptcache_free_mem(struct ListBase *mem_cache);
  void BKE_ptcache_free(struct PointCache *cache);
- struct PointCache *BKE_ptcache_copy(struct PointCache *cache, int copy_data);
 -void BKE_ptcache_free_list(struct ListBase *ptcaches);
 -struct PointCache *BKE_ptcache_copy_list(struct ListBase *ptcaches_new, struct ListBase *ptcaches_old, bool copy_data);
++struct PointCache *BKE_ptcache_copy(struct PointCache *cache, bool copy_data);
  
  /********************** Baking *********************/
  
diff --cc source/blender/blenkernel/CMakeLists.txt
index c4a3540,f4a3a0c..1b0ba09
--- a/source/blender/blenkernel/CMakeLists.txt
+++ b/source/blender/blenkernel/CMakeLists.txt
@@@ -36,9 -36,9 +36,10 @@@ set(IN
  	../bmesh
  	../modifiers
  	../nodes
 +	../pointcache
  	../render/extern/include
  	../../../intern/guardedalloc
+ 	../../../intern/glew-mx
  	../../../intern/iksolver/extern
  	../../../intern/memutil
  	../../../intern/mikktspace
diff --cc source/blender/blenkernel/intern/dynamicpaint.c
index 176a926,4719013..c4f91f0
--- a/source/blender/blenkernel/intern/dynamicpaint.c
+++ b/source/blender/blenkernel/intern/dynamicpaint.c
@@@ -47,10 -47,7 +47,9 @@@
  #include "DNA_meshdata_types.h"
  #include "DNA_modifier_types.h"
  #include "DNA_object_types.h"
 +#include "DNA_object_force.h"
 +#include "DNA_pointcache_types.h"
  #include "DNA_scene_types.h"
- #include "DNA_space_types.h"
  #include "DNA_texture_types.h"
  
  #include "BKE_animsys.h"
diff --cc source/blender/blenkernel/intern/object.c
index 415d712,7a8843f..8db1474
--- a/source/blender/blenkernel/intern/object.c
+++ b/source/blender/blenkernel/intern/object.c
@@@ -1011,7 -1044,140 +1045,140 @@@ Object *BKE_object_add(Main *bmain, Sce
  	return ob;
  }
  
- SoftBody *copy_softbody(SoftBody *sb, int copy_cache)
+ 
+ #ifdef WITH_GAMEENGINE
+ 
+ void BKE_object_lod_add(Object *ob)
+ {
+ 	LodLevel *lod = MEM_callocN(sizeof(LodLevel), "LoD Level");
+ 	LodLevel *last = ob->lodlevels.last;
+ 
+ 	/* If the lod list is empty, initialize it with the base lod level */
+ 	if (!last) {
+ 		LodLevel *base = MEM_callocN(sizeof(LodLevel), "Base LoD Level");
+ 		BLI_addtail(&ob->lodlevels, base);
+ 		base->flags = OB_LOD_USE_MESH | OB_LOD_USE_MAT;
+ 		base->source = ob;
+ 		last = ob->currentlod = base;
+ 	}
+ 	
+ 	lod->distance = last->distance + 25.0f;
+ 	lod->flags = OB_LOD_USE_MESH | OB_LOD_USE_MAT;
+ 
+ 	BLI_addtail(&ob->lodlevels, lod);
+ }
+ 
+ static int lod_cmp(const void *a, const void *b)
+ {
+ 	const LodLevel *loda = a;
+ 	const LodLevel *lodb = b;
+ 
+ 	if (loda->distance < lodb->distance) return -1;
+ 	return loda->distance > lodb->distance;
+ }
+ 
+ void BKE_object_lod_sort(Object *ob)
+ {
+ 	BLI_sortlist(&ob->lodlevels, lod_cmp);
+ }
+ 
+ bool BKE_object_lod_remove(Object *ob, int level)
+ {
+ 	LodLevel *rem;
+ 
+ 	if (level < 1 || level > BLI_countlist(&ob->lodlevels) - 1)
+ 		return false;
+ 
+ 	rem = BLI_findlink(&ob->lodlevels, level);
+ 
+ 	if (rem == ob->currentlod) {
+ 		ob->currentlod = rem->prev;
+ 	}
+ 
+ 	BLI_remlink(&ob->lodlevels, rem);
+ 	MEM_freeN(rem);
+ 
+ 	/* If there are no user defined lods, remove the base lod as well */
+ 	if (BLI_countlist(&ob->lodlevels) == 1) {
+ 		LodLevel *base = ob->lodlevels.first;
+ 		BLI_remlink(&ob->lodlevels, base);
+ 		MEM_freeN(base);
+ 		ob->currentlod = NULL;
+ 	}
+ 
+ 	return true;
+ }
+ 
+ static LodLevel *lod_level_select(Object *ob, const float camera_position[3])
+ {
+ 	LodLevel *current = ob->currentlod;
+ 	float dist_sq, dist_sq_curr;
+ 
+ 	if (!current) return NULL;
+ 
+ 	dist_sq = len_squared_v3v3(ob->obmat[3], camera_position);
+ 	dist_sq_curr = current->distance * current->distance;
+ 
+ 	if (dist_sq < dist_sq_curr) {
+ 		/* check for higher LoD */
+ 		while (current->prev && dist_sq < dist_sq_curr) {
+ 			current = current->prev;
+ 		}
+ 	}
+ 	else {
+ 		/* check for lower LoD */
+ 		while (current->next && dist_sq > SQUARE(current->next->distance)) {
+ 			current = current->next;
+ 		}
+ 	}
+ 
+ 	return current;
+ }
+ 
+ bool BKE_object_lod_is_usable(Object *ob, Scene *scene)
+ {
+ 	bool active = (scene) ? ob == OBACT : 0;
+ 	return (ob->mode == OB_MODE_OBJECT || !active);
+ }
+ 
+ void BKE_object_lod_update(Object *ob, const float camera_position[3])
+ {
+ 	LodLevel *cur_level = ob->currentlod;
+ 	LodLevel *new_level = lod_level_select(ob, camera_position);
+ 
+ 	if (new_level != cur_level) {
+ 		ob->currentlod = new_level;
+ 	}
+ }
+ 
+ static Object *lod_ob_get(Object *ob, Scene *scene, int flag)
+ {
+ 	LodLevel *current = ob->currentlod;
+ 
+ 	if (!current || !BKE_object_lod_is_usable(ob, scene))
+ 		return ob;
+ 
+ 	while (current->prev && (!(current->flags & flag) || !current->source || current->source->type != OB_MESH)) {
+ 		current = current->prev;
+ 	}
+ 
+ 	return current->source;
+ }
+ 
+ struct Object *BKE_object_lod_meshob_get(Object *ob, Scene *scene)
+ {
+ 	return lod_ob_get(ob, scene, OB_LOD_USE_MESH);
+ }
+ 
+ struct Object *BKE_object_lod_matob_get(Object *ob, Scene *scene)
+ {
+ 	return lod_ob_get(ob, scene, OB_LOD_USE_MAT);
+ }
+ 
+ #endif  /* WITH_GAMEENGINE */
+ 
+ 
 -SoftBody *copy_softbody(SoftBody *sb, bool copy_caches)
++SoftBody *copy_softbody(SoftBody *sb, bool copy_cache)
  {
  	SoftBody *sbn;
  	
@@@ -1019,7 -1185,7 +1186,7 @@@
  	
  	sbn = MEM_dupallocN(sb);
  
- 	if (copy_cache == FALSE) {
 -	if (copy_caches == false) {
++	if (copy_cache == false) {
  		sbn->totspring = sbn->totpoint = 0;
  		sbn->bpoint = NULL;
  		sbn->bspring = NULL;
@@@ -1113,15 -1279,16 +1280,16 @@@ static ParticleSystem *copy_particlesys
  	psysn->pathcache = NULL;
  	psysn->childcache = NULL;
  	psysn->edit = NULL;
- 	psysn->frand = NULL;
  	psysn->pdd = NULL;
  	psysn->effectors = NULL;
+ 	psysn->tree = NULL;
+ 	psysn->bvhtree = NULL;
  	
- 	psysn->pathcachebufs.first = psysn->pathcachebufs.last = NULL;
- 	psysn->childcachebufs.first = psysn->childcachebufs.last = NULL;
+ 	BLI_listbase_clear(&psysn->pathcachebufs);
+ 	BLI_listbase_clear(&psysn->childcachebufs);
  	psysn->renderdata = NULL;
  	
- 	psysn->pointcache = BKE_ptcache_copy(psys->pointcache, FALSE);
 -	psysn->pointcache = BKE_ptcache_copy_list(&psysn->ptcaches, &psys->ptcaches, false);
++	psysn->pointcache = BKE_ptcache_copy(psys->pointcache, false);
  
  	/* XXX - from reading existing code this seems correct but intended usage of
  	 * pointcache should /w cloth should be added in 'ParticleSystem' - campbell */
diff --c

@@ Diff output truncated at 10240 characters. @@




More information about the Bf-blender-cvs mailing list