After you set the mode back to "OBJECT" change the shape key to relative mode if you want to adjust the key with its .value property:
obj.data.shape_keys.use_relative = True
If you're not in relative mode you must adjust the key with
Edit: This version of your script builds a working shapekey:
Turns out that you don't really need msgbus for this. I don't know exactly how this would integrate into your code, so I'm just going to post the necessary code fragments and let you figure out where to put them.
First, you need two custom color properties, attached to anything, but I've attached them to bpy.types.Scene because that means you can use them ...
I've made an add-on with this functionality.
It adds "Orient to Motion" command:
Install as a regular add-on. Run with View3D ⇾ Object ⇾ Animation ⇾ Orient to Motion
May use with Quaternions and Euler angles
Open F9 (adjust last operation) to:
Change front axis
Set an every frame mode for ...
Same "idea" as Eds...just with some other nodes...
If you don't mind using animation nodes (+ the add-on extension from 3D Singh VFX: https://github.com/3DSinghVFX/animation_nodes), you can do it by subtracting the current position from the old position and this is then your rotation vector. Of course you could do it also via python.
Here is the ...
This can be done using animation nodes. (No scripting required!)
Steps for Blender 2.93.4 and Animation Nodes 2.2:
If not installed, add Animation Nodes to Blender.
Add the object to animate.
Add the keyframes for the object to change it location.
Add the animation nodes below.
The fcurves, that stores the keyframe information is pulled from ...
In drivers editor window you can manually set the values of the curve control points, assuming that X is named (uncorrectly) "Key Frame" and represents the value of the expression, while Y (named Value) represents the output.
Dotted lines indicate the actual values of input and output of the curve.
In my example when the driver expression is 0.0 ...
There are many ways to do this. One of the easiest is to use the frame number as an input to control transparency in a shader:
Here, the purple value field is purple because it has a driver which I've created by typing #frame into the field. This is a short cut for using the frame number. Set the frame value you want the object to appear as the second ...
A pretty easy solution, I think, is this:
Add five bones like this. Name the last one Controller. Unparent Controller
Rename Bone.003 to IK, go to Pose mode and give it an Inverse Kinematic (IK) constraint with target controller like this:
With the Controller you can move the armature, if it is in pose mode.
The IK let's Blender calculate the movement and ...
There are several ways you might accomplish this. Here's one that I like to use, if the cylinders are to retract at the same time:
For my example, I'll only use 2 cylinder movement bones. You should have no trouble adding a third.
Create your deformation armature of 3 bones, assigning one bone to each cylinder:
Make sure that each bone is parented to ...
On the lamp object, I added a Custom Property I named Emission. I then created a material that uses an Attribute node set to Emission and plugged it into the Emission Strength input of a Principled BSDF through a Multiply node to adjust the strength.
I duplicated the material for Red, Green, and Yellow lights. I duplicated the lamp object 6 times and applied ...
In Blender the common workflow is to create a new bone in edit mode, set it as child of an appropriate bone (maybe the head bone, select the new bone, shift select the head bone, Ctrl P - keep offset), move it where you want (better aligned with world coordinates), put it into a convenient bone layer, then use its local transforms to drive the shape keys.
I figured it out! My armature and mesh were both facing in the negative axis direction, so what I did was rotate them so they were facing in the positive direction, and then I applied rotations and corrected the rolls of the bones so that the rolls were 0 deg. Then I recreated the drivers and it all worked!