1
$\begingroup$

I am trying to do a material study, and I would like to print the Principled BDSF values onto the render.

Previously I had found this: How to show render-stamp for arbitrary values?

It had worked, but the data path I get when I right click the roughness parameter for the Principled BDSF is: nodes["Principled BSDF"].inputs[7].default_value

That doesn't seem to work the same way.

here is the script:

 import bpy def stamp_set(scene): note = "Samples: " + str(scene.cycles.samples) note += ", Bounces, Max: " + str(scene.cycles.max_bounces) note += ", roughness: " + str(nodes["Principled BSDF"].inputs[7].default_value) note += ", Version: " + bpy.app.version_string scene.render.stamp_note_text = note bpy.app.handlers.render_pre.append(stamp_set) 

I also tried, cycles.nodes["Principled BSDF"].inputs[7].default_value

and

scene.nodes["Principled BSDF"].inputs[7].default_value

I get an error in the terminal that these are undefined (I think).

SO, how would I go about doing this?

thanks,

eh five

$\endgroup$
2
  • $\begingroup$ I can't really tell, does this help? blender.stackexchange.com/questions/101929/… $\endgroup$ Commented Oct 20, 2018 at 16:21
  • $\begingroup$ I can't tell either, although the links in those questions did seem in the right direction. $\endgroup$ Commented Oct 20, 2018 at 20:13

1 Answer 1

3
$\begingroup$

I found a solution with various references. The big thing that helped was finding how to enter the value for a Principled BSDF parameter in the console;

bpy.data.materials['Material'].node_tree.nodes["Principled BSDF"].inputs[1].default_value = 3 

Mostly from here:

Change value of material emission strength from Python console or script

The final script looks like this (input 7 is Roughness):

import bpy def stamp_set(scene): note = "Samples: " + str(scene.cycles.samples) note += ", Bounces, Max: " + str(scene.cycles.max_bounces) note += ", Roughness: " + str(round(bpy.data.materials['Material'].node_tree.nodes["Principled BSDF"].inputs[7].default_value, 3)) note += ", Version: " + bpy.app.version_string scene.render.stamp_note_text = note bpy.app.handlers.render_pre.append(stamp_set) 

ref:

Editing Lamp Strength with Python

Change value of sun light emission strength from Python console or script

decreasing excess precision:

How to show render-stamp for arbitrary values?

-snaok

$\endgroup$

You must log in to answer this question.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.