Results 1 to 4 of 4
  1. #1
    Member jgstyle's Avatar
    Join Date
    Sep 2006
    Location
    Milwaukee, WI
    Posts
    41

    Addng My Own Property Values To The Notes Render Stamp

    Hi all,


    I'm trying to add my own property values to the Notes in the Metadata stamp when rendering.

    First, I found this answer on Stack Exchange:

    https://blender.stackexchange.com/a/26644

    and while that script does work, inserting my own properties does not. I'm sure I have the syntax wrong, but trying to figure it out has lead me down the rabbit hole of the Python API and I'm even more confused than when I started.

    Here's the code I run in the Text Editor of Blender 2.78c (I receive no errors when this code runs):

    Code:
    import bpy
    
    
    def stamp_set(scene):
        note = "| Displace Strength: "  + str(scene.object.modifiers["Displace"].strength)
        note += "| Midlevel: "  + str(scene.object.modifiers["Displace"].mid_level)
        note += "| Stroke Chaining: "  + str(scene.linestyles["LineStyle"].use_chaining)
        note += "| Stroke Type: "  + str(scene.linestyles["LineStyle"].chaining)
        note += "| Same Object: "  + str(scene.linestyles["LineStyle"].use_same_object)
        note += "| Stroke Caps: "  + str(scene.linestyles["LineStyle"].caps)
        note += "| Base Thickness: "  + str(scene.linestyles["LineStyle"].thickness)
        note += "| Along Stroke Blend Mode: "  + str(scene.linestyles["LineStyle"].thickness_modifiers["Along Stroke"].blend)
        note += "| Along Stroke Mapping: "  + str(scene.linestyles["LineStyle"].thickness_modifiers["Along Stroke"].mapping)
        note += "| Along Stroke Influence: "  + str(scene.linestyles["LineStyle"].thickness_modifiers["Along Stroke"].influence)
        note += "| Along Stroke Min Value: "  + str(scene.linestyles["LineStyle"].thickness_modifiers["Along Stroke"].value_min)
        note += "| Along Stroke Max Value: "  + str(scene.linestyles["LineStyle"].thickness_modifiers["Along Stroke"].value_max)
        note += "| Calligraphy Blend Mode: "  + str(scene.linestyles["LineStyle"].thickness_modifiers["Calligraphy"].blend)
        note += "| Calligraphy Influence: "  + str(scene.linestyles["LineStyle"].thickness_modifiers["Calligraphy"].influence)
        note += "| Calligraphy Orientation: "  + str(scene.linestyles["LineStyle"].thickness_modifiers["Calligraphy"].orientation)
        note += "| Calligraphy Min Thickness: "  + str(scene.linestyles["LineStyle"].thickness_modifiers["Calligraphy"].thickness_min)
        note += "| Calligraphy Max Thickness: "  + str(scene.linestyles["LineStyle"].thickness_modifiers["Calligraphy"].thickness_max)
        note += "| Backbone_Length: "  + str(scene.linestyles["LineStyle"].geometry_modifiers["Backbone Stretcher"].backbone_length)
        note += "| 2D Transform Pivot: "  + str(scene.linestyles["LineStyle"].geometry_modifiers["2D Transform"].pivot)
        note += "| 2D Transform Scale X: "  + str(scene.linestyles["LineStyle"].geometry_modifiers["2D Transform"].scale_x)
        note += "| 2D Transform Scale Y: "  + str(scene.linestyles["LineStyle"].geometry_modifiers["2D Transform"].scale_y)
        note += "| 2D Transform Rotation Angle: "  + str(scene.linestyles["LineStyle"].geometry_modifiers["2D Transform"].angle)
        scene.render.stamp_note_text = note
    
    
    bpy.app.handlers.render_pre.append(stamp_set)
    I did discover that using Copy Data Path doesn't always work, sometimes just inserting the property name and not it's path. So the paths showing in my code were copied from the Info window and modified just a bit to fall in line with the syntax from the Stack Exchange answer.

    The result I get from running this script and then rendering is that none of the above code appears in the Notes field (it is definitely checked on), and only the default properties show in the render stamp.

    Can anyone tell me what's going wrong with my code here?



  2. #2
    Member skywola's Avatar
    Join Date
    Feb 2011
    Location
    Mesa, Arizona, USA
    Posts
    57
    I have no idea what the hell a notes render stamp is, but I ran across this code today while I was reading about how to add properties.
    Whether it will help you or not is beyond me. https://wiki.blender.org/index.php/D..._ID_properties



  3. #3
    Member jgstyle's Avatar
    Join Date
    Sep 2006
    Location
    Milwaukee, WI
    Posts
    41
    LOL skywola.

    thanks much for providing that link. I appreciate it, and that actually will help me down the line.

    regarding the Notes stamp: if you go to your Render tab in the Properties editor, you'll see a section called "Metadata".

    If you activate the "Stamp Output" checkbox here, when you render your scene, Blender will "stamp" any of the information that's enabled in the "Enabled Metadata" section below onto your render, using the font and background settings shown there. You can add your own info in the Notes field, but it gets old copying and pasting it each time.

    I actually did end up fixing my script myself after some rigorous trial and error.

    It turns out if you hover over a property, the tooltip will show the correct property name to type into the string. (I couldn't figure out how to copy and paste from the tooltip).

    Below is my working code. It's a bit of a brute force, though. For example, I have to have a Displace modifier in there, or it may not continue on to the rest of the code. As I have time I'll work on it to get it to fail gracefully, but for now anyone looking to do this the code below should work for you (with your own modifications, of course).

    Code:
    import bpy
    
    
    def stamp_set(scene):
        note = "Displace Strength: "  + str(bpy.data.objects['Cube'].modifiers['Displace'].strength)
        note += "| Midlevel: "  + str(bpy.data.objects['Cube'].modifiers['Displace'].mid_level)
        note += "| Stroke Chaining: "  + str(bpy.data.linestyles['LineStyle'].use_chaining)
        note += "| Stroke Type: "  + str(bpy.data.linestyles['LineStyle'].chaining)
        note += "| Same Object: "  + str(bpy.data.linestyles['LineStyle'].use_same_object)
        note += "| Stroke Caps: "  + str(bpy.data.linestyles['LineStyle'].caps)
        note += "| Base Thickness: "  + str(bpy.data.linestyles['LineStyle'].thickness)
        note += "| Along Stroke Blend Mode: "  + str(bpy.data.linestyles['LineStyle'].thickness_modifiers['Along Stroke'].blend)
        note += "| Along Stroke Mapping: "  + str(bpy.data.linestyles['LineStyle'].thickness_modifiers['Along Stroke'].mapping)
        note += "| Along Stroke Influence: "  + str(bpy.data.linestyles['LineStyle'].thickness_modifiers['Along Stroke'].influence)
        note += "| Along Stroke Min Value: "  + str(bpy.data.linestyles['LineStyle'].thickness_modifiers['Along Stroke'].value_min)
        note += "| Along Stroke Max Value: "  + str(bpy.data.linestyles['LineStyle'].thickness_modifiers['Along Stroke'].value_max)
        note += "| Calligraphy Blend Mode: "  + str(bpy.data.linestyles['LineStyle'].thickness_modifiers['Calligraphy'].blend)
        note += "| Calligraphy Influence: "  + str(bpy.data.linestyles['LineStyle'].thickness_modifiers['Calligraphy'].influence)
        note += "| Calligraphy Orientation: "  + str(bpy.data.linestyles['LineStyle'].thickness_modifiers['Calligraphy'].orientation)
        note += "| Calligraphy Min Thickness: "  + str(bpy.data.linestyles['LineStyle'].thickness_modifiers['Calligraphy'].thickness_min)
        note += "| Calligraphy Max Thickness: "  + str(bpy.data.linestyles['LineStyle'].thickness_modifiers['Calligraphy'].thickness_max)
        note += "| Backbone_Length: "  + str(bpy.data.linestyles['LineStyle'].geometry_modifiers['Backbone Stretcher'].backbone_length)
        note += " | 2D transform scalex: "  + str(bpy.data.linestyles['LineStyle'].geometry_modifiers['2D Transform'].scale_x)
    
    
        scene.render.stamp_note_text = note
    
    
    bpy.app.handlers.render_pre.append(stamp_set)



  4. #4
    Member skywola's Avatar
    Join Date
    Feb 2011
    Location
    Mesa, Arizona, USA
    Posts
    57
    Cool. That brute force routine seems to be the norm for me quite often when I cannot find
    any examples of how to do things and when the documentation does not quite cover it! Glad
    I was able to help . . .



Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •