21
$\begingroup$

Is it possible to take arbitrary properties and display them in the render stamp as some other software do.

enter image description here (Click the image for larger version)

$\endgroup$
24
$\begingroup$

While Blender has no build-in support for this feature. You can do this using Python:

Add a script into your file, call it stamp_init.py (for example).

  • Press Run Script (only need to do once)
  • Enable the Register option in the text editor (so it runs automatically)

Here is a sample script.

import bpy

def stamp_set(scene):
    note =    "Samples: "         + str(scene.cycles.samples)
    note += ", ApertireBlades: "  + str(scene.camera.data.cycles.aperture_blades)
    note += ", Version: "         + bpy.app.version_string
    scene.render.stamp_note_text = note

bpy.app.handlers.render_pre.append(stamp_set)

To add more settings you can find the data-paths to them by right clicking and selecting Copy Data-Path.

Stamp image

Global Stamp (applies to any file you render)

Having to define a script in every-file could be tedious, if you want to use these extra stamp options in all your files, you can make this a persistent handler.

If you want to have the same stamp notes apply to all your renders (where the Note is enabled). You can add the same script into your startup file and

@bpy.app.handlers.persistent
def stamp_set(scene):
    .... same as before ...

String Formatting (further reading if you're new to Python)

Python has some clever ways you can format strings, see Python docs.

This uses the format method which some people may prefer.

def stamp_set(scene):
    scene.render.stamp_note_text = \
        "Samples: {samples}, Blades: {blades}, Version: {ver}".format(
        samples=scene.cycles.samples,
        blades=scene.camera.data.cycles.aperture_blades,
        ver=bpy.app.version_string,
        )

New Lines

As of 2.77 the note will be wrapped onto new lines, you can also add in explicit \n newline characters to format the text yourself.


Floating point numbers

A lot could be written on this, just a quick hint, if you have unwanted precision removed, eg:2.514000002324 displayed as 2.51, there are a few ways to go about it.

  • If you used "Text " + str(some.number) you can use round, eg:
    "Text " + str(round(some.number, 2))
  • If you use the format() method you can replace:
    {myvar} with {myvar:.2f}.

For more details see https://stackoverflow.com/a/455634/432509

| improve this answer | |
$\endgroup$
  • 1
    $\begingroup$ Thanks for the information! Is it possible to reduce the amount of digits for example Aperture Size (scene.camera.data.cycles.aperture_size) string returns? - Because number 0.55 in the DOF panel returns 0.5499997735023499 $\endgroup$ – Manu Järvinen Mar 24 '15 at 16:31
  • 1
    $\begingroup$ Added hint on reducing excess precision. $\endgroup$ – ideasman42 Mar 24 '15 at 17:39
  • $\begingroup$ Is there a way to do this for values that change over time? For instance, the Lens stamp setting don't update when I change the focal length of the camera. What if I wanted to have a custom note that includes the camera's focal length and change it over time? Would that be possible? $\endgroup$ – Abdelrahman Said Apr 21 at 16:46
  • $\begingroup$ Have a look at the different handlers, after changing the frame might be a good time to run this. $\endgroup$ – ideasman42 Apr 27 at 2:32

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.