RNA Types metaclass registration

See mailing list posts for details [1][2][3]

Addons still need to be fixed; Campbell said he'd do it today.

See any of the py files (outside netrender) in this commit for how to do it (it's rather simple).

[1] http://lists.blender.org/pipermail/bf-committers/2010-February/026328.html
[2] http://lists.blender.org/pipermail/bf-committers/2010-August/028311.html
[3] http://lists.blender.org/pipermail/bf-committers/2010-August/028321.html
This commit is contained in:
Martin Poirier
2010-08-02 02:55:12 +00:00
parent 9f575e5446
commit 5b345524ea
84 changed files with 689 additions and 1603 deletions

View File

@@ -25,7 +25,7 @@ narrowui = bpy.context.user_preferences.view.properties_width_check
# Generic Panels (Independent of DataType)
class MotionPathButtonsPanel(bpy.types.Panel):
class MotionPathButtonsPanel():
bl_space_type = 'PROPERTIES'
bl_region_type = 'WINDOW'
bl_label = "Motion Paths"
@@ -67,7 +67,7 @@ class MotionPathButtonsPanel(bpy.types.Panel):
# FIXME: this panel still needs to be ported so that it will work correctly with animviz
class OnionSkinButtonsPanel(bpy.types.Panel):
class OnionSkinButtonsPanel():
bl_space_type = 'PROPERTIES'
bl_region_type = 'WINDOW'
bl_label = "Onion Skinning"
@@ -102,119 +102,19 @@ class OnionSkinButtonsPanel(bpy.types.Panel):
col.label(text="Display:")
col.prop(arm, "ghost_only_selected", text="Selected Only")
################################################
# Specific Panels for DataTypes
class OBJECT_PT_motion_paths(MotionPathButtonsPanel):
#bl_label = "Object Motion Paths"
bl_context = "object"
def poll(self, context):
return (context.object)
def draw(self, context):
layout = self.layout
ob = context.object
wide_ui = context.region.width > narrowui
self.draw_settings(context, ob.animation_visualisation, wide_ui)
layout.separator()
split = layout.split()
col = split.column()
col.operator("object.paths_calculate", text="Calculate Paths")
if wide_ui:
col = split.column()
col.operator("object.paths_clear", text="Clear Paths")
class OBJECT_PT_onion_skinning(OnionSkinButtonsPanel):
#bl_label = "Object Onion Skinning"
bl_context = "object"
def poll(self, context):
return (context.object)
def draw(self, context):
layout = self.layout
ob = context.object
wide_ui = context.region.width > narrowui
self.draw_settings(context, ob.animation_visualisation, wide_ui)
class DATA_PT_motion_paths(MotionPathButtonsPanel):
#bl_label = "Bones Motion Paths"
bl_context = "data"
def poll(self, context):
# XXX: include posemode check?
return (context.object) and (context.armature)
def draw(self, context):
layout = self.layout
ob = context.object
wide_ui = context.region.width > narrowui
self.draw_settings(context, ob.pose.animation_visualisation, wide_ui, bones=True)
layout.separator()
split = layout.split()
col = split.column()
col.operator("pose.paths_calculate", text="Calculate Paths")
if wide_ui:
col = split.column()
col.operator("pose.paths_clear", text="Clear Paths")
class DATA_PT_onion_skinning(OnionSkinButtonsPanel):
#bl_label = "Bones Onion Skinning"
bl_context = "data"
def poll(self, context):
# XXX: include posemode check?
return (context.object) and (context.armature)
def draw(self, context):
layout = self.layout
ob = context.object
wide_ui = context.region.width > narrowui
self.draw_settings(context, ob.pose.animation_visualisation, wide_ui, bones=True)
# NOTE:
# The specialised panel types defined here (i.e. OBJECT_PT_*, etc.)
# aren't registered here, but are rather imported to (and registered)
# in the files defining the contexts where they reside. Otherwise,
# these panels appear at the top of the lists by default.
#
# However, we keep these empty register funcs here just in case
# something will need them again one day, and also to make
# it easier to maintain these scripts.
classes = []
# The specialised panel types are derived in their respective UI modules
def register():
register = bpy.types.register
for cls in classes:
register(cls)
pass
def unregister():
unregister = bpy.types.unregister
for cls in classes:
unregister(cls)
pass
if __name__ == "__main__":
register()