properties_animviz.py 4.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132
  1. # ##### BEGIN GPL LICENSE BLOCK #####
  2. #
  3. # This program is free software; you can redistribute it and/or
  4. # modify it under the terms of the GNU General Public License
  5. # as published by the Free Software Foundation; either version 2
  6. # of the License, or (at your option) any later version.
  7. #
  8. # This program is distributed in the hope that it will be useful,
  9. # but WITHOUT ANY WARRANTY; without even the implied warranty of
  10. # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  11. # GNU General Public License for more details.
  12. #
  13. # You should have received a copy of the GNU General Public License
  14. # along with this program; if not, write to the Free Software Foundation,
  15. # Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
  16. #
  17. # ##### END GPL LICENSE BLOCK #####
  18. # <pep8 compliant>
  19. # Generic Panels (Independent of DataType)
  20. # NOTE:
  21. # The specialized panel types are derived in their respective UI modules
  22. # don't register these classes since they are only helpers.
  23. class MotionPathButtonsPanel:
  24. bl_space_type = 'PROPERTIES'
  25. bl_region_type = 'WINDOW'
  26. bl_label = "Motion Paths"
  27. # bl_options = {'DEFAULT_CLOSED'}
  28. def draw_settings(self, _context, avs, mpath, bones=False):
  29. layout = self.layout
  30. mps = avs.motion_path
  31. # Display Range
  32. layout.use_property_split = True
  33. layout.use_property_decorate = False
  34. row = layout.row(align=True)
  35. row.prop(mps, "type")
  36. if mps.type == 'RANGE':
  37. if bones:
  38. row.operator("pose.paths_range_update", text="", icon='TIME')
  39. else:
  40. row.operator("object.paths_range_update", text="", icon='TIME')
  41. if mps.type == 'CURRENT_FRAME':
  42. col = layout.column(align=True)
  43. col.prop(mps, "frame_before", text="Frame Range Before")
  44. col.prop(mps, "frame_after", text="After")
  45. col.prop(mps, "frame_step", text="Step")
  46. elif mps.type == 'RANGE':
  47. col = layout.column(align=True)
  48. col.prop(mps, "frame_start", text="Frame Range Start")
  49. col.prop(mps, "frame_end", text="End")
  50. col.prop(mps, "frame_step", text="Step")
  51. if mpath:
  52. col = layout.column(align=True)
  53. col.enabled = False
  54. if bones:
  55. col.prop(mpath, "frame_start", text="Bone Cache From")
  56. else:
  57. col.prop(mpath, "frame_start", text="Cache From")
  58. col.prop(mpath, "frame_end", text="To")
  59. row = layout.row(align=True)
  60. if bones:
  61. row.operator("pose.paths_update", text="Update Paths", icon='BONE_DATA')
  62. row.operator("pose.paths_clear", text="", icon='X')
  63. else:
  64. row.operator("object.paths_update", text="Update Paths", icon='OBJECT_DATA')
  65. row.operator("object.paths_clear", text="", icon='X')
  66. else:
  67. col = layout.column(align=True)
  68. col.label(text="Nothing to show yet...", icon='ERROR')
  69. if bones:
  70. col.operator("pose.paths_calculate", text="Calculate...", icon='BONE_DATA')
  71. else:
  72. col.operator("object.paths_calculate", text="Calculate...", icon='OBJECT_DATA')
  73. class MotionPathButtonsPanel_display:
  74. bl_space_type = 'PROPERTIES'
  75. bl_region_type = 'WINDOW'
  76. bl_label = "Display"
  77. def draw_settings(self, _context, avs, mpath, bones=False):
  78. layout = self.layout
  79. mps = avs.motion_path
  80. layout.use_property_split = True
  81. layout.use_property_decorate = False
  82. flow = layout.grid_flow(row_major=False, columns=0, even_columns=False, even_rows=False, align=True)
  83. flow.prop(mps, "show_frame_numbers", text="Frame Numbers")
  84. flow.prop(mps, "show_keyframe_highlight", text="Keyframes")
  85. sub = flow.column()
  86. sub.enabled = mps.show_keyframe_highlight
  87. if bones:
  88. sub.prop(mps, "show_keyframe_action_all", text="+ Non-Grouped Keyframes")
  89. sub.prop(mps, "show_keyframe_numbers", text="Keyframe Numbers")
  90. # Customize path
  91. if mpath is not None:
  92. flow.prop(mpath, "lines", text="Lines")
  93. col = layout.column()
  94. col.prop(mpath, "line_thickness", text="Thickness")
  95. split = col.split(factor=0.6)
  96. split.prop(mpath, "use_custom_color", text="Custom Color")
  97. sub = split.column()
  98. sub.enabled = mpath.use_custom_color
  99. sub.prop(mpath, "color", text="")
  100. classes = (
  101. )
  102. if __name__ == "__main__": # only for live edit.
  103. from bpy.utils import register_class
  104. for cls in classes:
  105. register_class(cls)