Skip to main content
12 events
when toggle format what by license comment
Mar 11, 2022 at 16:36 comment added Tyler This is spectacular, I'm going to make this into an addon. It would go over really well!
Jul 19, 2018 at 21:00 comment added Leander @ItsWhy Your code example worked as expected. Nevertheless I have added a more pythonic approach and even more clarification for future readers to the answer.
Jul 19, 2018 at 20:55 history edited Leander CC BY-SA 4.0
added 1571 characters in body
Jul 19, 2018 at 19:49 vote accept ItsWy
Jul 19, 2018 at 19:42 comment added ItsWy @Leander thanks for the comprehensive answer! It's greatly appreciated. Would it be possible for this script to work with multiple characters on the same camera? Let's say that I have "Cube2" with a shape key named "Key 2" (although I'm assuming if it was named "Key 1", this would still work because of the different path). I've moved around some variables in the code and added the modified code block to the post above. It's probably wrong because all I really did was add "2"s everywhere, but it's worth a shot.
Jul 19, 2018 at 18:59 vote accept ItsWy
Jul 19, 2018 at 19:49
Jul 15, 2018 at 8:56 history edited Leander CC BY-SA 4.0
added 175 characters in body
Jul 15, 2018 at 8:53 comment added batFINGER Very comprehensive. Adding if h.__name__ == "drive_shapekey" will avoid removing other handlers. As is could be pre_handlers.clear() @RobinBetts The use_sellf option of drivers lets you pass the object as self, Henceforth can ref self.matrix_world The above could be rejigged to a driver drive_shapekey(self) with cam = bpy.context.scene.camera
Jul 14, 2018 at 20:44 history edited Leander CC BY-SA 4.0
added 197 characters in body
Jul 14, 2018 at 20:40 comment added Leander @Robin I can't think of a way right now, the script relies on the matrix_world property, which enables it to work even if camera and/or object are in a parenting hierarchy. For a production rig don't parent the camera to anything sounds to restrictive. (I think the driver needs a different workflow.)
Jul 14, 2018 at 20:28 comment added Robin Betts ..A truly wonderful answer! Would it be possible, in principle, to do this in a driver, rather than have drive_shapekey called back by the scene updating? I've been trying to work out how much vector maths you can do in driver scripted expressions ..
Jul 14, 2018 at 19:29 history answered Leander CC BY-SA 4.0