[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [60131] branches/soc-2013-bge/source/ blender: Moving some code out of rna_object.c to object. c for updating the level of detail distance.

Daniel Stokes kupomail at gmail.com
Sat Sep 14 03:40:10 CEST 2013


Revision: 60131
          http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=60131
Author:   kupoman
Date:     2013-09-14 01:40:07 +0000 (Sat, 14 Sep 2013)
Log Message:
-----------
Moving some code out of rna_object.c to object.c for updating the level of detail distance.

Modified Paths:
--------------
    branches/soc-2013-bge/source/blender/blenkernel/BKE_object.h
    branches/soc-2013-bge/source/blender/blenkernel/intern/object.c
    branches/soc-2013-bge/source/blender/makesrna/intern/rna_object.c

Modified: branches/soc-2013-bge/source/blender/blenkernel/BKE_object.h
===================================================================
--- branches/soc-2013-bge/source/blender/blenkernel/BKE_object.h	2013-09-14 01:29:38 UTC (rev 60130)
+++ branches/soc-2013-bge/source/blender/blenkernel/BKE_object.h	2013-09-14 01:40:07 UTC (rev 60131)
@@ -85,6 +85,7 @@
 void *BKE_object_obdata_add_from_type(struct Main *bmain, int type);
 
 void BKE_object_lod_add(struct Object *ob);
+void BKE_object_lod_sort(struct Object *ob);
 bool BKE_object_lod_remove(struct Object *ob, int level);
 bool BKE_object_lod_update(struct Object *ob, float camera_position[3]);
 bool BKE_object_lod_is_usable(struct Object *ob, struct Scene *scene);

Modified: branches/soc-2013-bge/source/blender/blenkernel/intern/object.c
===================================================================
--- branches/soc-2013-bge/source/blender/blenkernel/intern/object.c	2013-09-14 01:29:38 UTC (rev 60130)
+++ branches/soc-2013-bge/source/blender/blenkernel/intern/object.c	2013-09-14 01:40:07 UTC (rev 60131)
@@ -1008,6 +1008,20 @@
 	BLI_addtail(&ob->lodlevels, lod);
 }
 
+static int lod_cmp(void *a, void *b)
+{
+	LodLevel *loda = (LodLevel*)a;
+	LodLevel *lodb = (LodLevel*)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;

Modified: branches/soc-2013-bge/source/blender/makesrna/intern/rna_object.c
===================================================================
--- branches/soc-2013-bge/source/blender/makesrna/intern/rna_object.c	2013-09-14 01:29:38 UTC (rev 60130)
+++ branches/soc-2013-bge/source/blender/makesrna/intern/rna_object.c	2013-09-14 01:40:07 UTC (rev 60131)
@@ -1447,22 +1447,10 @@
 	return (ss && ss->bm);
 }
 
-static int lod_cmp(void *a, void *b)
-{
-	LodLevel *loda = (LodLevel*)a;
-	LodLevel *lodb = (LodLevel*)b;
-
-	if (loda->distance < lodb->distance) return -1;
-	return loda->distance > lodb->distance;
-}
-
 static void rna_Object_lod_distance_update(Main *bmain, Scene *scene, PointerRNA *ptr)
 {
 	Object *ob = (Object *)ptr->id.data;
-	LodLevel* lod = ptr->data;
-
-	if (lod->distance < 0.0) lod->distance = 0.0;
-	BLI_sortlist(&ob->lodlevels, lod_cmp);
+	BKE_object_lod_sort(ob);
 }
 #else
 
@@ -2029,6 +2017,7 @@
 
 	prop = RNA_def_property(srna, "distance", PROP_FLOAT, PROP_DISTANCE);
 	RNA_def_property_float_sdna(prop, NULL, "distance");
+	RNA_def_property_range(prop, 0.0, FLT_MAX);
 	RNA_def_property_ui_text(prop, "Distance", "Distance to begin using this level of detail");
 	RNA_def_property_update(prop, NC_OBJECT|ND_LOD, "rna_Object_lod_distance_update");
 




More information about the Bf-blender-cvs mailing list