UI Cleanup: Halo materials and textures
authorJanne Karhu <jhkarh@gmail.com>
Wed, 8 Dec 2010 20:10:59 +0000 (20:10 +0000)
committerJanne Karhu <jhkarh@gmail.com>
Wed, 8 Dec 2010 20:10:59 +0000 (20:10 +0000)
* Textures applied to halo materials showed influence option for normal particles. This was really confusing, and with the cleanup I revealed a couple of hidden features too!
** Particles actually allow for textures to change halo size and hardness, but my guess is that nobody knew since the names were wrong in the ui!
** I also added the option to change the "add" value with a texture, since it was just silly not to have it.
* Halo material properties are also a bit cleaner now.

release/scripts/ui/properties_material.py
release/scripts/ui/properties_texture.py
source/blender/render/intern/source/renderdatabase.c

index 5c15bece6d653b566f36dcbb7bb0c196753046ec..6877d5da43a766e627d8b02d927d61d5d002427e 100644 (file)
@@ -269,7 +269,7 @@ class MATERIAL_PT_shading(MaterialButtonsPanel, bpy.types.Panel):
     def poll(cls, context):
         mat = active_node_mat(context.material)
         engine = context.scene.render.engine
-        return mat and (mat.type in ('SURFACE', 'WIRE', 'HALO')) and (engine in cls.COMPAT_ENGINES)
+        return mat and (mat.type in ('SURFACE', 'WIRE')) and (engine in cls.COMPAT_ENGINES)
 
     def draw(self, context):
         layout = self.layout
@@ -294,9 +294,6 @@ class MATERIAL_PT_shading(MaterialButtonsPanel, bpy.types.Panel):
             sub.prop(mat, "use_tangent_shading")
             sub.prop(mat, "use_cubic")
 
-        elif mat.type == 'HALO':
-            layout.prop(mat, "alpha")
-
 
 class MATERIAL_PT_transp(MaterialButtonsPanel, bpy.types.Panel):
     bl_label = "Transparency"
@@ -486,14 +483,30 @@ class MATERIAL_PT_halo(MaterialButtonsPanel, bpy.types.Panel):
         mat = context.material  # dont use node material
         halo = mat.halo
 
+        def number_but(layout, toggle, number, name, color):
+            row = layout.row(align=True)
+            row.prop(halo, toggle, text="")
+            sub = row.column()
+            sub.active = getattr(halo, toggle)
+            sub.prop(halo, number, text=name)
+            if not color == "":
+                sub.prop(mat, color, text="")
+
         split = layout.split()
 
         col = split.column()
+        col.prop(mat, "alpha")
         col.prop(mat, "diffuse_color", text="")
+
+        col = split.column()
         col.prop(halo, "size")
         col.prop(halo, "hardness")
         col.prop(halo, "add")
-        col.label(text="Options:")
+
+        layout.label(text="Options:")
+
+        split = layout.split()
+        col = split.column()
         col.prop(halo, "use_texture")
         col.prop(halo, "use_vertex_normal")
         col.prop(halo, "use_extreme_alpha")
@@ -501,22 +514,9 @@ class MATERIAL_PT_halo(MaterialButtonsPanel, bpy.types.Panel):
         col.prop(halo, "use_soft")
 
         col = split.column()
-        col.prop(halo, "use_ring")
-        sub = col.column()
-        sub.active = halo.use_ring
-        sub.prop(halo, "ring_count")
-        sub.prop(mat, "mirror_color", text="")
-        col.separator()
-        col.prop(halo, "use_lines")
-        sub = col.column()
-        sub.active = halo.use_lines
-        sub.prop(halo, "line_count", text="Lines")
-        sub.prop(mat, "specular_color", text="")
-        col.separator()
-        col.prop(halo, "use_star")
-        sub = col.column()
-        sub.active = halo.use_star
-        sub.prop(halo, "star_tip_count")
+        number_but(col, "use_ring", "ring_count", "Rings", "mirror_color")
+        number_but(col, "use_lines", "line_count", "Lines", "specular_color")
+        number_but(col, "use_star", "star_tip_count", "Star tips", "")
 
 
 class MATERIAL_PT_flare(MaterialButtonsPanel, bpy.types.Panel):
index f5b7d5fa32c2d0dc4c462d205c67b3921117436f..c51a9034bf76b2b9528633605abbe2656f58e7cd 100644 (file)
@@ -894,7 +894,7 @@ class TEXTURE_PT_influence(TextureSlotPanel, bpy.types.Panel):
             return sub # XXX, temp. use_map_normal needs to override.
 
         if isinstance(idblock, bpy.types.Material):
-            if idblock.type in ('SURFACE', 'HALO', 'WIRE'):
+            if idblock.type in ('SURFACE', 'WIRE'):
                 split = layout.split()
 
                 col = split.column()
@@ -928,6 +928,19 @@ class TEXTURE_PT_influence(TextureSlotPanel, bpy.types.Panel):
                 #sub = col.column()
                 #sub.active = tex.use_map_translucency or tex.map_emit or tex.map_alpha or tex.map_raymir or tex.map_hardness or tex.map_ambient or tex.map_specularity or tex.map_reflection or tex.map_mirror
                 #sub.prop(tex, "default_value", text="Amount", slider=True)
+            elif idblock.type == 'HALO':
+                layout.label(text="Halo:")
+                
+                split = layout.split()
+                
+                col = split.column()
+                factor_but(col, "use_map_color_diffuse", "diffuse_color_factor", "Color")
+                factor_but(col, "use_map_alpha", "alpha_factor", "Alpha")
+                
+                col = split.column()
+                factor_but(col, "use_map_raymir", "raymir_factor", "Size")
+                factor_but(col, "use_map_hardness", "hardness_factor", "Hardness")
+                factor_but(col, "use_map_translucency", "translucency_factor", "Add")
             elif idblock.type == 'VOLUME':
                 split = layout.split()
 
index 979d221dae06a57b1287a2c6b9b5084b576cb5f7..db8b0b2c1fda87861c73c909f093bfe7223f639e 100644 (file)
@@ -1189,6 +1189,11 @@ HaloRen *RE_inithalo_particle(Render *re, ObjectRen *obr, DerivedMesh *dm, Mater
                                har->hard = 1.0+126.0*texture_value_blend(mtex->def_var,((float)har->hard)/127.0,tin,mtex->hardfac,mtex->blendtype);
                        if(mtex->mapto & MAP_RAYMIRR)
                                har->hasize = 100.0*texture_value_blend(mtex->def_var,har->hasize/100.0,tin,mtex->raymirrfac,mtex->blendtype);
+                       if(mtex->mapto & MAP_TRANSLU) {
+                               float add = texture_value_blend(mtex->def_var,(float)har->add/255.0,tin,mtex->translfac,mtex->blendtype);
+                               CLAMP(add, 0.f, 1.f);
+                               har->add = 255.0*add;
+                       }
                        /* now what on earth is this good for?? */
                        //if(mtex->texco & 16) {
                        //      har->alfa= tin;