0
$\begingroup$

Is there any possibility to adding a value beside expression in driven property? Formulas would be only in drivers window or not?

If I need add expression like:

self.location[0]+object.location[1]

< both value dependant

enter image description here

$\endgroup$
1
$\begingroup$

A shortcut to entering driver expressions is to start with a # - so entering #frame*0.1 will create a driver expression that sets the value to 1/10th of the current frame. You can then edit drivers using the graph editor in driver mode.

Using the # prefix works for some things that are available globally, like the current frame and some math functions - sin(), log(), noise.random() etc. To get a driver to depend on a transform channel or property, whether it is it's own property or another objects, you create driver variables and use them in your expression.

using driver variables

To see a full list of functions available within drivers, enter bpy.app.driver_namespace.keys() into blenders python console.

You can also define your own functions and add them to the driver namespace as shown here.

$\endgroup$
4
  • $\begingroup$ Thank you sambler, but this is not what I ask. Problem is that, if I have some expression in property I would like controll the property (animator) even the property is purple (default expresion color) but if i want to set some number it give me only expression as i show in my main question. So I would like to freely controll "expresioned" property without see the expression, only number. $\endgroup$ – MRL Mar 11 '18 at 21:40
  • 1
    $\begingroup$ @mrl you can't have both, you either use a driver that calculates the value or you manually keyframe the value. Note that you can have a driver read multiple custom properties that you can manually adjust. You can also create your own function which could use a custom property except on frame 125 where it calculates from other sources. You can also enter an expression without the # prefix and it will only be calculated at that time, but you are still limited to what properties you can access. $\endgroup$ – sambler Mar 12 '18 at 4:12
  • $\begingroup$ Thank you sabler. I asked because with expressions in after Effects it is possible. And I would like round the number I set. In blender I must use other options then. $\endgroup$ – MRL Mar 12 '18 at 11:12
  • $\begingroup$ @sambler I appreciate your insight, I've used drivers for years and never picked up on this method of input. Awesome nugget. $\endgroup$ – Rick Riggs Mar 13 '18 at 9:32
0
$\begingroup$

Yes you can...

You have to have an empty driver 1st... (Via manually create later single)

Then you have to use a slightly different format, but it works...

I have a cube named 'c1' & 'c2':

I added the following line to the "z" location for 'c1' and hit enter.

3.0 + bpy.data.objects['c2'].location[2]

It worked!

$\endgroup$
2
  • $\begingroup$ The problem with this though, is that it does not update, when you change the z position of 'C2', you have to enter back into the 'z' location property of 'C1' and hit enter to force the update. $\endgroup$ – Rick Riggs Mar 7 '18 at 19:23
  • $\begingroup$ Thank you, can you please post preent creen of "You have to have an empty driver 1st... (Via manually create later single)" Because I dont understand what you mean. And the value of property will controll some animator, so i would like have only value in Z-location - nothing else. < it must be animable $\endgroup$ – MRL Mar 7 '18 at 19:43

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.