Commit: 289c5de7d8c8f346832cb55754fb82e11f8377a4
Author: Brecht Van Lommel
Date:   Wed Jan 29 16:50:37 2014 +0100
https://developer.blender.org/rB289c5de7d8c8f346832cb55754fb82e11f8377a4

Fix T38359: incorrect display of material slot with pinned particle settings.

Just hide it in this case, the material slot is not really valid without an
object in the context.

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

M       release/scripts/startup/bl_ui/properties_particle.py
M       source/blender/makesrna/intern/rna_particle.c

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

diff --git a/release/scripts/startup/bl_ui/properties_particle.py 
b/release/scripts/startup/bl_ui/properties_particle.py
index 01038c3..30fc3a9 100644
--- a/release/scripts/startup/bl_ui/properties_particle.py
+++ b/release/scripts/startup/bl_ui/properties_particle.py
@@ -799,11 +799,11 @@ class PARTICLE_PT_render(ParticleButtonsPanel, Panel):
         psys = context.particle_system
         part = particle_get_settings(context)
 
-        row = layout.row()
-        if part.render_type in {'OBJECT', 'GROUP'}:
-            row.enabled = False
-        row.prop(part, "material_slot", text="")
         if psys:
+            row = layout.row()
+            if part.render_type in {'OBJECT', 'GROUP'}:
+                row.enabled = False
+            row.prop(part, "material_slot", text="")
             row.prop(psys, "parent")
 
         split = layout.split()
diff --git a/source/blender/makesrna/intern/rna_particle.c 
b/source/blender/makesrna/intern/rna_particle.c
index 4b05001..ca582ef 100644
--- a/source/blender/makesrna/intern/rna_particle.c
+++ b/source/blender/makesrna/intern/rna_particle.c
@@ -392,17 +392,17 @@ static void rna_ParticleSystem_co_hair(ParticleSystem 
*particlesystem, Object *o
 }
 
 
-static EnumPropertyItem *rna_Particule_Material_itemf(bContext *C, PointerRNA 
*UNUSED(ptr),
+static EnumPropertyItem *rna_Particle_Material_itemf(bContext *C, PointerRNA 
*UNUSED(ptr),
                                                       PropertyRNA 
*UNUSED(prop), bool *r_free)
 {
-       Object *ob = CTX_data_active_object(C);
+       Object *ob = CTX_data_pointer_get(C, "object").data;
        Material *ma;
        EnumPropertyItem *item = NULL;
        EnumPropertyItem tmp = {0, "", 0, "", ""};
        int totitem = 0;
        int i;
 
-       if (ob->totcol > 0) {
+       if (ob && ob->totcol > 0) {
                for (i = 1; i <= ob->totcol; i++) {
                        ma = give_current_material(ob, i);
                        tmp.value = i;
@@ -2413,8 +2413,8 @@ static void rna_def_particle_settings(BlenderRNA *brna)
        prop = RNA_def_property(srna, "material_slot", PROP_ENUM, PROP_NONE);
        RNA_def_property_enum_sdna(prop, NULL, "omat");
        RNA_def_property_enum_items(prop, part_mat_items);
-       RNA_def_property_enum_funcs(prop, NULL, NULL, 
"rna_Particule_Material_itemf");
-       RNA_def_property_ui_text(prop, "Material Slot", "Material slot used for 
rendering particles");
+       RNA_def_property_enum_funcs(prop, NULL, NULL, 
"rna_Particle_Material_itemf");
+       RNA_def_property_ui_text(prop, "Material Slot", "Material nlot used for 
rendering particles");
        RNA_def_property_update(prop, 0, "rna_Particle_redo");
 
        prop = RNA_def_property(srna, "integrator", PROP_ENUM, PROP_NONE);

_______________________________________________
Bf-blender-cvs mailing list
[email protected]
http://lists.blender.org/mailman/listinfo/bf-blender-cvs

Reply via email to