- lamp UI was missing y samples for rectangle area lamps
authorCampbell Barton <ideasman42@gmail.com>
Tue, 28 Jul 2009 01:06:56 +0000 (01:06 +0000)
committerCampbell Barton <ideasman42@gmail.com>
Tue, 28 Jul 2009 01:06:56 +0000 (01:06 +0000)
- 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.

release/ui/buttons_data_lamp.py
source/blender/makesrna/intern/rna_object_api.c
source/blender/python/intern/bpy_rna.c

index a3505dd69701fc20c553eecdf0166c7611779591..9c5b3dd15733da4412383b2bd90bdbea033ce7fd 100644 (file)
@@ -85,7 +85,7 @@ class DATA_PT_lamp(DataButtonsPanel):
                        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 @@ class DATA_PT_shadow(DataButtonsPanel):
                                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 @@ class DATA_PT_shadow(DataButtonsPanel):
                                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()
index 053ab115b3b19e669a1f42221055a895e8b9c125..3541bc2b1b09ea18136c5488308bd0c2b6996140 100644 (file)
@@ -34,6 +34,8 @@
 
 #ifdef RNA_RUNTIME
 
+#include "MEM_guardedalloc.h"
+
 #include "BKE_customdata.h"
 #include "BKE_DerivedMesh.h"
 
@@ -61,6 +63,25 @@ Mesh *rna_Object_create_render_mesh(Object *ob, Scene *scene)
        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;
 }
 
index c76cb252f2c22a3959b48225812755ce00e5cee3..91e443dbc93392c1396a4ace6ad2a1d2bbac9a3d 100644 (file)
@@ -1867,8 +1867,12 @@ PyObject *pyrna_param_to_py(PointerRNA *ptr, PropertyRNA *prop, void *data)
                                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) {