@ batFINGER Thank you
I wanted it to know bone constraints resultant value and with a bit fidgeting batFINGER code i got this.
If some one can generalize this code to work for any object, bone etc that wold be awesome. But my problem is solved.
import bpy
from math import degrees
## changed class name to avoid duplicate class
class LayoutDemoPanelBone(bpy.types.Panel):
"""Creates a Panel in the object context of the properties editor"""
bl_label = "Layout Demo Bone"
bl_idname = "OBJECT_PT_layout_Bone"
bl_space_type = 'PROPERTIES'
bl_region_type = 'WINDOW'
bl_context = "bone" ## changed here
@classmethod
def poll(cls, context):
return context.active_object is not None
def draw(self, context):
layout = self.layout
obj = context.selected_pose_bones[0] ## changed here i don't know if there is active pose bone method
col = layout.column()
mw = obj.matrix ## changed here
euler_rot = mw.to_euler()
for axis in "xyz":
col.label("%c : %7.4f" % (axis, degrees(getattr(euler_rot, axis, 0))))
def register():
bpy.utils.register_class(LayoutDemoPanelBone)
def unregister():
bpy.utils.unregister_class(LayoutDemoPanelBone)
if __name__ == "__main__":
register()