[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [57750] branches/soc-2013-bge/source/ blender: Basic mesh level of detail is now working in the viewport.

Daniel Stokes kupomail at gmail.com
Wed Jun 26 03:07:35 CEST 2013


Revision: 57750
          http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=57750
Author:   kupoman
Date:     2013-06-26 01:07:31 +0000 (Wed, 26 Jun 2013)
Log Message:
-----------
Basic mesh level of detail is now working in the viewport. It should only display levels of detail if you are in object mode, or the object is not the currently active object.

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/editors/space_view3d/drawobject.c

Modified: branches/soc-2013-bge/source/blender/blenkernel/BKE_object.h
===================================================================
--- branches/soc-2013-bge/source/blender/blenkernel/BKE_object.h	2013-06-25 22:58:45 UTC (rev 57749)
+++ branches/soc-2013-bge/source/blender/blenkernel/BKE_object.h	2013-06-26 01:07:31 UTC (rev 57750)
@@ -87,6 +87,7 @@
 void BKE_object_lod_add(struct Object *ob);
 void BKE_object_lod_remove(struct Object *ob, int level);
 void BKE_object_lod_update(struct Object *ob, float camera_position[3]);
+struct Object *BKE_object_lod_meshob_get(struct Object *ob);
 
 struct Object *BKE_object_copy_ex(struct Main *bmain, struct Object *ob, int copy_caches);
 struct Object *BKE_object_copy(struct Object *ob);

Modified: branches/soc-2013-bge/source/blender/blenkernel/intern/object.c
===================================================================
--- branches/soc-2013-bge/source/blender/blenkernel/intern/object.c	2013-06-25 22:58:45 UTC (rev 57749)
+++ branches/soc-2013-bge/source/blender/blenkernel/intern/object.c	2013-06-26 01:07:31 UTC (rev 57750)
@@ -998,6 +998,18 @@
 	}
 }
 
+struct Object *BKE_object_lod_meshob_get(struct Object *ob)
+{
+	LodLevel *current = ob->currentlod;
+	Object *mesh_ob = current->source;
+
+	while( current->prev && (!current->use_mesh || current->source->type == OB_MESH)) {
+		current = current->prev;
+	}
+
+	return mesh_ob;
+}
+
 SoftBody *copy_softbody(SoftBody *sb, int copy_caches)
 {
 	SoftBody *sbn;

Modified: branches/soc-2013-bge/source/blender/editors/space_view3d/drawobject.c
===================================================================
--- branches/soc-2013-bge/source/blender/editors/space_view3d/drawobject.c	2013-06-25 22:58:45 UTC (rev 57749)
+++ branches/soc-2013-bge/source/blender/editors/space_view3d/drawobject.c	2013-06-26 01:07:31 UTC (rev 57750)
@@ -3231,7 +3231,15 @@
 	DerivedMesh *dm = mesh_get_derived_final(scene, ob, scene->customdata_mask);
 	const bool is_obact = (ob == OBACT);
 	int draw_flags = (is_obact && paint_facesel_test(ob)) ? DRAW_FACE_SELECT : 0;
+	bool draw_lod = (ob->mode == OB_MODE_OBJECT || !is_obact);
 
+	if (draw_lod) {
+		ob = BKE_object_lod_meshob_get(ob);
+		me = ob->data;
+		dm->release(dm);
+		dm = mesh_get_derived_final(scene, ob, scene->customdata_mask);
+	}
+
 	if (!dm)
 		return;
 




More information about the Bf-blender-cvs mailing list