0
$\begingroup$

How can i set value of referenced variable but not the variable? Hard to explain, here is example:

Var = bpy.context.object.pose.bones["Forearm.L"].constraints["IK"].influence #I saved influence into Var
#influence of that bone is 0.5
Var = 1 #But it didn't set to actuall influence, its just set to Var in code memory
#influence of that bone still is 0.5 but Var is 1 now
$\endgroup$
5
  • $\begingroup$ What exactly are you trying to do with this variable? $\endgroup$
    – lemon
    Dec 13, 2020 at 17:07
  • $\begingroup$ @lemon just checkin value and then change it $\endgroup$
    – Staz
    Dec 13, 2020 at 17:08
  • 1
    $\begingroup$ This is Python question in fact. First line does not get influence but gets the value of it. You should get c = bpy.context.object.pose.bones["Forearm.L"].constraints["IK"] then c.influence = 1 $\endgroup$
    – lemon
    Dec 13, 2020 at 17:10
  • $\begingroup$ @lemon oh wow, that WORKS. Thanks! $\endgroup$
    – Staz
    Dec 13, 2020 at 17:16
  • $\begingroup$ I’m voting to close this question because it is not related to Blender $\endgroup$
    – Gorgious
    Dec 18, 2020 at 14:11

1 Answer 1

2
$\begingroup$

This is Python question in fact. First line does not get influence but gets the value of it.

You should get

c = bpy.context.object.pose.bones["Forearm.L"].constraints["IK"] 

then

c.influence = 1

_ lemon

$\endgroup$
1
  • 2
    $\begingroup$ Nice : ) . Consider accepting your answer. $\endgroup$
    – lemon
    Dec 13, 2020 at 17:25

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .