[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [26384] trunk/blender/source/blender: Fix for weirdness in texture map to settings - we now use negative

Matt Ebb matt at mke3.net
Fri Jan 29 02:21:00 CET 2010


Revision: 26384
          http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=26384
Author:   broken
Date:     2010-01-29 02:20:57 +0100 (Fri, 29 Jan 2010)

Log Message:
-----------
Fix for weirdness in texture map to settings - we now use negative 
numbers for negative influences (as opposed to old 3-state button)
but the ui range was only set to 0,1.

Changed the defaults to -1,1 and added a shortcut - pressing minus 
key while the mouse is over a number field or slider will make it negative.

Modified Paths:
--------------
    trunk/blender/source/blender/editors/interface/interface_handlers.c
    trunk/blender/source/blender/makesrna/intern/rna_material.c

Modified: trunk/blender/source/blender/editors/interface/interface_handlers.c
===================================================================
--- trunk/blender/source/blender/editors/interface/interface_handlers.c	2010-01-29 00:47:38 UTC (rev 26383)
+++ trunk/blender/source/blender/editors/interface/interface_handlers.c	2010-01-29 01:20:57 UTC (rev 26384)
@@ -2308,6 +2308,12 @@
 			}
 			else if(ELEM(event->type, PADENTER, RETKEY) && event->val==KM_PRESS)
 				click= 1;
+			else if (event->type == MINUSKEY && event->val==KM_PRESS) {
+				button_activate_state(C, but, BUTTON_STATE_NUM_EDITING);
+				data->value = -data->value;
+				button_activate_state(C, but, BUTTON_STATE_EXIT);
+				retval= WM_UI_HANDLER_BREAK;
+			}
 		}
 		
 	}
@@ -2525,6 +2531,12 @@
 			}
 			else if(ELEM(event->type, PADENTER, RETKEY) && event->val==KM_PRESS)
 				click= 1;
+			else if (event->type == MINUSKEY && event->val==KM_PRESS) {
+				button_activate_state(C, but, BUTTON_STATE_NUM_EDITING);
+				data->value = -data->value;
+				button_activate_state(C, but, BUTTON_STATE_EXIT);
+				retval= WM_UI_HANDLER_BREAK;
+			}
 		}
 	}
 	else if(data->state == BUTTON_STATE_NUM_EDITING) {

Modified: trunk/blender/source/blender/makesrna/intern/rna_material.c
===================================================================
--- trunk/blender/source/blender/makesrna/intern/rna_material.c	2010-01-29 00:47:38 UTC (rev 26383)
+++ trunk/blender/source/blender/makesrna/intern/rna_material.c	2010-01-29 01:20:57 UTC (rev 26384)
@@ -451,13 +451,13 @@
 
 	prop= RNA_def_property(srna, "normal_factor", PROP_FLOAT, PROP_NONE);
 	RNA_def_property_float_sdna(prop, NULL, "norfac");
-	RNA_def_property_ui_range(prop, 0, 5, 10, 3);
+	RNA_def_property_ui_range(prop, -5, 5, 10, 3);
 	RNA_def_property_ui_text(prop, "Normal Factor", "Amount texture affects normal values.");
 	RNA_def_property_update(prop, 0, "rna_Material_update");
 
 	prop= RNA_def_property(srna, "displacement_factor", PROP_FLOAT, PROP_NONE);
 	RNA_def_property_float_sdna(prop, NULL, "dispfac");
-	RNA_def_property_ui_range(prop, 0, 1, 10, 3);
+	RNA_def_property_ui_range(prop, -1, 1, 10, 3);
 	RNA_def_property_ui_text(prop, "Displacement Factor", "Amount texture displaces the surface.");
 	RNA_def_property_update(prop, 0, "rna_Material_update");
 
@@ -487,49 +487,49 @@
 
 	prop= RNA_def_property(srna, "alpha_factor", PROP_FLOAT, PROP_NONE);
 	RNA_def_property_float_sdna(prop, NULL, "alphafac");
-	RNA_def_property_ui_range(prop, 0, 1, 10, 3);
+	RNA_def_property_ui_range(prop, -1, 1, 10, 3);
 	RNA_def_property_ui_text(prop, "Alpha Factor", "Amount texture affects alpha.");
 	RNA_def_property_update(prop, 0, "rna_Material_update");
 
 	prop= RNA_def_property(srna, "diffuse_factor", PROP_FLOAT, PROP_NONE);
 	RNA_def_property_float_sdna(prop, NULL, "difffac");
-	RNA_def_property_ui_range(prop, 0, 1, 10, 3);
+	RNA_def_property_ui_range(prop, -1, 1, 10, 3);
 	RNA_def_property_ui_text(prop, "Diffuse Factor", "Amount texture affects diffuse reflectivity.");
 	RNA_def_property_update(prop, 0, "rna_Material_update");
 
 	prop= RNA_def_property(srna, "specular_factor", PROP_FLOAT, PROP_NONE);
 	RNA_def_property_float_sdna(prop, NULL, "specfac");
-	RNA_def_property_ui_range(prop, 0, 1, 10, 3);
+	RNA_def_property_ui_range(prop, -1, 1, 10, 3);
 	RNA_def_property_ui_text(prop, "Specular Factor", "Amount texture affects specular reflectivity.");
 	RNA_def_property_update(prop, 0, "rna_Material_update");
 
 	prop= RNA_def_property(srna, "emit_factor", PROP_FLOAT, PROP_NONE);
 	RNA_def_property_float_sdna(prop, NULL, "emitfac");
-	RNA_def_property_ui_range(prop, 0, 1, 10, 3);
+	RNA_def_property_ui_range(prop, -1, 1, 10, 3);
 	RNA_def_property_ui_text(prop, "Emit Factor", "Amount texture affects emission.");
 	RNA_def_property_update(prop, 0, "rna_Material_update");
 
 	prop= RNA_def_property(srna, "hardness_factor", PROP_FLOAT, PROP_NONE);
 	RNA_def_property_float_sdna(prop, NULL, "hardfac");
-	RNA_def_property_ui_range(prop, 0, 1, 10, 3);
+	RNA_def_property_ui_range(prop, -1, 1, 10, 3);
 	RNA_def_property_ui_text(prop, "Hardness Factor", "Amount texture affects hardness.");
 	RNA_def_property_update(prop, 0, "rna_Material_update");
 
 	prop= RNA_def_property(srna, "raymir_factor", PROP_FLOAT, PROP_NONE);
 	RNA_def_property_float_sdna(prop, NULL, "raymirrfac");
-	RNA_def_property_ui_range(prop, 0, 1, 10, 3);
+	RNA_def_property_ui_range(prop, -1, 1, 10, 3);
 	RNA_def_property_ui_text(prop, "Ray Mirror Factor", "Amount texture affects ray mirror.");
 	RNA_def_property_update(prop, 0, "rna_Material_update");
 
 	prop= RNA_def_property(srna, "translucency_factor", PROP_FLOAT, PROP_NONE);
 	RNA_def_property_float_sdna(prop, NULL, "translfac");
-	RNA_def_property_ui_range(prop, 0, 1, 10, 3);
+	RNA_def_property_ui_range(prop, -1, 1, 10, 3);
 	RNA_def_property_ui_text(prop, "Translucency Factor", "Amount texture affects translucency.");
 	RNA_def_property_update(prop, 0, "rna_Material_update");
 
 	prop= RNA_def_property(srna, "ambient_factor", PROP_FLOAT, PROP_NONE);
 	RNA_def_property_float_sdna(prop, NULL, "ambfac");
-	RNA_def_property_ui_range(prop, 0, 1, 10, 3);
+	RNA_def_property_ui_range(prop, -1, 1, 10, 3);
 	RNA_def_property_ui_text(prop, "Ambient Factor", "Amount texture affects ambient.");
 	RNA_def_property_update(prop, 0, "rna_Material_update");
 





More information about the Bf-blender-cvs mailing list