I am somehow lost.
Assuming I have a Cube “Cube” with a node-material “Material” with a simple Glass shader, I can’t seem to find my way to access and change the IOR via python.
I am somehow lost.
what are you talking it’s there in latest built
expend the node and you’ll see the IOR button !
show a pic
Hehe, you get that he wants to access the value with a script, right? Python is a very blind snake in that regard… ;D
So, Arexma - when rollover shows ‘Python: blablabla.default_value’, is that a glitch from the developer?
I lol’d - you roam the forum constantly helping people with problems they don’t have - kinda sweet
I thought it was perfectly clear that I want to access the IOR value via python.
That’s not really helping me accessing it as I am a C(++) person and just starting with python and I have no idea how to find my way through the API depths.
I tried to get there via mat=bpy.data.materials.get(“Material”) but from there I didn’t find furhter.
I tried to get there via node=bpy.data.node_groups.get(“Glass BSDF”) but yeah… meh.
in c++ i’d just go
int ior = bpy.data->getMaterial(“Material”)->GetIOR();
Or SetIOR(123) for that matter. And I seem to be unable to find the equivalent in Python and with Blender
IOR = bpy.data.node_groups.get(“Glass BSDF”).inputs.default_value is certainly not working
Hmm, very long time ago, when I did more animations, I sometimes needed obscure values for use in expressions (this was in Softimage, like back in version 3.9, pre XSI, hehe)… So I was never that into scripting or expressions, but I kinda faked my way through it when I needed to, you know. There I used a debug mode where I actually got feedback when manually changing values, then I knew what value to call for in the expression… Now, I don’t need stuff like that in what I do nowadays, but I’m pretty shure you still can do this in Maya. There is no such debug function in Blender? (though if they were you’d probably use that, right, hehe?)
Edit: Sry, I’m not helping, I know. I should have kept my nose out of this… My bad.
I think it’s just a lack of knowledge of, and experience with Blenders datastructure on my side. The solution most likely is trivial, but I rather ask, someone who knows takes 1 min to post the line of code and I can learn from it. Time better spent than digging in the python console the next hour
sorry i miss read your statement
did you check the script in python forum on nodes for cycles
you might find this IOR somewhere in that script
Well, I dunno what’s acceptable here at BA but perhaps a pm to MikeFarny or DingTo asking politely would do the trick, hehe… Who knows better than dev’s, right? ;D
how about this one here
if shader.type=='BSDF_GLASS': shader.inputs['Roughness'].default_value=1-cmat.raytrace_mirror.gloss_factor shader.inputs['IOR'].default_value=cmat.raytrace_transparency.ior
from nodes script for cycles
mat = bpy.data.materials[‘Material’]
mat.node_tree.nodes[‘Glass BSDF’].inputs.default_value = 1.0 # set the value here
bpy.data.materials[‘Material’].node_tree.nodes[‘Glass BSDF’].inputs.default_value = 1.0
works as well.
This simple line helps a lot, opened a knot in my way of looking at the datastructure