[Bf-committers] node size

Lukas Tönne lukas.toenne at googlemail.com
Tue Apr 10 08:48:31 CEST 2012


> Maybe I missed it, but I can't find a property which would be the size of a
> node. That would be very helpful when scripting node to organize them.
> Would it be possible to add it ?

Indeed, these are missing in the API. See below [1] for a quick patch.
We're at BCon 4 atm, so trunk will have to wait for two more weeks or
so. Notes:
* height doesn't have an effect in most nodes, since this is
recalculated on drawing based on the number of inputs, extra buttons,
etc. The "frame" node is currently the only one actually using a free
height value.
* width and height have fixed limits (type specific).
* There are two separate width values ('width' and 'width_collapsed')
used for the expanded/collapsed node display respectively.
* Nodes Group node values currently also depend on their open/closed
state (will change with the upcoming group nodes patch).

> While I'm at it :
> len(scene.node_tree.nodes['RGB'].outputs) = 1
> len(scene.node_tree.nodes['RenderLayer'].outputs) = 28
>
> RGB which is a rgb input node return 1 output which is correct.
> But the RenderLayer return 28 even if I only have one pass selected. Is
> that normal or is it a "bug" ?

Yes, the render layers node currently generates all possible render
pass output sockets on creation, then just disables all but the used
passes (SOCK_UNAVAIL flag in C). By now nodes can actually quite
easily use real dynamic socket lists (file output node does this), so
in the future this might change. Best way to handle this in the API
would probably be to simply skip the disabled sockets, no use in
actually including them in the collection.

{1]
http://www.pasteall.org/30800/diff


More information about the Bf-committers mailing list