[bpy.types.NodeSocketFloat] missing attribute?

Hello,

I’ve been wondering… Why does this class only have a “default_value” and not a “current_value” in version 2.79? I need to get the current value of a node input socket, but searched through the API without any success.

Is it like this intentionally, or was it just overlooked and can be easily added? I believe it greatly increases the Python API’s potential.

Can someone clarify on this topic?

Kindest regards

The default_value property is the value that is used if the socket has no links.
So it contains the current value if there is nothing linked to the socket.
This is also the property that is shown in the UI.

Let’s say I add a node that has an input attribute, and at the time of creation is set at 0,5. If in the UI I change it to 0,8 for example, in Python when I query the “default_value” attribute I get the original default 0,5, and not the new 0,8 I want to read.

Am I doing something wrong or overlooking anything here? Apologies if I’m being a nuisance.

It works on my end.
Maybe you are doing some other mistake? Like read the value of a different node?
Could you show more of your code (the relevant parts)?

I should have mentioned earlier, but it just came to mind after seeing your example: I’m trying to read the input of a group, not a single default node, perhaps that’s where the issue lies on.

I’ll test tomorrow morning to make sure, and I’ll provide a more complete answer then.

With a group I can reproduce your problem: It keeps the value that the input socket had when the group input was created.

Do you know who can I reach with this issue? Maybe I should abandon trying to do this in 2.79 and wait for 2.80?

@BYOB many thanks for bearing with me, and apologies if I’m being a nuisance. First time in these forums :stuck_out_tongue:

This is the same in 2.79 and 2.80, and it’s working correct as far as I can tell.

In the above example it’s reading the default value of the node group, not the node that instances that node group. There can be multiple instances of a node group each having different values.

1 Like

You’re absolutely right, huge thanks for clarifying on this.

Ah, of course. Thanks for clarifying.