Page MenuHome

ior-presets.post-orange.patch

File Metadata

Author
Ed Halley (halley)
Created
Nov 13 2013, 1:04 PM

ior-presets.post-orange.patch

Index: source/blender/include/butspace.h
===================================================================
RCS file: /cvsroot/bf-blender/blender/source/blender/include/butspace.h,v
retrieving revision 1.71
diff -u -b -B -u -r1.71 butspace.h
--- source/blender/include/butspace.h 30 Jan 2006 19:59:33 -0000 1.71
+++ source/blender/include/butspace.h 4 Feb 2006 05:37:17 -0000
@@ -190,8 +190,8 @@
#define B_MATZTRANSP 1216
#define B_MATRAYTRANSP 1217
#define B_MATCOLORBAND 1218
- /* yafray: material preset menu event */
-#define B_MAT_YF_PRESET 1219
+#define B_MAT_YF_PRESET 1219 /* yafray: material preset menu event */
+#define B_MATIORBROWSE 1220
#define B_MAT_LAYERBROWSE 1220
#define B_MAT_USENODES 1221
Index: source/blender/src/buttons_shading.c
===================================================================
RCS file: /cvsroot/bf-blender/blender/source/blender/src/buttons_shading.c,v
retrieving revision 1.162
diff -u -b -B -u -r1.162 buttons_shading.c
--- source/blender/src/buttons_shading.c 28 Jan 2006 18:33:17 -0000 1.162
+++ source/blender/src/buttons_shading.c 4 Feb 2006 05:37:17 -0000
@@ -115,6 +115,59 @@
static MTex emptytex;
static int packdummy = 0;
+typedef struct {
+ float ang;
+ char *name;
+} IorPreset;
+
+static IorPreset iors[] = {
+ { 1.000, "Nothing" },
+ { 1.309, "Frozen Water" },
+ { 1.333, "Liquid Water" },
+ { 1.360, "Ethyl Alcohol" },
+ { 1.345, "Beer or Soda" },
+ { 1.380, "Eye Cornea" },
+ { 1.459, "Silica Glass" },
+ { 1.470, "Vegetable Oil" },
+ { 1.474, "Pyrex Glass" },
+ { 1.488, "Plexiglas" },
+ { 1.495, "Lucite Plastic" },
+ { 1.504, "Bee Honey" },
+ { 1.520, "Common Glass" },
+ { 1.530, "Nylon Plastic" },
+ { 1.542, "Amber" },
+ { 1.548, "Quartz" },
+ { 1.578, "Aquamarine" },
+ { 1.583, "Emerald" },
+ { 1.617, "Topaz" },
+ { 1.620, "Nephrite Jade" },
+ { 1.650, "Jadeite Jade" },
+ { 1.663, "Peridot" },
+ { 1.767, "Ruby" },
+ { 1.768, "Sapphire" },
+ { 1.882, "Cubic Zirconia" },
+ { 2.417, "Diamond" },
+ { 0.000, NULL },
+};
+
+
+static char *mat_iorpreset_pup(void)
+{
+ static char string[2048];
+ char tempstr[1024];
+ IorPreset* preset;
+ int i;
+
+ strcpy(string, "Index of Refraction Presets: %t");
+ for (preset= iors, i= 0; preset->name; preset++, i++) {
+ sprintf(tempstr, "|%1.3f %s %%x%d", preset->ang, preset->name, i);
+ strcat(string, tempstr);
+ }
+
+ return string;
+}
+
+
static char *mapto_blendtype_pup(void)
{
static char string[1024];
@@ -2433,6 +2486,12 @@
allqueue(REDRAWOOPS, 0);
// BIF_previewdraw(); push/pop!
break;
+ case B_MATIORBROWSE:
+ ma= G.buts->lockpoin;
+ ma->ang = iors[G.buts->menunr].ang;
+ BIF_preview_changed(G.buts);
+ shade_buttons_change_3d();
+ break;
case B_MATPRV:
if(ma) end_render_material(ma); /// temporal... 3d preview
BIF_preview_changed(ID_MA);
@@ -2799,7 +2858,8 @@
uiDefButBitI(block, TOG, MA_RAYTRANSP, B_MATRAYTRANSP,"Ray Transp",160,110,150,20, &(ma->mode), 0, 0, 0, 0, "Enables raytracing for transparency rendering");
uiBlockBeginAlign(block);
- uiDefButF(block, NUMSLI, B_MATPRV, "IOR ", 10,90,200,20, &(ma->ang), 1.0, 3.0, 100, 2, "Sets the angular index of refraction for raytrace");
+ uiDefButF(block, NUMSLI, B_MATPRV, "IOR ", 10,90,180,20, &(ma->ang), 1.0, 3.0, 100, 2, "Sets the angular index of refraction for raytrace");
+ uiDefButI(block, MENU, B_MATIORBROWSE, mat_iorpreset_pup(), 190,90,20,20, &(G.buts->menunr), 0, 0, 0, 0, "Selects from a few natural refraction presets");
uiDefButS(block, NUM, B_MATPRV, "Depth:", 210,90,100,20, &(ma->ray_depth_tra), 0.0, 10.0, 100, 0, "Amount of refractions calculated maximal ");
uiDefButF(block, NUMSLI, B_MATPRV, "Fresnel ", 10,70,160,20, &(ma->fresnel_tra), 0.0, 5.0, 10, 2, "Power of Fresnel for transparency");

Event Timeline