Newbie question about Python syntax

Cameron Simpson cs at cskk.id.au
Sat Aug 24 20:39:34 EDT 2019


On 24Aug2019 21:52, Paul St George <email at paulstgeorge.com> wrote:
>>Have you not got one of these handed to you from something?
>>
>>Or are you right at the outside with some "opaque" blender handle or 
>>something? (Disclaimer: I've never used Blender.)
>
>Thank you once again.
>If I understand your question, I am right outside. By this I mean I 
>have not created anything with Python. I have made the Blender model 
>with the UI and am trying to use Python to read the values for the 
>settings used. This has worked for all settings except this Map Value 
>Node.

Hmm. So you have a CompositorNodeMapValue instance? If that is the case 
you should be able to inspect it as previously described.

However, it looks like this is something you construct in order to do 
some task. A little web searching turns up this stackexchange post:

  https://blender.stackexchange.com/questions/42579/render-depth-map-to-image-with-python-script/42667

and some example code from an unrelated project:

  https://github.com/panmari/stanford-shapenet-renderer/blob/master/render_blender.py

From the stackexchange post:

    map = tree.nodes.new(type="CompositorNodeMapValue")
    # Size is chosen kind of arbitrarily, try out until you're satisfied 
    # with resulting depth map.
    map.size = [0.08]
    map.use_min = True
    map.min = [0]
    map.use_max = True
    map.max = [255]

"tree" is "bpy.context.scene.node_tree".

Aside from "map" being a poor name (it is also a builtin Python 
function), it seems that one creates one of these to control how some 
rendering process is done.

The class reference page you originally cites then specifies the meaning 
of the various attributes you might set on one of these objects.

Cheers,
Cameron Simpson <cs at cskk.id.au>



More information about the Python-list mailing list