[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [21605] branches/blender2.5/blender: 2.5

Brecht Van Lommel brecht at blender.org
Wed Jul 15 21:20:59 CEST 2009


Revision: 21605
          http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=21605
Author:   blendix
Date:     2009-07-15 21:20:59 +0200 (Wed, 15 Jul 2009)

Log Message:
-----------
2.5

* Some changes to make lamp and world textures editing work.
  You may have to click on another texture slot once before
  being able to add a texture, and the layout is messy. Added
  this so lightenv project isn't blocked by this being missing.
* Adding a new material slot now doesn't create a new material
  anymore, to avoid creating unused materials.
* Tiny changes to scene/object buttons.

Modified Paths:
--------------
    branches/blender2.5/blender/release/ui/buttons_objects.py
    branches/blender2.5/blender/release/ui/buttons_scene.py
    branches/blender2.5/blender/release/ui/buttons_texture.py
    branches/blender2.5/blender/source/blender/blenkernel/intern/material.c
    branches/blender2.5/blender/source/blender/editors/interface/interface_templates.c
    branches/blender2.5/blender/source/blender/makesrna/intern/rna_brush.c
    branches/blender2.5/blender/source/blender/makesrna/intern/rna_internal.h
    branches/blender2.5/blender/source/blender/makesrna/intern/rna_lamp.c
    branches/blender2.5/blender/source/blender/makesrna/intern/rna_material.c
    branches/blender2.5/blender/source/blender/makesrna/intern/rna_world.c

Modified: branches/blender2.5/blender/release/ui/buttons_objects.py
===================================================================
--- branches/blender2.5/blender/release/ui/buttons_objects.py	2009-07-15 19:19:43 UTC (rev 21604)
+++ branches/blender2.5/blender/release/ui/buttons_objects.py	2009-07-15 19:20:59 UTC (rev 21605)
@@ -161,7 +161,7 @@
 		sub.itemR(ob, "time_offset", text="Offset")
 
 		sub = split.column()
-		sub.itemL(text="Tracking:")
+		sub.itemL(text="Track:")
 		sub.itemR(ob, "track", text="")
 		sub.itemR(ob, "track_axis", text="Axis")
 		sub.itemR(ob, "up_axis", text="Up Axis")

Modified: branches/blender2.5/blender/release/ui/buttons_scene.py
===================================================================
--- branches/blender2.5/blender/release/ui/buttons_scene.py	2009-07-15 19:19:43 UTC (rev 21604)
+++ branches/blender2.5/blender/release/ui/buttons_scene.py	2009-07-15 19:20:59 UTC (rev 21605)
@@ -111,11 +111,12 @@
 		split = layout.split()
 		
 		col = split.column()
+		col.itemR(rd, "render_textures", text="Textures")
 		col.itemR(rd, "render_shadows", text="Shadows")
 		col.itemR(rd, "render_sss", text="Subsurface Scattering")
-		col.itemR(rd, "render_envmaps", text="Environment Map")
 		
 		col = split.column()
+		col.itemR(rd, "render_envmaps", text="Environment Map")
 		col.itemR(rd, "render_raytracing", text="Ray Tracing")
 		col.itemR(rd, "alpha_mode", text="Alpha")
 

Modified: branches/blender2.5/blender/release/ui/buttons_texture.py
===================================================================
--- branches/blender2.5/blender/release/ui/buttons_texture.py	2009-07-15 19:19:43 UTC (rev 21604)
+++ branches/blender2.5/blender/release/ui/buttons_texture.py	2009-07-15 19:20:59 UTC (rev 21605)
@@ -81,6 +81,9 @@
 
 	def draw(self, context):
 		layout = self.layout
+		ma = context.material
+		la = context.lamp
+		wo = context.world
 		tex = context.texture_slot
 		textype = context.texture
 
@@ -104,16 +107,22 @@
 			col = split.column()
 			col.itemR(tex, "mapping", text="")
 
-		split = layout.split()
-		
-		col = split.column()
-		col.itemR(tex, "from_dupli")
-		
-		col = split.column()
-		row = col.row()
-		row.itemR(tex, "x_mapping", text="")
-		row.itemR(tex, "y_mapping", text="")
-		row.itemR(tex, "z_mapping", text="")
+		if ma:
+			split = layout.split()
+			
+			col = split.column()
+			if tex.texture_coordinates in ('ORCO', 'UV'):
+				col.itemR(tex, "from_dupli")
+			elif tex.texture_coordinates == 'OBJECT':
+				col.itemR(tex, "from_original")
+			else:
+				col.itemL()
+			
+			col = split.column()
+			row = col.row()
+			row.itemR(tex, "x_mapping", text="")
+			row.itemR(tex, "y_mapping", text="")
+			row.itemR(tex, "z_mapping", text="")
 
 		row = layout.row()
 		row.column().itemR(tex, "offset")
@@ -129,51 +138,90 @@
 	def draw(self, context):
 		layout = self.layout
 		
+		ma = context.material
+		la = context.lamp
+		wo = context.world
 		textype = context.texture
 		tex = context.texture_slot
 		
-		split = layout.split()
+		if ma:
+			split = layout.split()
+			
+			col = split.column()
+			col.itemR(tex, "map_color", text="Diffuse Color")
+			colsub = col.column()
+			colsub.active = tex.map_color
+			colsub.itemR(tex, "color_factor", text="Opacity", slider=True)
+			colsub.itemR(tex, "blend_type")
+			col.itemR(tex, "rgb_to_intensity")
+			colsub = col.column()
+			colsub.active = tex.rgb_to_intensity
+			colsub.itemR(tex, "color")
 		
-		col = split.column()
-		col.itemR(tex, "map_color", text="Diffuse Color")
-		colsub = col.column()
-		colsub.active = tex.map_color
-		colsub.itemR(tex, "color_factor", text="Opacity", slider=True)
-		colsub.itemR(tex, "blend_type")
-		col.itemR(tex, "rgb_to_intensity")
-		colsub = col.column()
-		colsub.active = tex.rgb_to_intensity
-		colsub.itemR(tex, "color")
-	
-		col.itemR(tex, "map_colorspec")
-		col.itemR(tex, "map_normal")
-		colsub = col.column()
-		colsub.active = tex.map_normal
-		colsub.itemR(tex, "normal_factor", text="Amount", slider=True)
-		col.itemR(tex, "normal_map_space")
-		col.itemR(tex, "map_warp")
-		colsub = col.column()
-		colsub.active = tex.map_warp
-		colsub.itemR(tex, "warp_factor", text="Amount", slider=True)	
-		col.itemR(tex, "map_displacement")
-		colsub = col.column()
-		colsub.active = tex.map_displacement
-		colsub.itemR(tex, "displacement_factor", text="Amount", slider=True)
-		col = split.column()
-		col.itemR(tex, "map_mirror")
-		col.itemR(tex, "map_reflection")
-		col.itemR(tex, "map_specularity")
-		col.itemR(tex, "map_ambient")
-		col.itemR(tex, "map_hardness")
-		col.itemR(tex, "map_raymir")
-		col.itemR(tex, "map_alpha")
-		col.itemR(tex, "map_emit")
-		col.itemR(tex, "map_translucency")
+			col.itemR(tex, "map_colorspec")
+			col.itemR(tex, "map_normal")
+			colsub = col.column()
+			colsub.active = tex.map_normal
+			colsub.itemR(tex, "normal_factor", text="Amount", slider=True)
+			col.itemR(tex, "normal_map_space")
+			col.itemR(tex, "map_warp")
+			colsub = col.column()
+			colsub.active = tex.map_warp
+			colsub.itemR(tex, "warp_factor", text="Amount", slider=True)	
+			col.itemR(tex, "map_displacement")
+			colsub = col.column()
+			colsub.active = tex.map_displacement
+			colsub.itemR(tex, "displacement_factor", text="Amount", slider=True)
+			col = split.column()
+			col.itemR(tex, "map_mirror")
+			col.itemR(tex, "map_reflection")
+			col.itemR(tex, "map_specularity")
+			col.itemR(tex, "map_ambient")
+			col.itemR(tex, "map_hardness")
+			col.itemR(tex, "map_raymir")
+			col.itemR(tex, "map_alpha")
+			col.itemR(tex, "map_emit")
+			col.itemR(tex, "map_translucency")
 
-		colsub = col.column()
-		colsub.active = tex.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
-		colsub.itemR(tex, "default_value", text="Amount", slider=True)
-		
+			colsub = col.column()
+			colsub.active = tex.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
+			colsub.itemR(tex, "default_value", text="Amount", slider=True)
+			
+		elif la:
+			row = layout.row()
+			row.itemR(tex, "map_color")
+			row.itemR(tex, "map_shadow")
+
+			split = layout.split()
+
+			col = split.column()
+			col.itemR(tex, "color_factor", text="Opacity", slider=True)
+			col.itemR(tex, "blend_type")
+			col.itemR(tex, "rgb_to_intensity")
+			col.itemR(tex, "color")
+
+			col = split.column()
+			col.itemR(tex, "default_value", text="DVar", slider=True)
+		elif wo:
+			row = layout.row()
+			row.itemR(tex, "map_blend")
+			row.itemR(tex, "map_horizon")
+			row.itemR(tex, "map_zenith_up")
+			row.itemR(tex, "map_zenith_down")
+
+			split = layout.split()
+
+			col = split.column()
+			col.itemR(tex, "color_factor", text="Opacity", slider=True)
+			col.itemR(tex, "blend_type")
+			col.itemR(tex, "rgb_to_intensity")
+			col.itemR(tex, "color")
+
+			col = split.column()
+			col.itemR(tex, "normal_factor", text="Nor", slider=True)
+			col.itemR(tex, "variable_factor", text="Var", slider=True)
+			col.itemR(tex, "default_value", text="DVar", slider=True)
+
 		row = layout.row()
 		row.itemR(tex, "stencil")
 		row.itemR(tex, "negate", text="Negative")

Modified: branches/blender2.5/blender/source/blender/blenkernel/intern/material.c
===================================================================
--- branches/blender2.5/blender/source/blender/blenkernel/intern/material.c	2009-07-15 19:19:43 UTC (rev 21604)
+++ branches/blender2.5/blender/source/blender/blenkernel/intern/material.c	2009-07-15 19:20:59 UTC (rev 21605)
@@ -613,7 +613,8 @@
 		(*matarar)[act-1]= ma;
 	}
 
-	id_us_plus((ID *)ma);
+	if(ma)
+		id_us_plus((ID *)ma);
 	test_object_materials(ob->data);
 }
 
@@ -645,13 +646,7 @@
 	if(ob->totcol>=MAXMAT) return;
 	
 	ma= give_current_material(ob, ob->actcol);
-	if(ma==NULL)
-		ma= add_material("Material");
-	else
-		ma= copy_material(ma);
-	
-	ma->id.us= 0; /* eeh... */
-	
+
 	assign_material(ob, ma, ob->totcol+1);
 	ob->actcol= ob->totcol;
 }

Modified: branches/blender2.5/blender/source/blender/editors/interface/interface_templates.c
===================================================================
--- branches/blender2.5/blender/source/blender/editors/interface/interface_templates.c	2009-07-15 19:19:43 UTC (rev 21604)
+++ branches/blender2.5/blender/source/blender/editors/interface/interface_templates.c	2009-07-15 19:20:59 UTC (rev 21605)
@@ -1301,13 +1301,14 @@
 	CollectionPointerLink *link;
 	PropertyRNA *prop= NULL, *activeprop;
 	PropertyType type, activetype;
+	StructRNA *ptype;
 	uiLayout *box, *row, *col;
 	uiBlock *block;
 	uiBut *but;
 	Panel *pa;
 	ListBase lb;
 	char *name, str[32];
-	int i= 0, activei= 0, len, items, found, min, max;
+	int icon=0, i= 0, activei= 0, len, items, found, min, max;
 
 	lb.first= lb.last= NULL;
 	
@@ -1351,6 +1352,12 @@
 		return lb;
 	}
 
+	/* get icon */
+	if(ptr->data && prop) {
+		ptype= RNA_property_pointer_type(ptr, prop);
+		icon= RNA_struct_ui_icon(ptype);
+	}
+
 	/* get active data */
 	activei= RNA_property_int_get(activeptr, activeprop);
 
@@ -1368,10 +1375,10 @@
 				if(found) {
 					/* create button */
 					name= RNA_struct_name_get_alloc(&itemptr, NULL, 0);
-					if(name) {
-						uiItemL(row, name, RNA_struct_ui_icon(itemptr.type));
+					uiItemL(row, (name)? name: "", icon);
+
+					if(name)
 						MEM_freeN(name);
-					}
 
 					/* add to list to return */
 					link= MEM_callocN(sizeof(CollectionPointerLink), "uiTemplateList return");
@@ -1423,13 +1430,12 @@
 				if(i >= pa->list_scroll && i<pa->list_scroll+items) {
 					name= RNA_struct_name_get_alloc(&itemptr, NULL, 0);
 
-					if(name) {
-						/* create button */
-						but= uiDefIconTextButR(block, ROW, 0, RNA_struct_ui_icon(itemptr.type), name, 0,0,UI_UNIT_X*10,UI_UNIT_Y, activeptr, activepropname, 0, 0, i, 0, 0, "");
-						uiButSetFlag(but, UI_ICON_LEFT|UI_TEXT_LEFT);
+					/* create button */
+					but= uiDefIconTextButR(block, ROW, 0, icon, (name)? name: "", 0,0,UI_UNIT_X*10,UI_UNIT_Y, activeptr, activepropname, 0, 0, i, 0, 0, "");
+					uiButSetFlag(but, UI_ICON_LEFT|UI_TEXT_LEFT);
 
+					if(name)
 						MEM_freeN(name);
-					}
 
 					/* add to list to return */
 					link= MEM_callocN(sizeof(CollectionPointerLink), "uiTemplateList return");

Modified: branches/blender2.5/blender/source/blender/makesrna/intern/rna_brush.c

@@ Diff output truncated at 10240 characters. @@




More information about the Bf-blender-cvs mailing list