Page Menu
Home
Search
Configure Global Search
Log In
Files
F5211
ior_presets.patch
Public
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Authored By
Tanner Jotblad (dreblen)
Nov 13 2013, 1:21 PM
Size
3 KB
Subscribers
None
ior_presets.patch
View Options
Index: source/blender/src/buttons_shading.c
===================================================================
--- source/blender/src/buttons_shading.c (revision 12614)
+++ source/blender/src/buttons_shading.c (working copy)
@@ -3325,10 +3325,56 @@
uiBlockSetCol(block, TH_AUTO);
}
+void material_tramir_ior_preset_cb(Material *ma, short int *ior_switch)
+{
+ switch(*ior_switch)
+ {
+ case 0:
+ /* ior is still the staticly declared 0 */
+ break;
+ case 1:
+ /* bubble */
+ ma->ang = 1.100;
+ *ior_switch = 0;
+ break;
+ case 2:
+ /* water */
+ ma->ang = 1.333;
+ *ior_switch = 0;
+ break;
+ case 3:
+ /* ice (from water) */
+ ma->ang = 1.310;
+ *ior_switch = 0;
+ break;
+ case 4:
+ /* light glass */
+ ma->ang = 1.450;
+ *ior_switch = 0;
+ break;
+ case 5:
+ /* standard glass */
+ ma->ang = 1.520;
+ *ior_switch = 0;
+ break;
+ case 6:
+ /* heavy glass */
+ ma->ang = 1.650;
+ *ior_switch = 0;
+ break;
+ case 7:
+ /* crystal */
+ ma->ang = 1.870;
+ *ior_switch = 0;
+ break;
+ }
+}
+
static void material_panel_tramir(Material *ma)
{
uiBlock *block;
short yco=PANEL_YMAX;
+ static short int ior_switch = 0;
block= uiNewBlock(&curarea->uiblocks, "material_panel_tramir", UI_EMBOSS, UI_HELV, curarea->win);
uiNewPanelTabbed("Shaders", "Material");
@@ -3384,7 +3430,12 @@
uiBlockBeginAlign(block);
uiDefButF(block, NUMSLI, B_MATPRV, "IOR: ",
- X2CLM2, yco-=BUTH, BUTW2, BUTH, &(ma->ang), 1.0, 3.0, 100, 2, "Sets angular index of refraction for raytraced refraction");
+ X2CLM2, yco-=BUTH, BUTW2 - 20, BUTH, &(ma->ang), 1.0, 3.0, 100, 2, "Sets angular index of refraction for raytraced refraction");
+ /* arrow menu that holds IOR presets */
+ uiDefButS(block, MENU, B_MATPRV, "IOR presets%t| Bubble%x1| Water%x2| Ice%x3| Light Glass%x4| Standard Glass%x5| Heavy Glass%x6| Crystal%x7",
+ X2CLM2 + (BUTW2 - 20), yco, 20, BUTH, &ior_switch, 0, 0, 0, 0, "IOR presets");
+ material_tramir_ior_preset_cb(ma, &ior_switch);
+
uiDefButF(block, NUMSLI, B_MATPRV, "Fresnel: ",
X2CLM2, yco-=BUTH, BUTW2, BUTH, &(ma->fresnel_tra), 0.0, 5.0, 10, 2, "Power of Fresnel for mirror reflection");
uiDefButF(block, NUMSLI, B_MATPRV, "Fac: ",
@@ -3434,6 +3485,7 @@
{
uiBlock *block;
char *mstr = "Material presets %t|No Reflect/Transmit %x0|Clear Glass %x1|Color Glass %x2|Uniform Reflect %x3|Fresnel Reflect %x4";
+ static short int ior_switch = 0;
/* better to use same name as original panel */
block= uiNewBlock(&curarea->uiblocks, "material_panel_tramir", UI_EMBOSS, UI_HELV, curarea->win);
@@ -3454,7 +3506,11 @@
uiDefButF(block, NUMSLI, B_MATPRV, "frsOfs ", 160,140,150,20, &(ma->fresnel_mir_i), 1.0, 5.0, 10, 2, "Fresnel offset, 1 is uniform mirror, 5 is fresnel mirror (IOR>1)");
/* ior has extended range up to 30, for use with total fresnel reflection */
- uiDefButF(block, NUMSLI, B_MATPRV, "IOR ", 10,115,150,20, &(ma->ang), 1.0, 30.0, 100, 2, "Sets the angular index of refraction for raytrace");
+ uiDefButF(block, NUMSLI, B_MATPRV, "IOR ", 10,115,130,20, &(ma->ang), 1.0, 30.0, 100, 2, "Sets the angular index of refraction for raytrace");
+ /* arrow menu that holds IOR presets */
+ uiDefButS(block, MENU, B_MATPRV, "IOR presets%t| Bubble%x1| Water%x2| Ice%x3| Light Glass%x4| Standard Glass%x5| Heavy Glass%x6| Crystal%x7",
+ 140, 115, 20, 20, &ior_switch, 0, 0, 0, 0, "IOR presets");
+ material_tramir_ior_preset_cb(ma, &ior_switch);
// parameters only used in ray_transp mode
if(ma->mode & MA_RAYTRANSP) {
File Metadata
Details
Mime Type
text/x-diff
Storage Engine
local-disk
Storage Format
Raw Data
Storage Handle
e3/8a/145d2f632547e9edc114816b318a
Event Timeline
Log In to Comment