Last active
August 29, 2015 14:23
-
-
Save esemwy/48e75096d75b2118f031 to your computer and use it in GitHub Desktop.
Revisions
-
esemwy revised this gist
Jun 19, 2015 . 1 changed file with 91 additions and 31 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -1,6 +1,7 @@ // 0.3 - Much Less Ugly // Now loads the config from an external JSON file that must be // stored as IOR.json in the same directory as the script. // Handles actual events and allows selecting from range of values. function loadConfig() { @@ -20,42 +21,113 @@ function loadConfig() var materials = loadConfig(); var wDlg = new DzDialog; wDlg.caption = "Set Material IOR"; wDlg.whatsThis = "Set the IOR for Iray material."; var gb = new DzVGroupBox( wDlg ); // Create a label var wGbLbl = new DzVGroupBox( gb ); wGbLbl.columns = 1; var wLbl = new DzLabel( wGbLbl ); wLbl.text = "Choose a material."; wLbl.whatsThis = "This is the \"What\'s This?\" text for the label."; var gbFiletype = new DzVGroupBox( gb ); gbFiletype.columns = 2; var wLblFiSu = new DzLabel( gbFiletype ); wLblFiSu.text = "Physical Material"; var wCbFiSu = new DzComboBox( gbFiletype ); var numMat = materials.length; print("numMat "+numMat); for (var i = 0; i < numMat; i++) { if (materials[i].hasOwnProperty("name")) { wCbFiSu.insertItem(materials[i].name); } } wCbFiSu.currentItem = 0; connect( wCbFiSu, "activated(int)", doValueChanged ); //======= var gbStartStop = new DzVGroupBox( gb ); gbStartStop.columns = 1; var wFsldIOR = new DzFloatSlider(gbStartStop); wFsldIOR.max = 1.444; wFsldIOR.min = 1.333; wFsldIOR.sensitivity = 0.001; wFsldIOR.value = 1.333; wFsldIOR.text = "Index of Refraction"; wFsldIOR.clamped = true; gbStartStop.hide(); //======= var gbStartOnly = new DzVGroupBox( gb ); gbStartOnly.columns = 2; var wLblStart = new DzLabel( gbStartOnly ); wLblStart.text = "Index of Refraction"; var wLblValue = new DzLabel( gbStartOnly ); wLblValue.text = "1.333"; //======= var gbButtons = new DzVGroupBox( gb ); gbButtons.columns = 2; var wRenderListBtn = addButtonToGB( gbButtons, "Set", doSetIOR ); var wCancelBtn = new DzPushButton( gbButtons ); wCancelBtn.text = "&Exit"; wDlg.setRejectButton( wCancelBtn ); //======= wDlg.minWidth = 320; wDlg.minHeight = 225; doValueChanged(wCbFiSu.currentItem); wDlg.exec(); function addButtonToGB( gb, text, func ) { var wButton = new DzPushButton( gb ); wButton.text = text; connect( wButton, "clicked()", func ); return( wButton ); } function doValueChanged(v) { print("Action handled"); var o = materials[v]; if (o.hasOwnProperty("stop")) { wFsldIOR.max = o.stop; wFsldIOR.min = o.start; wFsldIOR.value = o.start; gbStartOnly.hide(); gbStartStop.show(); } else { wLblValue.text = ''+o.start; gbStartOnly.show(); gbStartStop.hide(); } } function doSetIOR(v) { var i = wCbFiSu.currentItem; if (materials[i].hasOwnProperty("start")) { var o = materials[i]; } if (o.hasOwnProperty("stop")) { var newIOR = wFsldIOR.value; print("IOR = " + wFsldIOR.value); } else { var newIOR = o.start; print("IOR = " + o.start); } var skel = Scene.getPrimarySelection(); if ( skel ) { @@ -82,7 +154,7 @@ if( wDlg.exec() ) var ior = curMat.findProperty("Index of Refraction"); if (ior) { var iorVal = ior.getValue(); ior.setValue(newIOR); } } } @@ -110,7 +182,7 @@ if( wDlg.exec() ) var ior = curMat.findProperty("Index of Refraction"); if (ior) { var iorVal = ior.getValue(); ior.setValue(newIOR); } } } @@ -119,16 +191,4 @@ if( wDlg.exec() ) } } } } -
esemwy revised this gist
Jun 18, 2015 . 2 changed files with 1593 additions and 1217 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,1536 @@ [ { "name": "Acetone", "start": 1.36 }, { "name": "Acrylic glass", "start": 1.49, "stop": 1.492 }, { "name": "Actinolite", "start": 1.618 }, { "name": "Agalmatoite", "start": 1.55 }, { "name": "Agate", "start": 1.544, "stop": 1.553 }, { "name": "Agate, Moss", "start": 1.54 }, { "name": "Air", "start": 1.0 }, { "name": "Alcohol", "start": 1.329 }, { "name": "Alcohol, Ethyl (grain)", "start": 1.36 }, { "name": "Alcohol, Methyl (wood)", "start": 1.329 }, { "name": "Alexandrite", "start": 1.746, "stop": 1.755 }, { "name": "Almandine", "start": 1.75, "stop": 1.83 }, { "name": "Aluminum", "start": 1.244 }, { "name": "Aluminum Chloride", "start": 2.7 }, { "name": "Aluminum Oxide", "start": 1.665 }, { "name": "Amber", "start": 1.539, "stop": 1.546 }, { "name": "Amblygonite", "start": 1.611 }, { "name": "Amethyst", "start": 1.532, "stop": 1.554 }, { "name": "Ammolite", "start": 1.52, "stop": 1.68 }, { "name": "Amorphous Selenium", "start": 2.92 }, { "name": "Anatase", "start": 2.49 }, { "name": "Andalusite", "start": 1.629, "stop": 1.65 }, { "name": "Anhydrite", "start": 1.571 }, { "name": "Apatite", "start": 1.42, "stop": 1.632 }, { "name": "Apophyllite", "start": 1.536 }, { "name": "Aquamarine", "start": 1.567, "stop": 1.59 }, { "name": "Aragonite", "start": 1.53 }, { "name": "Argon", "start": 1.0 }, { "name": "Argonite", "start": 1.53 }, { "name": "Asphalt", "start": 1.635 }, { "name": "Augelite", "start": 1.574 }, { "name": "Axenite", "start": 1.674, "stop": 1.704 }, { "name": "Axinite", "start": 1.675 }, { "name": "Azurite", "start": 1.73 }, { "name": "Barite", "start": 1.636 }, { "name": "Barytocalcite", "start": 1.684 }, { "name": "Beer", "start": 1.345 }, { "name": "Benitoite", "start": 1.757 }, { "name": "Benzene", "start": 1.501 }, { "name": "Beryl", "start": 1.57, "stop": 1.6 }, { "name": "Beryl, Red", "start": 1.57, "stop": 1.598 }, { "name": "Beryllonite", "start": 1.553 }, { "name": "Borax", "start": 1.446 }, { "name": "Brazilianite", "start": 1.603 }, { "name": "Bromine (liquid)", "start": 1.661 }, { "name": "Bronze", "start": 1.18 }, { "name": "Brownite", "start": 1.567 }, { "name": "Calcite", "start": 1.486 }, { "name": "Calspar", "start": 1.486, "stop": 1.66 }, { "name": "Cancrinite", "start": 1.491 }, { "name": "Carbon Disulfide", "start": 1.628, "stop": 1.63 }, { "name": "Carbon Tetrachloride", "start": 1.46 }, { "name": "Carbon dioxide", "start": 1.0 }, { "name": "Carbonated Beverages", "start": 1.34, "stop": 1.356 }, { "name": "Cassiterite", "start": 1.997 }, { "name": "Celestite", "start": 1.622 }, { "name": "Cerussite", "start": 1.804 }, { "name": "Ceylanite", "start": 1.77 }, { "name": "Chalcedony", "start": 1.544, "stop": 1.553 }, { "name": "Chalk", "start": 1.51 }, { "name": "Chalybite", "start": 1.63 }, { "name": "Chlorine (gas)", "start": 1.001 }, { "name": "Chlorine (liquid)", "start": 1.385 }, { "name": "Chrome Green", "start": 2.4 }, { "name": "Chrome Red", "start": 2.42 }, { "name": "Chrome Tourmaline", "start": 1.61, "stop": 1.64 }, { "name": "Chrome Yellow", "start": 2.31 }, { "name": "Chromium", "start": 2.97 }, { "name": "Chromium Oxide", "start": 2.705 }, { "name": "Chrysoberyl", "start": 1.745 }, { "name": "Chrysocolla", "start": 1.5 }, { "name": "Chrysoprase", "start": 1.534 }, { "name": "Cinnabar (Mercury sulfide)", "start": 3.02 }, { "name": "Citrine", "start": 1.532, "stop": 1.554 }, { "name": "Cleaner (all purpose - orange)", "start": 1.293 }, { "name": "Clinohumite", "start": 1.625, "stop": 1.675 }, { "name": "Clinozoisite", "start": 1.724 }, { "name": "Cobalt Blue", "start": 1.74 }, { "name": "Cobalt Green", "start": 1.97 }, { "name": "Cobalt Violet", "start": 1.71 }, { "name": "Colemanite", "start": 1.586 }, { "name": "Copper", "start": 1.1, "stop": 2.43 }, { "name": "Copper Oxide", "start": 2.705 }, { "name": "Coral", "start": 1.486, "stop": 1.658 }, { "name": "Cordierite", "start": 1.54 }, { "name": "Corundum", "start": 1.766 }, { "name": "Cranberry Juice (25%)", "start": 1.351 }, { "name": "Crocoite", "start": 2.31 }, { "name": "Cromite", "start": 2.16 }, { "name": "Crown Glass", "start": 1.52 }, { "name": "Crown glass (impure)", "start": 1.485, "stop": 1.755 }, { "name": "Crown glass (pure)", "start": 1.5, "stop": 1.54 }, { "name": "Cryolite", "start": 1.338 }, { "name": "Crysoberyl, Catseye", "start": 1.746, "stop": 1.755 }, { "name": "Crystal", "start": 2.0 }, { "name": "Cubic zirconia", "start": 2.15, "stop": 2.18 }, { "name": "Cuprite", "start": 2.85 }, { "name": "Danburite", "start": 1.627, "stop": 1.641 }, { "name": "Diamond", "start": 2.418 }, { "name": "Diopside", "start": 1.68 }, { "name": "Dolomite", "start": 1.503 }, { "name": "Dumortierite", "start": 1.686 }, { "name": "Ebonite", "start": 1.66 }, { "name": "Ekanite", "start": 1.6 }, { "name": "Elaeolite", "start": 1.532 }, { "name": "Emerald", "start": 1.56, "stop": 1.605 }, { "name": "Emerald Catseye", "start": 1.56, "stop": 1.605 }, { "name": "Emerald, Synth flux", "start": 1.561 }, { "name": "Emerald, Synth hydro", "start": 1.568 }, { "name": "Enstatite", "start": 1.663 }, { "name": "Epidote", "start": 1.733 }, { "name": "Ethanol", "start": 1.36 }, { "name": "Ethyl Alcohol", "start": 1.36 }, { "name": "Euclase", "start": 1.652 }, { "name": "Eye, Aqueous humor", "start": 1.33 }, { "name": "Eye, Cornea", "start": 1.38 }, { "name": "Eye, Lens", "start": 1.41 }, { "name": "Eye, Vitreous humor", "start": 1.34 }, { "name": "Fabulite", "start": 2.409 }, { "name": "Feldspar, Adventurine", "start": 1.532 }, { "name": "Feldspar, Albite", "start": 1.525 }, { "name": "Feldspar, Amazonite", "start": 1.525 }, { "name": "Feldspar, Labradorite", "start": 1.565 }, { "name": "Feldspar, Microcline", "start": 1.525 }, { "name": "Feldspar, Oligoclase", "start": 1.539 }, { "name": "Feldspar, Orthoclase", "start": 1.525 }, { "name": "Flint glass (impure)", "start": 1.523, "stop": 1.925 }, { "name": "Flint glass (pure)", "start": 1.6, "stop": 1.62 }, { "name": "Flourite", "start": 1.433 }, { "name": "Fluoride", "start": 1.56 }, { "name": "Fluorite", "start": 1.434 }, { "name": "Formica", "start": 1.47 }, { "name": "Fused Quartz", "start": 1.46 }, { "name": "Gallium(III) arsenide", "start": 3.927 }, { "name": "Gallium(III) phosphide", "start": 3.5 }, { "name": "Garnet, Almandine", "start": 1.76 }, { "name": "Garnet, Almandite", "start": 1.79 }, { "name": "Garnet, Andradite", "start": 1.82 }, { "name": "Garnet, Demantiod", "start": 1.88, "stop": 1.9 }, { "name": "Garnet, Grossular", "start": 1.72, "stop": 1.8 }, { "name": "Garnet, Hessonite", "start": 1.745 }, { "name": "Garnet, Mandarin", "start": 1.79, "stop": 1.8 }, { "name": "Garnet, Pyrope", "start": 1.73, "stop": 1.76 }, { "name": "Garnet, Rhodolite", "start": 1.74, "stop": 1.77 }, { "name": "Garnet, Spessartite", "start": 1.81 }, { "name": "Garnet, Tsavorite", "start": 1.739, "stop": 1.744 }, { "name": "Garnet, Uvarovite", "start": 1.74, "stop": 1.87 }, { "name": "Gaylussite", "start": 1.517 }, { "name": "Glass", "start": 1.5 }, { "name": "Glass, Albite", "start": 1.489 }, { "name": "Glass, Arsenic Trisulfide", "start": 2.04 }, { "name": "Glass, Crown", "start": 1.52 }, { "name": "Glass, Crown, Zinc", "start": 1.517 }, { "name": "Glass, Flint, 29% lead", "start": 1.569 }, { "name": "Glass, Flint, 55% lead", "start": 1.669 }, { "name": "Glass, Flint, 71% lead", "start": 1.805 }, { "name": "Glass, Flint, Dense", "start": 1.66 }, { "name": "Glass, Flint, Heaviest", "start": 1.89 }, { "name": "Glass, Flint, Heavy", "start": 1.655 }, { "name": "Glass, Flint, Lanthanum", "start": 1.8 }, { "name": "Glass, Flint, Light", "start": 1.58 }, { "name": "Glass, Flint, Medium", "start": 1.627 }, { "name": "Glass, Fused Silica", "start": 1.459 }, { "name": "Glass, Pyrex", "start": 1.474 }, { "name": "Glycerine", "start": 1.473 }, { "name": "Glycerol", "start": 1.473 }, { "name": "Gold", "start": 0.47 }, { "name": "Gypsium", "start": 1.519 }, { "name": "Hambergite", "start": 1.559 }, { "name": "Hauyn", "start": 1.49, "stop": 1.505 }, { "name": "Hauynite", "start": 1.502 }, { "name": "Heaviest Flint Glass", "start": 1.89 }, { "name": "Heavy Flint Glass", "start": 1.65 }, { "name": "Helium", "start": 1.0 }, { "name": "Hematite", "start": 2.94 }, { "name": "Hemimorphite", "start": 1.614 }, { "name": "Hiddenite", "start": 1.655 }, { "name": "Honey, 13% water content", "start": 1.504 }, { "name": "Honey, 17% water content", "start": 1.494 }, { "name": "Honey, 21% water content", "start": 1.484 }, { "name": "Howlite", "start": 1.586 }, { "name": "Hydrogen (gas)", "start": 1.0 }, { "name": "Hydrogen (liquid)", "start": 1.097 }, { "name": "Hypersthene", "start": 1.67 }, { "name": "Ice", "start": 1.309 }, { "name": "Idocrase", "start": 1.713 }, { "name": "Iodine Crystal", "start": 3.34 }, { "name": "Iolite", "start": 1.522, "stop": 1.578 }, { "name": "Iron", "start": 2.95 }, { "name": "Ivory", "start": 1.54 }, { "name": "Jade, Jadeite", "start": 1.64, "stop": 1.667 }, { "name": "Jade, Nephrite", "start": 1.6, "stop": 1.641 }, { "name": "Jadeite", "start": 1.665 }, { "name": "Jasper", "start": 1.54 }, { "name": "Jet", "start": 1.66 }, { "name": "Kornerupine", "start": 1.665 }, { "name": "Kunzite", "start": 1.66, "stop": 1.676 }, { "name": "Kyanite", "start": 1.715 }, { "name": "Labradorite", "start": 1.56, "stop": 1.572 }, { "name": "Lapis Gem", "start": 1.5 }, { "name": "Lapis Lazuli", "start": 1.5, "stop": 1.55 }, { "name": "Lazulite", "start": 1.615 }, { "name": "Lead", "start": 2.01 }, { "name": "Lead Nitrate", "start": 1.782 }, { "name": "Leucite", "start": 1.509 }, { "name": "Light Flint Glass", "start": 1.575 }, { "name": "Liquid Carbon Dioxide", "start": 1.2 }, { "name": "Liquid Water (20deg C)", "start": 1.333 }, { "name": "Lucite", "start": 1.495 }, { "name": "Magnesite", "start": 1.515 }, { "name": "Malachite", "start": 1.655 }, { "name": "Meerschaum", "start": 1.53 }, { "name": "Mercury (liquid)", "start": 1.62 }, { "name": "Methanol", "start": 1.329 }, { "name": "Milk", "start": 1.35 }, { "name": "Moissanite", "start": 2.65, "stop": 2.69 }, { "name": "Moldavite", "start": 1.5 }, { "name": "Moonstone", "start": 1.518, "stop": 1.526 }, { "name": "Moonstone, Adularia", "start": 1.525 }, { "name": "Moonstone, Albite", "start": 1.535 }, { "name": "Morganite", "start": 1.585, "stop": 1.594 }, { "name": "Mylar", "start": 1.65 }, { "name": "Natrolite", "start": 1.48 }, { "name": "Nephrite", "start": 1.6 }, { "name": "Nickel", "start": 1.08 }, { "name": "Nitrogen (gas)", "start": 1.0 }, { "name": "Nitrogen (liq)", "start": 1.205 }, { "name": "Nylon", "start": 1.53 }, { "name": "Obsidian", "start": 1.489, "stop": 1.5 }, { "name": "Oil of Wintergreen", "start": 1.536 }, { "name": "Oil, Clove", "start": 1.535 }, { "name": "Oil, Lemon", "start": 1.481 }, { "name": "Oil, Neroli", "start": 1.482 }, { "name": "Oil, Orange", "start": 1.473 }, { "name": "Oil, Safflower", "start": 1.466 }, { "name": "Oil, vegetable (50deg C)", "start": 1.47 }, { "name": "Olivine", "start": 1.67 }, { "name": "Onyx", "start": 1.486 }, { "name": "Onyx Marble", "start": 1.486 }, { "name": "Opal", "start": 1.45 }, { "name": "Opal, Black", "start": 1.44, "stop": 1.46 }, { "name": "Opal, Fire", "start": 1.43, "stop": 1.46 }, { "name": "Opal, White", "start": 1.44, "stop": 1.46 }, { "name": "Oregon Sunstone", "start": 1.56, "stop": 1.572 }, { "name": "Oxygen (gas)", "start": 1.0 }, { "name": "Oxygen (liquid)", "start": 1.221 }, { "name": "PET", "start": 1.575 }, { "name": "PETg", "start": 1.57 }, { "name": "PMMA", "start": 1.489, "stop": 1.49 }, { "name": "Padparadja", "start": 1.76, "stop": 1.773 }, { "name": "Painite", "start": 1.787 }, { "name": "Pearl", "start": 1.53, "stop": 1.69 }, { "name": "Periclase", "start": 1.74 }, { "name": "Peristerite", "start": 1.525 }, { "name": "Petalite", "start": 1.502 }, { "name": "Phenakite", "start": 1.65 }, { "name": "Phosgenite", "start": 2.117 }, { "name": "Plastic", "start": 1.46 }, { "name": "Platinum", "start": 2.33 }, { "name": "Plexiglas", "start": 1.5 }, { "name": "Polycarbonate", "start": 1.584 }, { "name": "Polystyrene", "start": 1.55 }, { "name": "Prase", "start": 1.54 }, { "name": "Prasiolite", "start": 1.54 }, { "name": "Prehnite", "start": 1.61 }, { "name": "Proustite", "start": 2.79 }, { "name": "Purpurite", "start": 1.84 }, { "name": "Pyrite", "start": 1.81 }, { "name": "Pyrope", "start": 1.74 }, { "name": "Quartz", "start": 1.544, "stop": 1.644 }, { "name": "Quartz, Fused", "start": 1.458 }, { "name": "Rhodizite", "start": 1.69 }, { "name": "Rhodochrisite", "start": 1.6 }, { "name": "Rhodonite", "start": 1.735 }, { "name": "Rock salt", "start": 1.516, "stop": 1.544 }, { "name": "Rubber, Natural", "start": 1.519 }, { "name": "Ruby", "start": 1.757, "stop": 1.779 }, { "name": "Rum, White", "start": 1.361 }, { "name": "Rutile", "start": 2.62 }, { "name": "Salt (NaCl)", "start": 1.544 }, { "name": "Sanidine", "start": 1.522 }, { "name": "Sapphire", "start": 1.757, "stop": 1.779 }, { "name": "Sapphire, Star", "start": 1.76, "stop": 1.773 }, { "name": "Scapolite", "start": 1.54 }, { "name": "Scapolite, Yellow", "start": 1.555 }, { "name": "Scheelite", "start": 1.92 }, { "name": "Selenium, Amorphous", "start": 2.92 }, { "name": "Serpentine", "start": 1.56 }, { "name": "Shampoo", "start": 1.362 }, { "name": "Shell", "start": 1.53 }, { "name": "Shower gell", "start": 1.51 }, { "name": "Silicon", "start": 4.01, "stop": 4.24 }, { "name": "Sillimanite", "start": 1.658 }, { "name": "Silver", "start": 0.18, "stop": 1.35 }, { "name": "Sinhalite", "start": 1.699 }, { "name": "Smaragdite", "start": 1.608 }, { "name": "Smithsonite", "start": 1.621 }, { "name": "Sodalite", "start": 1.483 }, { "name": "Sodium Chloride", "start": 1.544, "stop": 1.644 }, { "name": "Spessarite", "start": 1.79, "stop": 1.81 }, { "name": "Sphalerite", "start": 2.368 }, { "name": "Sphene", "start": 1.885 }, { "name": "Spinel", "start": 1.712, "stop": 1.717 }, { "name": "Spinel, Blue", "start": 1.712, "stop": 1.747 }, { "name": "Spinel, Red", "start": 1.708, "stop": 1.735 }, { "name": "Spodumene", "start": 1.65 }, { "name": "Star Ruby", "start": 1.76, "stop": 1.773 }, { "name": "Staurolite", "start": 1.739 }, { "name": "Steatite", "start": 1.539 }, { "name": "Steel", "start": 2.5 }, { "name": "Stichtite", "start": 1.52 }, { "name": "Strontium Titanate", "start": 2.41 }, { "name": "Styrene", "start": 1.519 }, { "name": "Styrofoam", "start": 1.595 }, { "name": "Sugar Solution 30%", "start": 1.38 }, { "name": "Sugar Solution 80%", "start": 1.49 }, { "name": "Sulphur", "start": 1.96 }, { "name": "Synthetic Spinel", "start": 1.73 }, { "name": "Taaffeite", "start": 1.72 }, { "name": "Tantalite", "start": 2.24 }, { "name": "Tanzanite", "start": 1.692, "stop": 1.7 }, { "name": "Teflon", "start": 1.35, "stop": 1.38 }, { "name": "Thomsonite", "start": 1.53 }, { "name": "Tiger eye", "start": 1.544 }, { "name": "Tin Iodide", "start": 2.106 }, { "name": "Titanium", "start": 2.16 }, { "name": "Topaz", "start": 1.607, "stop": 1.627 }, { "name": "Topaz, Blue", "start": 1.61 }, { "name": "Topaz, Imperial", "start": 1.605, "stop": 1.64 }, { "name": "Topaz, Pink", "start": 1.62 }, { "name": "Topaz, White", "start": 1.63 }, { "name": "Topaz, Yellow", "start": 1.62 }, { "name": "Tourmaline", "start": 1.603, "stop": 1.655 }, { "name": "Tourmaline, Blue", "start": 1.61, "stop": 1.64 }, { "name": "Tourmaline, Catseye", "start": 1.61, "stop": 1.64 }, { "name": "Tourmaline, Green", "start": 1.61, "stop": 1.64 }, { "name": "Tourmaline, Paraiba", "start": 1.61, "stop": 1.65 }, { "name": "Tourmaline, Red", "start": 1.61, "stop": 1.64 }, { "name": "Tremolite", "start": 1.6 }, { "name": "Tugtupite", "start": 1.496 }, { "name": "Turpentine", "start": 1.472 }, { "name": "Turquoise", "start": 1.61, "stop": 1.65 }, { "name": "Ulexite", "start": 1.49 }, { "name": "Uvarovite", "start": 1.87 }, { "name": "Vacuum", "start": 1.0 }, { "name": "Variscite", "start": 1.55 }, { "name": "Vivianite", "start": 1.58 }, { "name": "Vodka", "start": 1.363 }, { "name": "Wardite", "start": 1.59 }, { "name": "Water (0deg C)", "start": 1.333 }, { "name": "Water (100deg C)", "start": 1.318 }, { "name": "Water (20deg C)", "start": 1.333 }, { "name": "Water (35deg C)", "start": 1.325 }, { "name": "Water (gas)", "start": 1.0 }, { "name": "Water Ice", "start": 1.31 }, { "name": "Whisky", "start": 1.356 }, { "name": "Wulfenite", "start": 2.3 }, { "name": "Zinc Crown Glass", "start": 1.517 }, { "name": "Zincite", "start": 2.01 }, { "name": "Zircon", "start": 1.777, "stop": 1.987 }, { "name": "Zircon, High", "start": 1.96 }, { "name": "Zircon, Low", "start": 1.8 }, { "name": "Zirconia, Cubic", "start": 2.173, "stop": 2.21 } ] This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -1,1229 +1,63 @@ // 0.2 - Slightly Less Ugly // Now loads the config from an external JSON file that must be // stored as IOR.json in the same directory as the script. function loadConfig() { var info = DzFileInfo(getScriptFileName()); print("Path: "+info.path()); print("Base: "+info.baseName()); var sConfigName = info.path()+"/IOR.json"; var fConfigFile = DzFile( sConfigName ); if (! fConfigFile.exists()) return false; fConfigFile.open(DzFile.ReadOnly); var sJSONConfig = fConfigFile.read(); fConfigFile.close(); var obj = JSON.parse( sJSONConfig ); return obj; } var materials = loadConfig(); var wDlg = new DzBasicDialog; wDlg.caption = "Set Material IOR"; wDlg.whatsThis = "Set the IOR for Iray material."; // Create a label var wLbl = new DzLabel( wDlg ); wLbl.text = "Choose a material."; wLbl.whatsThis = "This is the \"What\'s This?\" text for the label."; wDlg.addWidget( wLbl ); var wCbFiSu = new DzComboBox( wDlg ); var numMat = materials.length; print("numMat "+numMat); for (var i = 0; i < numMat; i++) { if (materials[i].hasOwnProperty("name")) { wCbFiSu.insertItem(materials[i].name); } } if (materials[0].hasOwnProperty("name")) { wCbFiSu.currentItem = materials[0].name; } wDlg.addWidget(wCbFiSu) // Limit the dialog size to the minimum required size wDlg.maxWidth = wDlg.minWidth; wDlg.maxHeight = wDlg.minHeight; // Launch the dialog and do something depending on the button pressed if( wDlg.exec() ) { var i = wCbFiSu.currentItem; if (materials[i].hasOwnProperty("start")) { var o = materials[i]; } var skel = Scene.getPrimarySelection(); if ( skel ) { if ( skel.inherits( "DzBone" ) ) { skel = skel.getSkeleton(); @@ -1245,8 +79,8 @@ if( wDlg.exec() ) ior.setValue(o.start); } else { var ior = curMat.findProperty("Index of Refraction"); if (ior) { var iorVal = ior.getValue(); ior.setValue(o.start); } @@ -1272,23 +106,29 @@ if( wDlg.exec() ) var iorVal = ior.getValue(); ior.setValue(o.start); } else { var ior = curMat.findProperty("Index of Refraction"); if (ior) { var iorVal = ior.getValue(); ior.setValue(o.start); } } } } } } } } var message = ""; if (o.hasOwnProperty("stop")) { message = o.name + " " + o.start + " " + o.stop; } else { message = o.name + " " + o.start; } MessageBox.information( message, "Information", "&OK" ); } else { MessageBox.information( "Dialog rejected.", "Information", "&OK" ); } -
esemwy revised this gist
Jun 17, 2015 . 1 changed file with 42 additions and 19 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -1224,33 +1224,56 @@ if( wDlg.exec() ) var skel = Scene.getPrimarySelection(); if ( skel ) { if ( skel.inherits( "DzBone" ) ) { skel = skel.getSkeleton(); } if ( skel.inherits( "DzNode") ) { var obj = skel.getObject(); // var shp = obj.getCurrentShape(); var numShapes = obj.getNumShapes(); for ( var i = 0; i < numShapes; i++ ) { var shp = obj.getShape(i); var numMats = shp.getNumMaterials(); for ( var i = 0; i < numMats; i++ ) { var curMat = shp.getMaterial( i ); if ( curMat && curMat.isSelected() ) { var matName = curMat.getMaterialName(); var ior = curMat.findProperty("Refraction Index"); if (ior) { var iorVal = ior.getValue(); ior.setValue(o.start); } else { var ior = curMat.findProperty("Index of Refraction"); if (ior) { var iorVal = ior.getValue(); ior.setValue(o.start); } } } } } } else if ( skel.inherits( "DzSkeleton" ) ) { nodelist = [skel]; var nNodes = nodelist.length; for( var i = 0; i < nNodes; i++ ) { var obj = nodelist[i].getObject(); var shp = obj.getCurrentShape(); var numMats = shp.getNumMaterials(); for ( var i = 0; i < numMats; i++ ) { var curMat = shp.getMaterial( i ); if ( curMat && curMat.isSelected() ) { var matName = curMat.getMaterialName(); if (matName == "Iray Uber") { var ior = curMat.findProperty("Refraction Index"); if (ior) { var iorVal = ior.getValue(); ior.setValue(o.start); } } } } } } @@ -1268,4 +1291,4 @@ if( wDlg.exec() ) else { MessageBox.information( "Dialog rejected.", "Information", "&OK" ); } -
esemwy created this gist
Jun 17, 2015 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,1271 @@ // DAZ Studio version 4.8.0.55 filetype DAZ Script materials = { "Acetone": { "start": 1.36 }, "Acrylic glass": { "start": 1.49, "stop": 1.492 }, "Actinolite": { "start": 1.618 }, "Agalmatoite": { "start": 1.55 }, "Agate": { "start": 1.544, "stop": 1.553 }, "Agate, Moss": { "start": 1.54 }, "Air": { "start": 1.0 }, "Alcohol": { "start": 1.329 }, "Alcohol, Ethyl (grain)": { "start": 1.36 }, "Alcohol, Methyl (wood)": { "start": 1.329 }, "Alexandrite": { "start": 1.746, "stop": 1.755 }, "Almandine": { "start": 1.75, "stop": 1.83 }, "Aluminum": { "start": 1.244 }, "Aluminum Chloride": { "start": 2.7 }, "Aluminum Oxide": { "start": 1.665 }, "Amber": { "start": 1.539, "stop": 1.546 }, "Amblygonite": { "start": 1.611 }, "Amethyst": { "start": 1.532, "stop": 1.554 }, "Ammolite": { "start": 1.52, "stop": 1.68 }, "Amorphous Selenium": { "start": 2.92 }, "Anatase": { "start": 2.49 }, "Andalusite": { "start": 1.629, "stop": 1.65 }, "Anhydrite": { "start": 1.571 }, "Apatite": { "start": 1.42, "stop": 1.632 }, "Apophyllite": { "start": 1.536 }, "Aquamarine": { "start": 1.567, "stop": 1.59 }, "Aragonite": { "start": 1.53 }, "Argon": { "start": 1.0 }, "Argonite": { "start": 1.53 }, "Asphalt": { "start": 1.635 }, "Augelite": { "start": 1.574 }, "Axenite": { "start": 1.674, "stop": 1.704 }, "Axinite": { "start": 1.675 }, "Azurite": { "start": 1.73 }, "Barite": { "start": 1.636 }, "Barytocalcite": { "start": 1.684 }, "Beer": { "start": 1.345 }, "Benitoite": { "start": 1.757 }, "Benzene": { "start": 1.501 }, "Beryl": { "start": 1.57, "stop": 1.6 }, "Beryl, Red": { "start": 1.57, "stop": 1.598 }, "Beryllonite": { "start": 1.553 }, "Borax": { "start": 1.446 }, "Brazilianite": { "start": 1.603 }, "Bromine (liquid)": { "start": 1.661 }, "Bronze": { "start": 1.18 }, "Brownite": { "start": 1.567 }, "Calcite": { "start": 1.486 }, "Calspar": { "start": 1.486, "stop": 1.66 }, "Cancrinite": { "start": 1.491 }, "Carbon Disulfide": { "start": 1.628, "stop": 1.63 }, "Carbon Tetrachloride": { "start": 1.46 }, "Carbon dioxide": { "start": 1.0 }, "Carbonated Beverages": { "start": 1.34, "stop": 1.356 }, "Cassiterite": { "start": 1.997 }, "Celestite": { "start": 1.622 }, "Cerussite": { "start": 1.804 }, "Ceylanite": { "start": 1.77 }, "Chalcedony": { "start": 1.544, "stop": 1.553 }, "Chalk": { "start": 1.51 }, "Chalybite": { "start": 1.63 }, "Chlorine (gas)": { "start": 1.001 }, "Chlorine (liquid)": { "start": 1.385 }, "Chrome Green": { "start": 2.4 }, "Chrome Red": { "start": 2.42 }, "Chrome Tourmaline": { "start": 1.61, "stop": 1.64 }, "Chrome Yellow": { "start": 2.31 }, "Chromium": { "start": 2.97 }, "Chromium Oxide": { "start": 2.705 }, "Chrysoberyl": { "start": 1.745 }, "Chrysocolla": { "start": 1.5 }, "Chrysoprase": { "start": 1.534 }, "Cinnabar (Mercury sulfide)": { "start": 3.02 }, "Citrine": { "start": 1.532, "stop": 1.554 }, "Cleaner (all purpose - orange)": { "start": 1.293 }, "Clinohumite": { "start": 1.625, "stop": 1.675 }, "Clinozoisite": { "start": 1.724 }, "Cobalt Blue": { "start": 1.74 }, "Cobalt Green": { "start": 1.97 }, "Cobalt Violet": { "start": 1.71 }, "Colemanite": { "start": 1.586 }, "Copper": { "start": 1.1, "stop": 2.43 }, "Copper Oxide": { "start": 2.705 }, "Coral": { "start": 1.486, "stop": 1.658 }, "Cordierite": { "start": 1.54 }, "Corundum": { "start": 1.766 }, "Cranberry Juice (25%)": { "start": 1.351 }, "Crocoite": { "start": 2.31 }, "Cromite": { "start": 2.16 }, "Crown Glass": { "start": 1.52 }, "Crown glass (impure)": { "start": 1.485, "stop": 1.755 }, "Crown glass (pure)": { "start": 1.5, "stop": 1.54 }, "Cryolite": { "start": 1.338 }, "Crysoberyl, Catseye": { "start": 1.746, "stop": 1.755 }, "Crystal": { "start": 2.0 }, "Cubic zirconia": { "start": 2.15, "stop": 2.18 }, "Cuprite": { "start": 2.85 }, "Danburite": { "start": 1.627, "stop": 1.641 }, "Diamond": { "start": 2.418 }, "Diopside": { "start": 1.68 }, "Dolomite": { "start": 1.503 }, "Dumortierite": { "start": 1.686 }, "Ebonite": { "start": 1.66 }, "Ekanite": { "start": 1.6 }, "Elaeolite": { "start": 1.532 }, "Emerald": { "start": 1.56, "stop": 1.605 }, "Emerald Catseye": { "start": 1.56, "stop": 1.605 }, "Emerald, Synth flux": { "start": 1.561 }, "Emerald, Synth hydro": { "start": 1.568 }, "Enstatite": { "start": 1.663 }, "Epidote": { "start": 1.733 }, "Ethanol": { "start": 1.36 }, "Ethyl Alcohol": { "start": 1.36 }, "Euclase": { "start": 1.652 }, "Eye, Aqueous humor": { "start": 1.33 }, "Eye, Cornea": { "start": 1.38 }, "Eye, Lens": { "start": 1.41 }, "Eye, Vitreous humor": { "start": 1.34 }, "Fabulite": { "start": 2.409 }, "Feldspar, Adventurine": { "start": 1.532 }, "Feldspar, Albite": { "start": 1.525 }, "Feldspar, Amazonite": { "start": 1.525 }, "Feldspar, Labradorite": { "start": 1.565 }, "Feldspar, Microcline": { "start": 1.525 }, "Feldspar, Oligoclase": { "start": 1.539 }, "Feldspar, Orthoclase": { "start": 1.525 }, "Flint glass (impure)": { "start": 1.523, "stop": 1.925 }, "Flint glass (pure)": { "start": 1.6, "stop": 1.62 }, "Flourite": { "start": 1.433 }, "Fluoride": { "start": 1.56 }, "Fluorite": { "start": 1.434 }, "Formica": { "start": 1.47 }, "Fused Quartz": { "start": 1.46 }, "Gallium(III) arsenide": { "start": 3.927 }, "Gallium(III) phosphide": { "start": 3.5 }, "Garnet, Almandine": { "start": 1.76 }, "Garnet, Almandite": { "start": 1.79 }, "Garnet, Andradite": { "start": 1.82 }, "Garnet, Demantiod": { "start": 1.88, "stop": 1.9 }, "Garnet, Grossular": { "start": 1.72, "stop": 1.8 }, "Garnet, Hessonite": { "start": 1.745 }, "Garnet, Mandarin": { "start": 1.79, "stop": 1.8 }, "Garnet, Pyrope": { "start": 1.73, "stop": 1.76 }, "Garnet, Rhodolite": { "start": 1.74, "stop": 1.77 }, "Garnet, Spessartite": { "start": 1.81 }, "Garnet, Tsavorite": { "start": 1.739, "stop": 1.744 }, "Garnet, Uvarovite": { "start": 1.74, "stop": 1.87 }, "Gaylussite": { "start": 1.517 }, "Glass": { "start": 1.5 }, "Glass, Albite": { "start": 1.489 }, "Glass, Arsenic Trisulfide": { "start": 2.04 }, "Glass, Crown": { "start": 1.52 }, "Glass, Crown, Zinc": { "start": 1.517 }, "Glass, Flint, 29% lead": { "start": 1.569 }, "Glass, Flint, 55% lead": { "start": 1.669 }, "Glass, Flint, 71% lead": { "start": 1.805 }, "Glass, Flint, Dense": { "start": 1.66 }, "Glass, Flint, Heaviest": { "start": 1.89 }, "Glass, Flint, Heavy": { "start": 1.655 }, "Glass, Flint, Lanthanum": { "start": 1.8 }, "Glass, Flint, Light": { "start": 1.58 }, "Glass, Flint, Medium": { "start": 1.627 }, "Glass, Fused Silica": { "start": 1.459 }, "Glass, Pyrex": { "start": 1.474 }, "Glycerine": { "start": 1.473 }, "Glycerol": { "start": 1.473 }, "Gold": { "start": 0.47 }, "Gypsium": { "start": 1.519 }, "Hambergite": { "start": 1.559 }, "Hauyn": { "start": 1.49, "stop": 1.505 }, "Hauynite": { "start": 1.502 }, "Heaviest Flint Glass": { "start": 1.89 }, "Heavy Flint Glass": { "start": 1.65 }, "Helium": { "start": 1.0 }, "Hematite": { "start": 2.94 }, "Hemimorphite": { "start": 1.614 }, "Hiddenite": { "start": 1.655 }, "Honey, 13% water content": { "start": 1.504 }, "Honey, 17% water content": { "start": 1.494 }, "Honey, 21% water content": { "start": 1.484 }, "Howlite": { "start": 1.586 }, "Hydrogen (gas)": { "start": 1.0 }, "Hydrogen (liquid)": { "start": 1.097 }, "Hypersthene": { "start": 1.67 }, "Ice": { "start": 1.309 }, "Idocrase": { "start": 1.713 }, "Iodine Crystal": { "start": 3.34 }, "Iolite": { "start": 1.522, "stop": 1.578 }, "Iron": { "start": 2.95 }, "Ivory": { "start": 1.54 }, "Jade, Jadeite": { "start": 1.64, "stop": 1.667 }, "Jade, Nephrite": { "start": 1.6, "stop": 1.641 }, "Jadeite": { "start": 1.665 }, "Jasper": { "start": 1.54 }, "Jet": { "start": 1.66 }, "Kornerupine": { "start": 1.665 }, "Kunzite": { "start": 1.66, "stop": 1.676 }, "Kyanite": { "start": 1.715 }, "Labradorite": { "start": 1.56, "stop": 1.572 }, "Lapis Gem": { "start": 1.5 }, "Lapis Lazuli": { "start": 1.5, "stop": 1.55 }, "Lazulite": { "start": 1.615 }, "Lead": { "start": 2.01 }, "Lead Nitrate": { "start": 1.782 }, "Leucite": { "start": 1.509 }, "Light Flint Glass": { "start": 1.575 }, "Liquid Carbon Dioxide": { "start": 1.2 }, "Liquid Water (20deg C)": { "start": 1.333 }, "Lucite": { "start": 1.495 }, "Magnesite": { "start": 1.515 }, "Malachite": { "start": 1.655 }, "Meerschaum": { "start": 1.53 }, "Mercury (liquid)": { "start": 1.62 }, "Methanol": { "start": 1.329 }, "Milk": { "start": 1.35 }, "Moissanite": { "start": 2.65, "stop": 2.69 }, "Moldavite": { "start": 1.5 }, "Moonstone": { "start": 1.518, "stop": 1.526 }, "Moonstone, Adularia": { "start": 1.525 }, "Moonstone, Albite": { "start": 1.535 }, "Morganite": { "start": 1.585, "stop": 1.594 }, "Mylar": { "start": 1.65 }, "Natrolite": { "start": 1.48 }, "Nephrite": { "start": 1.6 }, "Nickel": { "start": 1.08 }, "Nitrogen (gas)": { "start": 1.0 }, "Nitrogen (liq)": { "start": 1.205 }, "Nylon": { "start": 1.53 }, "Obsidian": { "start": 1.489, "stop": 1.5 }, "Oil of Wintergreen": { "start": 1.536 }, "Oil, Clove": { "start": 1.535 }, "Oil, Lemon": { "start": 1.481 }, "Oil, Neroli": { "start": 1.482 }, "Oil, Orange": { "start": 1.473 }, "Oil, Safflower": { "start": 1.466 }, "Oil, vegetable (50deg C)": { "start": 1.47 }, "Olivine": { "start": 1.67 }, "Onyx": { "start": 1.486 }, "Onyx Marble": { "start": 1.486 }, "Opal": { "start": 1.45 }, "Opal, Black": { "start": 1.44, "stop": 1.46 }, "Opal, Fire": { "start": 1.43, "stop": 1.46 }, "Opal, White": { "start": 1.44, "stop": 1.46 }, "Oregon Sunstone": { "start": 1.56, "stop": 1.572 }, "Oxygen (gas)": { "start": 1.0 }, "Oxygen (liquid)": { "start": 1.221 }, "PET": { "start": 1.575 }, "PETg": { "start": 1.57 }, "PMMA": { "start": 1.489, "stop": 1.49 }, "Padparadja": { "start": 1.76, "stop": 1.773 }, "Painite": { "start": 1.787 }, "Pearl": { "start": 1.53, "stop": 1.69 }, "Periclase": { "start": 1.74 }, "Peristerite": { "start": 1.525 }, "Petalite": { "start": 1.502 }, "Phenakite": { "start": 1.65 }, "Phosgenite": { "start": 2.117 }, "Plastic": { "start": 1.46 }, "Platinum": { "start": 2.33 }, "Plexiglas": { "start": 1.5 }, "Polycarbonate": { "start": 1.584 }, "Polystyrene": { "start": 1.55 }, "Prase": { "start": 1.54 }, "Prasiolite": { "start": 1.54 }, "Prehnite": { "start": 1.61 }, "Proustite": { "start": 2.79 }, "Purpurite": { "start": 1.84 }, "Pyrite": { "start": 1.81 }, "Pyrope": { "start": 1.74 }, "Quartz": { "start": 1.544, "stop": 1.644 }, "Quartz, Fused": { "start": 1.458 }, "Rhodizite": { "start": 1.69 }, "Rhodochrisite": { "start": 1.6 }, "Rhodonite": { "start": 1.735 }, "Rock salt": { "start": 1.516, "stop": 1.544 }, "Rubber, Natural": { "start": 1.519 }, "Ruby": { "start": 1.757, "stop": 1.779 }, "Rum, White": { "start": 1.361 }, "Rutile": { "start": 2.62 }, "Salt (NaCl)": { "start": 1.544 }, "Sanidine": { "start": 1.522 }, "Sapphire": { "start": 1.757, "stop": 1.779 }, "Sapphire, Star": { "start": 1.76, "stop": 1.773 }, "Scapolite": { "start": 1.54 }, "Scapolite, Yellow": { "start": 1.555 }, "Scheelite": { "start": 1.92 }, "Selenium, Amorphous": { "start": 2.92 }, "Serpentine": { "start": 1.56 }, "Shampoo": { "start": 1.362 }, "Shell": { "start": 1.53 }, "Shower gell": { "start": 1.51 }, "Silicon": { "start": 4.01, "stop": 4.24 }, "Sillimanite": { "start": 1.658 }, "Silver": { "start": 0.18, "stop": 1.35 }, "Sinhalite": { "start": 1.699 }, "Smaragdite": { "start": 1.608 }, "Smithsonite": { "start": 1.621 }, "Sodalite": { "start": 1.483 }, "Sodium Chloride": { "start": 1.544, "stop": 1.644 }, "Spessarite": { "start": 1.79, "stop": 1.81 }, "Sphalerite": { "start": 2.368 }, "Sphene": { "start": 1.885 }, "Spinel": { "start": 1.712, "stop": 1.717 }, "Spinel, Blue": { "start": 1.712, "stop": 1.747 }, "Spinel, Red": { "start": 1.708, "stop": 1.735 }, "Spodumene": { "start": 1.65 }, "Star Ruby": { "start": 1.76, "stop": 1.773 }, "Staurolite": { "start": 1.739 }, "Steatite": { "start": 1.539 }, "Steel": { "start": 2.5 }, "Stichtite": { "start": 1.52 }, "Strontium Titanate": { "start": 2.41 }, "Styrene": { "start": 1.519 }, "Styrofoam": { "start": 1.595 }, "Sugar Solution 30%": { "start": 1.38 }, "Sugar Solution 80%": { "start": 1.49 }, "Sulphur": { "start": 1.96 }, "Synthetic Spinel": { "start": 1.73 }, "Taaffeite": { "start": 1.72 }, "Tantalite": { "start": 2.24 }, "Tanzanite": { "start": 1.692, "stop": 1.7 }, "Teflon": { "start": 1.35, "stop": 1.38 }, "Thomsonite": { "start": 1.53 }, "Tiger eye": { "start": 1.544 }, "Tin Iodide": { "start": 2.106 }, "Titanium": { "start": 2.16 }, "Topaz": { "start": 1.607, "stop": 1.627 }, "Topaz, Blue": { "start": 1.61 }, "Topaz, Imperial": { "start": 1.605, "stop": 1.64 }, "Topaz, Pink": { "start": 1.62 }, "Topaz, White": { "start": 1.63 }, "Topaz, Yellow": { "start": 1.62 }, "Tourmaline": { "start": 1.603, "stop": 1.655 }, "Tourmaline, Blue": { "start": 1.61, "stop": 1.64 }, "Tourmaline, Catseye": { "start": 1.61, "stop": 1.64 }, "Tourmaline, Green": { "start": 1.61, "stop": 1.64 }, "Tourmaline, Paraiba": { "start": 1.61, "stop": 1.65 }, "Tourmaline, Red": { "start": 1.61, "stop": 1.64 }, "Tremolite": { "start": 1.6 }, "Tugtupite": { "start": 1.496 }, "Turpentine": { "start": 1.472 }, "Turquoise": { "start": 1.61, "stop": 1.65 }, "Ulexite": { "start": 1.49 }, "Uvarovite": { "start": 1.87 }, "Vacuum": { "start": 1.0 }, "Variscite": { "start": 1.55 }, "Vivianite": { "start": 1.58 }, "Vodka": { "start": 1.363 }, "Wardite": { "start": 1.59 }, "Water (0deg C)": { "start": 1.333 }, "Water (100deg C)": { "start": 1.318 }, "Water (20deg C)": { "start": 1.333 }, "Water (35deg C)": { "start": 1.325 }, "Water (gas)": { "start": 1.0 }, "Water Ice": { "start": 1.31 }, "Whisky": { "start": 1.356 }, "Wulfenite": { "start": 2.3 }, "Zinc Crown Glass": { "start": 1.517 }, "Zincite": { "start": 2.01 }, "Zircon": { "start": 1.777, "stop": 1.987 }, "Zircon, High": { "start": 1.96 }, "Zircon, Low": { "start": 1.8 }, "Zirconia, Cubic": { "start": 2.173, "stop": 2.21 } }; var wDlg = new DzBasicDialog; wDlg.caption = "My DzBasicDialog"; wDlg.whatsThis = "This is the \"What\'s This?\" text for the dialog."; // Create a label var wLbl = new DzLabel( wDlg ); wLbl.text = "This is a DzLabel."; wLbl.whatsThis = "This is the \"What\'s This?\" text for the label."; wDlg.addWidget( wLbl ); var wCbFiSu = new DzComboBox( wDlg ); for (var key in materials) { if (materials.hasOwnProperty(key)) { wCbFiSu.insertItem(key); } } var current = ""; for (current in materials) { if (materials.hasOwnProperty(current)) { break; } } wCbFiSu.currentItem = current; wDlg.addWidget(wCbFiSu) // Limit the dialog size to the minimum required size wDlg.maxWidth = wDlg.minWidth; wDlg.maxHeight = wDlg.minHeight; // Launch the dialog and do something depending on the button pressed if( wDlg.exec() ) { var i = 0; for (var k in materials) { print(i + " " + wCbFiSu.currentItem + " " + k); if (materials.hasOwnProperty(k)) { if (i == wCbFiSu.currentItem) { var o = materials[k]; var b = k; break; } i++; } } var skel = Scene.getPrimarySelection(); //we'll detect users attempting to apply this script to the wrong figure var bFoundSomeMatches = false; if ( skel ) { if ( skel.inherits( "DzBone" ) ) { skel = skel.getSkeleton(); } } if ( skel.inherits( "DzSkeleton" ) ) { nodelist = [skel]; var nNodes = nodelist.length; for( var i = 0; i < nNodes; i++ ) { var obj = nodelist[i].getObject(); var shp = obj.getCurrentShape(); var numMats = shp.getNumMaterials(); for ( var i = 0; i < numMats; i++ ) { var curMat = shp.getMaterial( i ); if ( curMat && curMat.isSelected() ) { var matName = curMat.getMaterialName(); if (matName == "Iray Uber") { var ior = curMat.findProperty("Refraction Index"); if (ior) { var iorVal = ior.getValue(); ior.setValue(o.start); } } } } } } var message = ""; if (o.hasOwnProperty("stop")) { message = b + " " + o.start + " " + o.stop; } else { message = b + " " + o.start; } MessageBox.information( message, "Information", "&OK" ); } else { MessageBox.information( "Dialog rejected.", "Information", "&OK" ); }