[Bf-blender-cvs] [7724b26] master: Cleanup: use const for object copy funcs

Campbell Barton noreply at git.blender.org
Tue Jun 2 12:24:24 CEST 2015


Commit: 7724b26ab247d7a31dcaa2eb4f3a86cc61ff6efe
Author: Campbell Barton
Date:   Tue Jun 2 20:21:45 2015 +1000
Branches: master
https://developer.blender.org/rB7724b26ab247d7a31dcaa2eb4f3a86cc61ff6efe

Cleanup: use const for object copy funcs

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

M	source/blender/blenkernel/BKE_object.h
M	source/blender/blenkernel/BKE_pointcache.h
M	source/blender/blenkernel/intern/object.c
M	source/blender/blenkernel/intern/pointcache.c

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

diff --git a/source/blender/blenkernel/BKE_object.h b/source/blender/blenkernel/BKE_object.h
index 7502db2..0465a35 100644
--- a/source/blender/blenkernel/BKE_object.h
+++ b/source/blender/blenkernel/BKE_object.h
@@ -53,11 +53,11 @@ void BKE_object_workob_clear(struct Object *workob);
 void BKE_object_workob_calc_parent(struct Scene *scene, struct Object *ob, struct Object *workob);
 
 void BKE_object_transform_copy(struct Object *ob_tar, const struct Object *ob_src);
-struct SoftBody *copy_softbody(struct SoftBody *sb, bool copy_caches);
+struct SoftBody *copy_softbody(const struct SoftBody *sb, bool copy_caches);
 struct BulletSoftBody *copy_bulletsoftbody(struct BulletSoftBody *sb);
 struct ParticleSystem *BKE_object_copy_particlesystem(struct ParticleSystem *psys);
-void BKE_object_copy_particlesystems(struct Object *obn, struct Object *ob);
-void BKE_object_copy_softbody(struct Object *obn, struct Object *ob);
+void BKE_object_copy_particlesystems(struct Object *ob_dst, const struct Object *ob_src);
+void BKE_object_copy_softbody(struct Object *ob_dst, const struct Object *ob_src);
 void BKE_object_free_particlesystems(struct Object *ob);
 void BKE_object_free_softbody(struct Object *ob);
 void BKE_object_free_bulletsoftbody(struct Object *ob);
@@ -73,7 +73,7 @@ void BKE_object_modifier_hook_reset(struct Object *ob, struct HookModifierData *
 
 bool BKE_object_support_modifier_type_check(struct Object *ob, int modifier_type);
 
-void BKE_object_link_modifiers(struct Object *ob, struct Object *from);
+void BKE_object_link_modifiers(struct Object *ob_dst, const struct Object *ob_src);
 void BKE_object_free_modifiers(struct Object *ob);
 
 void BKE_object_make_proxy(struct Object *ob, struct Object *target, struct Object *gob);
diff --git a/source/blender/blenkernel/BKE_pointcache.h b/source/blender/blenkernel/BKE_pointcache.h
index e18e9d4..a3ffad1 100644
--- a/source/blender/blenkernel/BKE_pointcache.h
+++ b/source/blender/blenkernel/BKE_pointcache.h
@@ -303,7 +303,7 @@ struct PointCache *BKE_ptcache_add(struct ListBase *ptcaches);
 void BKE_ptcache_free_mem(struct ListBase *mem_cache);
 void BKE_ptcache_free(struct PointCache *cache);
 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_list(struct ListBase *ptcaches_new, const struct ListBase *ptcaches_old, bool copy_data);
 
 /********************** Baking *********************/
 
diff --git a/source/blender/blenkernel/intern/object.c b/source/blender/blenkernel/intern/object.c
index 668969a..c1626ed 100644
--- a/source/blender/blenkernel/intern/object.c
+++ b/source/blender/blenkernel/intern/object.c
@@ -248,7 +248,7 @@ bool BKE_object_support_modifier_type_check(Object *ob, int modifier_type)
 	return true;
 }
 
-void BKE_object_link_modifiers(struct Object *ob_dst, struct Object *ob_src)
+void BKE_object_link_modifiers(struct Object *ob_dst, const struct Object *ob_src)
 {
 	ModifierData *md;
 	BKE_object_free_modifiers(ob_dst);
@@ -1207,7 +1207,7 @@ struct Object *BKE_object_lod_matob_get(Object *ob, Scene *scene)
 #endif  /* WITH_GAMEENGINE */
 
 
-SoftBody *copy_softbody(SoftBody *sb, bool copy_caches)
+SoftBody *copy_softbody(const SoftBody *sb, bool copy_caches)
 {
 	SoftBody *sbn;
 	
@@ -1331,24 +1331,24 @@ ParticleSystem *BKE_object_copy_particlesystem(ParticleSystem *psys)
 	return psysn;
 }
 
-void BKE_object_copy_particlesystems(Object *obn, Object *ob)
+void BKE_object_copy_particlesystems(Object *ob_dst, const Object *ob_src)
 {
 	ParticleSystem *psys, *npsys;
 	ModifierData *md;
 
-	if (obn->type != OB_MESH) {
+	if (ob_dst->type != OB_MESH) {
 		/* currently only mesh objects can have soft body */
 		return;
 	}
 
-	BLI_listbase_clear(&obn->particlesystem);
-	for (psys = ob->particlesystem.first; psys; psys = psys->next) {
+	BLI_listbase_clear(&ob_dst->particlesystem);
+	for (psys = ob_src->particlesystem.first; psys; psys = psys->next) {
 		npsys = BKE_object_copy_particlesystem(psys);
 
-		BLI_addtail(&obn->particlesystem, npsys);
+		BLI_addtail(&ob_dst->particlesystem, npsys);
 
 		/* need to update particle modifiers too */
-		for (md = obn->modifiers.first; md; md = md->next) {
+		for (md = ob_dst->modifiers.first; md; md = md->next) {
 			if (md->type == eModifierType_ParticleSystem) {
 				ParticleSystemModifierData *psmd = (ParticleSystemModifierData *)md;
 				if (psmd->psys == psys)
@@ -1376,10 +1376,11 @@ void BKE_object_copy_particlesystems(Object *obn, Object *ob)
 	}
 }
 
-void BKE_object_copy_softbody(Object *obn, Object *ob)
+void BKE_object_copy_softbody(Object *ob_dst, const Object *ob_src)
 {
-	if (ob->soft)
-		obn->soft = copy_softbody(ob->soft, false);
+	if (ob_src->soft) {
+		ob_dst->soft = copy_softbody(ob_src->soft, false);
+	}
 }
 
 static void copy_object_pose(Object *obn, Object *ob)
diff --git a/source/blender/blenkernel/intern/pointcache.c b/source/blender/blenkernel/intern/pointcache.c
index 9592862..2f4a458 100644
--- a/source/blender/blenkernel/intern/pointcache.c
+++ b/source/blender/blenkernel/intern/pointcache.c
@@ -3093,7 +3093,7 @@ static PointCache *ptcache_copy(PointCache *cache, bool copy_data)
 }
 
 /* returns first point cache */
-PointCache *BKE_ptcache_copy_list(ListBase *ptcaches_new, ListBase *ptcaches_old, bool copy_data)
+PointCache *BKE_ptcache_copy_list(ListBase *ptcaches_new, const ListBase *ptcaches_old, bool copy_data)
 {
 	PointCache *cache = ptcaches_old->first;




More information about the Bf-blender-cvs mailing list