Hi I made test script, which can change context obj Eular rotation to learn python. from this topic.
I hoped to solve problem,( I use his plug-in much for daz figures, then hope to improve, and I am making
simple add-on to rename amature daz genesis bones for blender symmetely,)
Then, I hoped to know why it not work. but I just start learning python, then hope to ask as new python user question,so can someone help me to undersatnd basic things clear? :eek:
bl_info = {
"name": "Test",
"category": "Test"}
import bpy
from bpy.props import FloatVectorProperty
from mathutils import Vector
import math
class MyPanel(bpy.types.Panel):
bl_label = "MyPanel"
bl_space_type = "VIEW_3D"
bl_region_type = "TOOLS"
bl_category = "Test"
def draw(self, context):
ob = context.object
layout = self.layout
layout.prop(ob, "ctrl1")
layout.prop(ob, "rotation_euler")
def Update_ctrl1(self, context):
print(self.rotation_euler)
self.rotation_euler = 2*Vector(self.ctrl1)*math.pi/180
def register():
bpy.types.Object.ctrl1 = FloatVectorProperty(
default = (0,0,0),
size = 3,
update = Update_ctrl1)
bpy.utils.register_module(__name__)
def unregister():
bpy.utils.unregister_module(__name__)
if __name__ == "__main__":
register()
it can work as I expected, when I change ctrl1 values, active obj rotate twice in 3d view.
then next, I set keys for ctrl1 vector values on frame 0 , then change ctrl1 values , on frame 10, and set keys,
when I check animation, it not change “Eular rotation” real time. only ctrl1 values are change with timeline.
then If I change ctrl1 values manually, suddenly obj Eular rotation values change belong to current ctrl1 values.
Is there any way, set keys for ctrl1, then real time up-date obj rotation on each frame?
I know, if I set keys for ctrl1 and Eural rotation, it seems work, but Do I really need to set keys both?
or is there way to set keys only about ctrl1, then make cube rotate with timeline by code?