[Addon] IOR Values - A searchable list of 247 indeces of refraction


Properties -> Material -> IOR Values
List size: 247

To use it, simply type your query into the search box, example: “oxygen”, and possible matches will automatically be listed, and further narrowed the more you type. Once you’ve found a match, clicking it will return its IOR value in the “IOR” field. If “Copy to SSS” is enabled (which it is by default), it will automatically change the value of the Subsurface Scattering IOR to this value, but only if Subsurface Scattering is also enabled.

NOTE: I created the list of IOR values from online sources. If you notice any errors, or can suggest additions for the list, please leave me a comment. :slight_smile:

A wiki page would have been created, and this uploaded sooner, but currently there is no “Materials” category in the Wiki catalog. I’ve asked if I would be allowed to add this category, but I’ve not heard back from anyone yet. If I’m allowed to, I’ll do so and make a page for this addon. I’d rather not do it without permission! :slight_smile:

Bug Track page
Download

I hope you find it useful! :slight_smile:

My personal Twitterhttp://misc.cgcookie.netdna-cdn.com//pencil.png

Thanx Aaron , very useful I’ll give it a try.

That should be very usefull, thanks

really nice addon, Aaron!

i wondered if a dictionary would be faster for search, so i tried this:
http://www.pasteall.org/32487/python

also stripped row.alignment = ‘EXPAND’ from your code, as this is the default value anyway

well, it seems to be slightly faster, but doesn’t make much of difference

Hiya!

I’m still getting used to the Blender UI stuff, but I guess I should have noticed the alignment though! xD

Thank you for taking the time to look at the code, and turn it into a dictionary. I appreciate how long it can take! I’ve had a look through it and, as you say, it doesn’t seem to make a noticeable difference. However, I might keep it that way! :slight_smile:

Thanks again, and I hope it does prove useful. I know Google is there if anyone needs IOR values, but I thought this may prove a good convenience. So far, so good!

made the buttons more compact:

http://www.pasteall.org/32511/python

Thanks!

Adding the “Results” label is a good addition too. I’ve been thinking; I said I “might” keep it as a dictionary, but a dictionary is better suited to this. Plus, they are afterall easier to search through than lists and tuples. So, you’re changes are in! :smiley:

I’ll give it another few days or so, just incase anything else can be done. I still need to look through the code again myself. The last time I looked was the day before I posted and uploaded it. :stuck_out_tongue:

EDIT: Not “display”- the addon wasn’t copying the value to SSS in Material Nodes Editor. Now it does! lol I just woke up a few minutes ago, please forgive my stupidity! :frowning:

Howdy!

I noticed it wasn’t copying the IOR value when in Materials Node Editor, so now it does! Also, I condensed the code that does active material checking when doing this; getting rid of “bpy…” and going straight to “context.material”. Plus, I’ve kept CoDEmanX’s changes in there, as I think they’ve definitely improved it.

We live and learn! :stuck_out_tongue:

I’ll upload it to Tracker when it decides to stop timing out.

Attachments

materials_ior_values-v0-1-2-update1.zip (4.14 KB)

I tried that latest update, the IOR panel isn’t displayed when nodes are actived either with cycles or blender internal (tested on blender 2.63 and yesterday’s SVN)

Hiya,

Do you have a material on the object? When you click for a new material all the Diffuse, Specular, etc will be displayed, along with the IOR Values.

I’ll be uploading a new version of it soon anyway. I’ve made it more compliant to pep8 specification (if you know what that means xD), as well as making it more efficient during its search.

Another little update/upgrade.

  • Gone through the code and made it as pep8 compliant as possible
  • Added link to the Tracker (User Prefs > Addons > IOR Values > Report a bug)
  • Increased search performance

For anyone wondering, probably CoDEmanX ;), I changed the search FOR loop by using startswith() instead of slicing. This will definitely increase performance, as I know string operations can be intensive, especially in big loops, and moreso for big manipulations.

Anyway, I’m not sure how much better this thing can get, apart from adding to the dictionary, but we’ll see!:wink:

Attachments

materials_ior_values-v0-1-3.zip (4.16 KB)

It works for ‘regular’ blender materials.
But as soon as you activate the shader nodes or switch to Cycles, then it won’t show up.
Or maybe I missed something ?

Hiya,

Take a quick look at the image I’ve attached. If that’s what you see, then the addon won’t show because there is no material on the selected object (Node <none>). :wink:
To add the new material, either hit the + button, or go to the node editor and click “New” on the material node. As soon as you’ve done this, the addon should show up.
It’s displayed along with the Diffuse, Specular, … panels. If those panels are showing, and the addon still isn’t, try expanding/collapsing a panel. If it still doesn’t show, then we have a problem! :stuck_out_tongue:

I’ve tried it out myself, and it works in both “normal” material mode and Materials Node Editor, as well as Cycles.

If the problem persists, I’ll take a deeper look at it, but it just sounds like you haven’t added a new material. :slight_smile:

Attachments


Nice! Believe it or not, i thought about trying startswith instead of slicing today when i went to university :smiley:

And i love everyone who does PEP8! I’m code aesthete (others would call it pendantic ;))

I’ve just realized that there are no addon categories for materials, textures and stuff… maybe put it into Object? (looks weird this colon in front of “: IOR Values”)

Haha!

I’ve only just found out about pep8. Only a few minor changes to my coding style, so no biggy - like using spaces instead of tabs! >.<

Yeah, the lack of a “Materials” category is holding it back some. I can’t do a Wiki page! I’m continuing to ask people if I’m allowed to add the category to the Wiki. So I might have a page up sometime.
As for Blender itself, the closest category would be “Render”, wouldn’t it? Well, where ever I put it it’ll be out of place! lol I completely understand and agree with what you’re saying, though. I needs me some answers, about the Wiki, at least! :slight_smile:

Thanks again for your help. It’s a much better little addon now! :smiley:

Howdy!

The only real change I’ve made is the “No matches found” message, which was an operator (clickable) and is now a label. I also updated the Tracker page, listing all the changes that have been made and uploaded the current version. :slight_smile:

Bug tracker
Download

Oh, my bad, I think I understood the cause of my confusion.
With blender internal it works as intended indeed, I simply forgot to select the material in the node editor.

However, with Cycles I still think there’s a problem.
If you create a new material directly within Cycles, the IOR values aren’t displayed.
For that, you have to create the material in blender internal, then switch back to Cycles.
That’s an unnecessary step and moreover, you end up with a mix of internal and Cycles in the node editor, which doesn’t seem right (cf. screenshot).


ooh!

I’ll look into that! Thanks for letting me know.

I think I’ve fixed the problem now! :slight_smile:

I’ve just added a check for the render engine being used, and do different active material checks based on that.

Let me know if that has indeed fixed the problem, you never know! :wink:

Download

Almost there !
The ‘copy to sss’ option is not compatible with Cycles, even when not checked.

Traceback (most recent call last):
  File "/home/charles/.blender/2.63/scripts/addons/materials_ior_values.py", line 392, in execute
    subss = mat.active_node_material.subsurface_scattering
AttributeError: 'NoneType' object has no attribute 'subsurface_scattering'

Apart from that, it seems to work like a charm, thanks for the update.