If Statement In A Driver | Blender Drivers Master Class

  Рет қаралды 14,664

Level Pixel Level

Level Pixel Level

3 жыл бұрын

Hello everyone, I hope you are all well.
Here is a quick video reviewing if statements in Blender drivers.
0:37 - Skip that intro!
Let me know if you have any questions in the comment below!
.........................................................................
●Website: levelpixellevel.com/
●Patreon: / levelpixellevel
●Twitter: / levelpixellevel
●Instagram: / levelpixellevel
●Pinterest: www.pinterest.ca/levelpixellevel
.....................................................................

Пікірлер: 54
@djmnx01
@djmnx01 2 жыл бұрын
Really helpful. As an ex-coder, I found it miles easier to do this than faff around with chains of math nodes! Thank you so much!
@BreadcrumbMC
@BreadcrumbMC 3 жыл бұрын
Wow I never knew you could have python logic in drivers. SO MANY NEW POSSIBILITIES
@stefanguiton
@stefanguiton 3 жыл бұрын
Great video! Love this driver series, keep up the great work
@SleepyEngi
@SleepyEngi Жыл бұрын
Very useful tip, much easier than having to do some separate script. Thanks!
@DioriteTM
@DioriteTM Жыл бұрын
you are a legend thank you so much, been searching for a solution for this exact problem for about 2 hours now
@MikeRadjabov
@MikeRadjabov 2 жыл бұрын
This is very useful method, thank you for great explanation!
@forrestgump2114
@forrestgump2114 3 жыл бұрын
Great video thank you, I’ve been looking for this a while ago, and I don’t even remember what I was going to use it for.
@rigidpartyvan
@rigidpartyvan 5 ай бұрын
Just what I needed! Thanks a lot dude! You saved me dozens of hours!
@HroftiHroft
@HroftiHroft 2 жыл бұрын
It is great. I tried to restrict using a driver after certain frame and I did it! Thanks to you.
@syam.k.yenubari
@syam.k.yenubari 3 жыл бұрын
Well I am not a programmer but this blows My mind...
@activemotionpictures
@activemotionpictures Жыл бұрын
Fantastic video! Thank you for sharing.
@jeffreystephens2658
@jeffreystephens2658 3 жыл бұрын
Excellent.
@Yaroslav_A.
@Yaroslav_A. Жыл бұрын
Amazingly helpful. Thank you!
@zuggamasta
@zuggamasta 2 жыл бұрын
Perfect explaination. Thank you.
@pxy-gnomes9781
@pxy-gnomes9781 2 жыл бұрын
Nice propositions on this tutorial; kind of an inspiration to learn Python even. *_False if var >= 0.9999 else True_* I came up with this simple Expression for another case of Blender's UI Option switching: I was trying to improve the Driver switch system I was using… thanks to your video, I now understand if I learn some Python basics, I can use it as Scripted Expression Type on Drivers. Then, I've came up with this simple Expression: Of course this isn't too difficult to understand. Basically, if the Driving Bone has its Y-Axis Scale Untransformed (in principle, equal to 1.000 at start/reset Scale) or above that given threshold (0.9999), then a Bone Constraint from a Bone that contains this Driver, on its Hide/Unhide Toggle Button, is turned OFF (Hidden); else, it is turned ON (Unhidden). Unfortunately, there seem to be a glitch in which the exact value becomes unsafe; like for example >=1, = 0.9; because then, whenever the (Y-Axis always) Scale is _exactly_ on that Value, it starts to have the Bone Constraint Toggle Button going wild, randomly switching as you move the Bone around (not even Re-Scaling anything, just changing; it glitches). Thus, I found you need to get the Scale on any Value that is _not exactly_ the same as the on the Expression, therefore 0.9999; very very unlikely to drop at this Transformation Value by accident.
@radhinnasywanabyasa1673
@radhinnasywanabyasa1673 Жыл бұрын
I've been wondering this for while, thanks for sharing this bcuz I want to make a face rig but with shape key and i think this trick will work. I'm gonna try it later😊
@coolestardude
@coolestardude 10 ай бұрын
Incredibly valuable information
@MrGravicaper
@MrGravicaper 3 жыл бұрын
Thanks again (I asked for advice under another video), it worked out! But seemed to me that in Blender this is true 1 (visibility), and false (invisibility) is zero. When I was convinced by an experimental example that my inverse idea of this is true, the expression worked as it should.
@sameeruddin
@sameeruddin 7 ай бұрын
excellent tip . so if we do sin(Frame/3) we will get a sin wave style lfo oscillating between the start and end value , what if wanted to do a square wave or a triangle wave or maybe a random Sample hold style lfo ?
@Lee-gx8cd
@Lee-gx8cd 2 жыл бұрын
😆thank you, it is very cool
@mildanhali
@mildanhali Жыл бұрын
thank you sir
@WaterShowsProd
@WaterShowsProd 3 жыл бұрын
Oh ho...! :O
@PCgmesforever
@PCgmesforever 3 жыл бұрын
This might be dumb but is it also possible to chain more if statements after "else" ? Btw love this video ! Thanks ! :)
@LevelPixelLevel
@LevelPixelLevel 3 жыл бұрын
For sure! You can stack them in one driver expression or use multiple properties to add a bunch of stiches.
@8bitarmory846
@8bitarmory846 2 ай бұрын
are else-if statements possible within a driver? If so, what would the syntax be?
@RTJ3DCosplay
@RTJ3DCosplay 2 жыл бұрын
can this be done only on a plane for moving sprites , like set it up to scroll through the uv unwrap which has a sprite sheet , i can get it to go from stood to walking sprite and cycle back through if its still moving in that direction or change directions to change the sprites being played ?
@NightSpyderTech
@NightSpyderTech 3 жыл бұрын
This is really cool and easy to understand, thanks. Is there a way to use drivers to swap between (enable/disable) collections? I've setup a starter scene with multiple backgrounds and am trying to figure out a top level way to swap between then since each collection holds a lot of individual objects.
@LevelPixelLevel
@LevelPixelLevel 3 жыл бұрын
Hey, I don't have a method for driving collection visibility right now. Although I'll look into it and see if I can find a way., and if I do I'll make a video. One option might be to nest everything under one collection and use this for a toggle. Or use another scene for the extra objects and use a collection instance.
@NightSpyderTech
@NightSpyderTech 3 жыл бұрын
@@LevelPixelLevel Ahh ok thanks for the quick reply. atm I am handling it via collection nesting. I did try using other scenes as groups, but it didn't make it much faster to swap between backgrounds, especially since it was like 9 scenes with around 5 backgrounds per scene, though I've shifted from that to a more modular approach.
@JoseMares3396
@JoseMares3396 3 жыл бұрын
This is neat. I am not a programmer but you explained it so well I was able to modify your code to give objects a level of detail property. Instead of using the switch value as the variable to drive viewport visibility, I used the camera distance from the armature bone. The line of code I typed in was "0 if switch
@antoniowilmot2637
@antoniowilmot2637 3 жыл бұрын
since your using a scripted expression the "switch" is just a variable storing the values and code, it can be called anything and would still work. Take a look at the driver variable type, in this case being single property, both share the same name "switch", if you were to change any of them you will get an error.
@LevelPixelLevel
@LevelPixelLevel 3 жыл бұрын
Thanks for the great reply Antonio! Summed it up perfectly.
@antoniowilmot2637
@antoniowilmot2637 3 жыл бұрын
@@LevelPixelLevel Not a problem, I'm still learning as well. I hope to apply everything I know to make something amazing. Your videos have been very helpful.
@adeptussilicium2821
@adeptussilicium2821 3 ай бұрын
This is a good illustration of working with expressions in the driver. But "Disable in viewports" does not affect the rendering and therefore is poorly applicable in real animations, If I understood everything correctly.
@maggyfrog
@maggyfrog 2 жыл бұрын
is there a way to convert the ".xxx" name extension of an object into a number that can be used in a driver? for example, an object with a name "cube.005" . is it possible to extract the last 3 characters and convert it into an integer or float?
@Gary_Hun
@Gary_Hun Жыл бұрын
Why is it that if i use the 'frame' variable to get the passed time, the driver f***s to work for minutes, before it finally starts working after numerous ins and outs into the Drivers Editor? I change nothing in the expression line, it just tells me for a minute or two that there is an invalid python expression, then after sufficient time wasted, it starts working.
@pronatabiswas8233
@pronatabiswas8233 Жыл бұрын
how can I use this method in a hair particle system (hair particle modifier) ? this method doesn't work in the hair particle modifier. Any solution please?
@GoldCountryballs
@GoldCountryballs Жыл бұрын
it can use if elif else ?Seems unable to increase the elif control condition
@CharlesDanielCharly
@CharlesDanielCharly 2 жыл бұрын
What should I do if in the 3.1 alpha it says invalid python expression?
@Lumina-Studios
@Lumina-Studios Жыл бұрын
and how can i do it with bones? cause this doesn't work with bones
@fabbrobbaf
@fabbrobbaf 3 жыл бұрын
Cool! Is it possible to put a random number in that expression?
@LevelPixelLevel
@LevelPixelLevel 3 жыл бұрын
Kind of - but it is a bit more advanced. I'll do a video on this soon.
@sky_tails
@sky_tails 3 жыл бұрын
do you know how to add driver on collection?
@LevelPixelLevel
@LevelPixelLevel 3 жыл бұрын
I have not found a way to do this - but let me add it to the list. If I come up with a method I'll create a video.
@no-one3795
@no-one3795 2 жыл бұрын
Halo, I have a question. So I have a rig and I wanted to add a feature called auto blink that allows the character to automatically blink without me needing to manually animate it. But the question is that how can I do this?
@LevelPixelLevel
@LevelPixelLevel 2 жыл бұрын
First thing you can do is choose a method for rigging the eyelid: kzbin.info/aero/PLbjn7kaP877uYJP4IEoj7r87qi37APhiU A shape key might be a the best thing for this. Then you can add an action constraint: kzbin.info/www/bejne/a3vQgXmpfqqafqs&ab_channel=LevelPixelLevel This can be used to drive the entire animation with one bone or control. And if you want to take it to the next step you can add a driver to this that is driven by the timeline: kzbin.info/www/bejne/qZfRYoCAaL1gmsk&ab_channel=LevelPixelLevel This can be a driver that is drive by every 5 frames, set off a blink.
@OreoCat489
@OreoCat489 2 ай бұрын
how do i put a and in the code?
@ScooterCat64
@ScooterCat64 6 ай бұрын
Why did you start the script expression with "0"?
@adrielguedesleon555
@adrielguedesleon555 Жыл бұрын
could you remade it please?
@adrielguedesleon555
@adrielguedesleon555 Жыл бұрын
it doesn't works in my driver
@samdavepollard
@samdavepollard 2 жыл бұрын
such a cool series; many thanks got a pair of sliding doors working using a bunch of nested if-else statements: kzbin.info/www/bejne/aYmahoWip9mfnZo just to add, if we have a bunch of values triggering a particular condition we could stuff them into a list for example: 0 if switch in [1,3] else 1 arguably easier to read, especially if the list contains 3 or more values thanks again
@buraqstudio0786
@buraqstudio0786 6 ай бұрын
you are a legend thank you so much, been searching for a solution for this exact problem for about 2 hours now
Convert Float Value to An Integer Value | Blender Drivers Master Class
3:04
Driving Sci-Fi Doors | Blender Drivers Master Class
14:34
Level Pixel Level
Рет қаралды 19 М.
World’s Largest Jello Pool
01:00
Mark Rober
Рет қаралды 84 МЛН
MISS CIRCLE STUDENTS BULLY ME!
00:12
Andreas Eskander
Рет қаралды 18 МЛН
Как бесплатно замутить iphone 15 pro max
00:59
ЖЕЛЕЗНЫЙ КОРОЛЬ
Рет қаралды 8 МЛН
НЫСАНА КОНЦЕРТ 2024
2:26:34
Нысана театры
Рет қаралды 1,1 МЛН
How To Add A Switch To A Driver | Blender Drivers Master Class
5:22
Level Pixel Level
Рет қаралды 17 М.
Driver Expressions for Animations in Blender - Quick Tip
1:27
passivestar
Рет қаралды 29 М.
Blender 3.0+ Drivers Quick Start Guide
8:21
Keep Making
Рет қаралды 16 М.
Copy As New Driver Feature | Blender Drivers Master Class
2:43
Level Pixel Level
Рет қаралды 8 М.
Blender Secrets - Using Drivers for Muscle Deformations 💪
1:02
Blender Secrets
Рет қаралды 40 М.
Expressions in Blender 3D
14:35
ukramedia
Рет қаралды 22 М.
How to use drivers in Blender? | Tutorial
22:10
MK Graphics
Рет қаралды 15 М.
The RIGHT way to cut holes in surfaces in Blender
10:52
Josh Gambrell
Рет қаралды 1,2 МЛН
Hiding Sci-Fi Doors | Blender Drivers Master Class
4:25
Level Pixel Level
Рет қаралды 10 М.
Change Your Understanding of Topology In Six Minutes
6:58
DECODED
Рет қаралды 926 М.
World’s Largest Jello Pool
01:00
Mark Rober
Рет қаралды 84 МЛН