Could you tell me how to set min/max/default value for node group socket via Python? Something like this:

enter image description here


You can access it through the NodeGroup object's inputs:

glossinessFactorInput = bpy.data.node_groups["NodeGroup"].inputs['Glossiness Factor']

glossinessFactorInput.min_value     = -5.0
glossinessFactorInput.max_value     = 5.0
glossinessFactorInput.default_value = 1.5
  • $\begingroup$ Thank you. My group is creating by an Operator so it works very well at the first time. When I hit this again button it doesn't work. It seems to work only for group without suffix (.001, .002). Have I put this code under "def execute(self, context):" for an Operator? $\endgroup$ – Mc Gavish Oct 11 '15 at 9:42
  • 2
    $\begingroup$ If you create a group through an operator, you should also save the created group's name so you can access its inputs. You probably hardcoded the group's name into your code, so you always access the first group and not the later groups you create. Instead of hardcoding the group name, use a dynamic name based on the name of the group you created in your opreator. $\endgroup$ – TLousky Oct 11 '15 at 9:46
  • $\begingroup$ Yes, I hardcoded its name. I'm sorry for my stupid question, but how to use a dynamic name? $\endgroup$ – Mc Gavish Oct 11 '15 at 9:53

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.