[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [21956] branches/blender2.5/blender: - lamp UI was missing y samples for rectangle area lamps

Campbell Barton ideasman42 at gmail.com
Tue Jul 28 03:06:57 CEST 2009


Revision: 21956
          http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=21956
Author:   campbellbarton
Date:     2009-07-28 03:06:56 +0200 (Tue, 28 Jul 2009)

Log Message:
-----------
- lamp UI was missing y samples for rectangle area lamps
- returned ID types from RNA funcs didnt get their ID's assigned which crashed in some cases (still not working for members of ID types).
- ob.create_remder_mesh() wasnt assigning any materials.

Modified Paths:
--------------
    branches/blender2.5/blender/release/ui/buttons_data_lamp.py
    branches/blender2.5/blender/source/blender/makesrna/intern/rna_object_api.c
    branches/blender2.5/blender/source/blender/python/intern/bpy_rna.c

Modified: branches/blender2.5/blender/release/ui/buttons_data_lamp.py
===================================================================
--- branches/blender2.5/blender/release/ui/buttons_data_lamp.py	2009-07-28 00:34:22 UTC (rev 21955)
+++ branches/blender2.5/blender/release/ui/buttons_data_lamp.py	2009-07-28 01:06:56 UTC (rev 21956)
@@ -85,7 +85,7 @@
 			sub.itemR(lamp, "shape", text="")
 			if (lamp.shape == 'SQUARE'):
 				sub.itemR(lamp, "size")
-			if (lamp.shape == 'RECTANGLE'):
+			elif (lamp.shape == 'RECTANGLE'):
 				sub.itemR(lamp, "size", text="Size X")
 				sub.itemR(lamp, "size_y", text="Size Y")
 			
@@ -198,15 +198,20 @@
 				if lamp.shadow_ray_sampling_method == 'ADAPTIVE_QMC':
 					col.itemR(lamp, "shadow_adaptive_threshold", text="Threshold")
 						
-			if lamp.type == 'AREA':
+			elif lamp.type == 'AREA':
 				split = layout.split()
 				
 				col = split.column(align=True)
-				col.itemR(lamp, "shadow_ray_samples_x", text="Samples")
+				if lamp.shape == 'SQUARE':
+					col.itemR(lamp, "shadow_ray_samples_x", text="Samples")
+				elif lamp.shape == 'RECTANGLE':
+					col.itemR(lamp, "shadow_ray_samples_x", text="Samples X")
+					col.itemR(lamp, "shadow_ray_samples_y", text="Samples Y")
+					
 				if lamp.shadow_ray_sampling_method == 'ADAPTIVE_QMC':
 					col.itemR(lamp, "shadow_adaptive_threshold", text="Threshold")
 				
-				if lamp.shadow_ray_sampling_method == 'CONSTANT_JITTERED':
+				elif lamp.shadow_ray_sampling_method == 'CONSTANT_JITTERED':
 					col = split.column()
 					col.itemR(lamp, "umbra")
 					col.itemR(lamp, "dither")
@@ -236,7 +241,7 @@
 				sub.itemR(lamp, "shadow_buffer_size", text="Size")
 				sub.itemR(lamp, "shadow_buffer_samples", text="Samples")
 				
-			if (lamp.shadow_buffer_type == 'IRREGULAR'):
+			elif lamp.shadow_buffer_type == 'IRREGULAR':
 				layout.itemR(lamp, "shadow_buffer_bias", text="Bias")
 			
 			row = layout.row()

Modified: branches/blender2.5/blender/source/blender/makesrna/intern/rna_object_api.c
===================================================================
--- branches/blender2.5/blender/source/blender/makesrna/intern/rna_object_api.c	2009-07-28 00:34:22 UTC (rev 21955)
+++ branches/blender2.5/blender/source/blender/makesrna/intern/rna_object_api.c	2009-07-28 01:06:56 UTC (rev 21956)
@@ -34,6 +34,8 @@
 
 #ifdef RNA_RUNTIME
 
+#include "MEM_guardedalloc.h"
+
 #include "BKE_customdata.h"
 #include "BKE_DerivedMesh.h"
 
@@ -61,6 +63,25 @@
 	DM_to_mesh(dm, me);
 	dm->release(dm);
 
+
+	{	/* update the material */
+		short i, *totcol =give_totcolp(ob);
+
+		/* free the current material list */
+		if(me->mat)
+			MEM_freeN((void *)me->mat);
+
+		me->mat= (Material **)MEM_callocN(sizeof(void *)*(*totcol), "matarray");
+
+		for(i=0; i<*totcol; i++) {
+			Material *mat= give_current_material(ob, i+1);
+			if(mat) {
+				me->mat[i]= mat;
+				mat->id.us++;
+			}
+		}
+	}
+
 	return me;
 }
 

Modified: branches/blender2.5/blender/source/blender/python/intern/bpy_rna.c
===================================================================
--- branches/blender2.5/blender/source/blender/python/intern/bpy_rna.c	2009-07-28 00:34:22 UTC (rev 21955)
+++ branches/blender2.5/blender/source/blender/python/intern/bpy_rna.c	2009-07-28 01:06:56 UTC (rev 21956)
@@ -1867,8 +1867,12 @@
 				newptr= *(PointerRNA*)data;
 			}
 			else {
-				/* XXX this is missing the ID part! */
-				RNA_pointer_create(NULL, type, *(void**)data, &newptr);
+				if(RNA_struct_is_ID(type)) {
+					RNA_id_pointer_create(*(void**)data, &newptr);
+				} else {
+					/* XXX this is missing the ID part! */
+					RNA_pointer_create(NULL, type, *(void**)data, &newptr);
+				}
 			}
 
 			if (newptr.data) {





More information about the Bf-blender-cvs mailing list