diff --git a/release/scripts/modules/rna_prop_ui.py b/release/scripts/modules/rna_prop_ui.py index 543a10e47e9..f5b9e518c8f 100644 --- a/release/scripts/modules/rna_prop_ui.py +++ b/release/scripts/modules/rna_prop_ui.py @@ -124,6 +124,18 @@ def draw(layout, context, context_member, use_edit=True): assign_props(prop, val_draw, key) +class PropertyPanel(bpy.types.Panel): + """ + The subclass should have its own poll function + and the variable '_context_path' MUST be set. + """ + bl_label = "Custom Properties" + bl_default_closed = True + + def draw(self, context): + draw(self.layout, context, self._context_path) + + from bpy.props import * @@ -257,3 +269,4 @@ class WM_OT_properties_remove(bpy.types.Operator): item = eval("context.%s" % self.properties.path) del item[self.properties.property] return {'FINISHED'} + diff --git a/release/scripts/ui/properties_data_armature.py b/release/scripts/ui/properties_data_armature.py index 0267b2abea4..bded38ee3cc 100644 --- a/release/scripts/ui/properties_data_armature.py +++ b/release/scripts/ui/properties_data_armature.py @@ -18,6 +18,7 @@ # import bpy +from rna_prop_ui import PropertyPanel narrowui = 180 @@ -55,6 +56,10 @@ class DATA_PT_context_arm(DataButtonsPanel): layout.template_ID(ob, "data") +class DATA_PT_custom_props_arm(DataButtonsPanel, PropertyPanel): + _context_path = "object.data" + + class DATA_PT_skeleton(DataButtonsPanel): bl_label = "Skeleton" @@ -293,16 +298,6 @@ class DATA_PT_iksolver_itasc(DataButtonsPanel): row.prop(itasc, "dampeps", text="Eps", slider=True) -class DATA_PT_properties(DataButtonsPanel): - bl_label = "Properties" - bl_default_closed = True - - def draw(self, context): - import rna_prop_ui - - rna_prop_ui.draw(self.layout, context, "object.data") - - bpy.types.register(DATA_PT_context_arm) bpy.types.register(DATA_PT_skeleton) bpy.types.register(DATA_PT_display) @@ -310,4 +305,5 @@ bpy.types.register(DATA_PT_bone_groups) bpy.types.register(DATA_PT_paths) bpy.types.register(DATA_PT_ghost) bpy.types.register(DATA_PT_iksolver_itasc) -bpy.types.register(DATA_PT_properties) + +bpy.types.register(DATA_PT_custom_props_arm) diff --git a/release/scripts/ui/properties_data_bone.py b/release/scripts/ui/properties_data_bone.py index d064b9a4897..96cf400d738 100644 --- a/release/scripts/ui/properties_data_bone.py +++ b/release/scripts/ui/properties_data_bone.py @@ -18,6 +18,7 @@ # import bpy +from rna_prop_ui import PropertyPanel narrowui = 180 @@ -47,6 +48,17 @@ class BONE_PT_context_bone(BoneButtonsPanel): row.prop(bone, "name", text="") +class BONE_PT_custom_props(BoneButtonsPanel, PropertyPanel): + + @property + def _context_path(self): + obj = bpy.context.object + if obj and obj.mode == 'POSE': + return "active_pose_bone" + else: + return "active_bone" + + class BONE_PT_transform(BoneButtonsPanel): bl_label = "Transform" @@ -376,21 +388,6 @@ class BONE_PT_deform(BoneButtonsPanel): col.prop(bone, "cyclic_offset") -class BONE_PT_properties(BoneButtonsPanel): - bl_label = "Properties" - bl_default_closed = True - - def draw(self, context): - import rna_prop_ui - # reload(rna_prop_ui) - obj = context.object - if obj and obj.mode == 'POSE': - item = "active_pose_bone" - else: - item = "active_bone" - - rna_prop_ui.draw(self.layout, context, item) - bpy.types.register(BONE_PT_context_bone) bpy.types.register(BONE_PT_transform) bpy.types.register(BONE_PT_transform_locks) @@ -398,4 +395,5 @@ bpy.types.register(BONE_PT_relations) bpy.types.register(BONE_PT_display) bpy.types.register(BONE_PT_inverse_kinematics) bpy.types.register(BONE_PT_deform) -bpy.types.register(BONE_PT_properties) + +bpy.types.register(BONE_PT_custom_props) diff --git a/release/scripts/ui/properties_data_camera.py b/release/scripts/ui/properties_data_camera.py index e8cba6be7df..d2889b6629e 100644 --- a/release/scripts/ui/properties_data_camera.py +++ b/release/scripts/ui/properties_data_camera.py @@ -18,6 +18,7 @@ # import bpy +from rna_prop_ui import PropertyPanel narrowui = 180 @@ -58,6 +59,10 @@ class DATA_PT_context_camera(DataButtonsPanel): layout.template_ID(space, "pin_id") +class DATA_PT_custom_props_camera(DataButtonsPanel, PropertyPanel): + _context_path = "object.data" + + class DATA_PT_camera(DataButtonsPanel): bl_label = "Lens" @@ -140,6 +145,9 @@ class DATA_PT_camera_display(DataButtonsPanel): sub.active = cam.show_passepartout sub.prop(cam, "passepartout_alpha", text="Alpha", slider=True) + bpy.types.register(DATA_PT_context_camera) bpy.types.register(DATA_PT_camera) bpy.types.register(DATA_PT_camera_display) + +bpy.types.register(DATA_PT_custom_props_camera) diff --git a/release/scripts/ui/properties_data_curve.py b/release/scripts/ui/properties_data_curve.py index 3ee16ad9585..442590b8946 100644 --- a/release/scripts/ui/properties_data_curve.py +++ b/release/scripts/ui/properties_data_curve.py @@ -18,6 +18,7 @@ # import bpy +from rna_prop_ui import PropertyPanel narrowui = 180 @@ -72,6 +73,10 @@ class DATA_PT_context_curve(DataButtonsPanel): layout.template_ID(ob, "data") +class DATA_PT_custom_props_curve(DataButtonsPanel, PropertyPanel): + _context_path = "object.data" + + class DATA_PT_shape_curve(DataButtonsPanel): bl_label = "Shape" @@ -377,6 +382,7 @@ class DATA_PT_textboxes(DataButtonsPanel): col.prop(box, "x", text="X") col.prop(box, "y", text="Y") + bpy.types.register(DATA_PT_context_curve) bpy.types.register(DATA_PT_shape_curve) bpy.types.register(DATA_PT_geometry_curve) @@ -385,3 +391,5 @@ bpy.types.register(DATA_PT_active_spline) bpy.types.register(DATA_PT_font) bpy.types.register(DATA_PT_paragraph) bpy.types.register(DATA_PT_textboxes) + +bpy.types.register(DATA_PT_custom_props_curve) diff --git a/release/scripts/ui/properties_data_lamp.py b/release/scripts/ui/properties_data_lamp.py index d5025983ff3..24f6486cdf6 100644 --- a/release/scripts/ui/properties_data_lamp.py +++ b/release/scripts/ui/properties_data_lamp.py @@ -18,6 +18,7 @@ # import bpy +from rna_prop_ui import PropertyPanel narrowui = 180 @@ -65,6 +66,10 @@ class DATA_PT_context_lamp(DataButtonsPanel): layout.template_ID(space, "pin_id") +class DATA_PT_custom_props_lamp(DataButtonsPanel, PropertyPanel): + _context_path = "object.data" + + class DATA_PT_lamp(DataButtonsPanel): bl_label = "Lamp" @@ -374,6 +379,7 @@ class DATA_PT_falloff_curve(DataButtonsPanel): self.layout.template_curve_mapping(lamp, "falloff_curve") + bpy.types.register(DATA_PT_context_lamp) bpy.types.register(DATA_PT_preview) bpy.types.register(DATA_PT_lamp) @@ -382,3 +388,5 @@ bpy.types.register(DATA_PT_area) bpy.types.register(DATA_PT_spot) bpy.types.register(DATA_PT_shadow) bpy.types.register(DATA_PT_sunsky) + +bpy.types.register(DATA_PT_custom_props_lamp) diff --git a/release/scripts/ui/properties_data_lattice.py b/release/scripts/ui/properties_data_lattice.py index 640f625a7de..a6221fa5e63 100644 --- a/release/scripts/ui/properties_data_lattice.py +++ b/release/scripts/ui/properties_data_lattice.py @@ -18,6 +18,7 @@ # import bpy +from rna_prop_ui import PropertyPanel narrowui = 180 @@ -58,6 +59,10 @@ class DATA_PT_context_lattice(DataButtonsPanel): layout.template_ID(space, "pin_id") +class DATA_PT_custom_props_lattice(DataButtonsPanel, PropertyPanel): + _context_path = "object.data" + + class DATA_PT_lattice(DataButtonsPanel): bl_label = "Lattice" @@ -90,5 +95,8 @@ class DATA_PT_lattice(DataButtonsPanel): layout.prop(lat, "outside") + bpy.types.register(DATA_PT_context_lattice) bpy.types.register(DATA_PT_lattice) + +bpy.types.register(DATA_PT_custom_props_lattice) diff --git a/release/scripts/ui/properties_data_mesh.py b/release/scripts/ui/properties_data_mesh.py index b8c5438ea78..a03d8d55005 100644 --- a/release/scripts/ui/properties_data_mesh.py +++ b/release/scripts/ui/properties_data_mesh.py @@ -18,6 +18,7 @@ # import bpy +from rna_prop_ui import PropertyPanel narrowui = 180 @@ -58,6 +59,10 @@ class DATA_PT_context_mesh(DataButtonsPanel): layout.template_ID(space, "pin_id") +class DATA_PT_custom_props_mesh(DataButtonsPanel, PropertyPanel): + _context_path = "object.data" + + class DATA_PT_normals(DataButtonsPanel): bl_label = "Normals" @@ -292,3 +297,6 @@ bpy.types.register(DATA_PT_vertex_groups) bpy.types.register(DATA_PT_shape_keys) bpy.types.register(DATA_PT_uv_texture) bpy.types.register(DATA_PT_vertex_colors) + +bpy.types.register(DATA_PT_custom_props_mesh) + diff --git a/release/scripts/ui/properties_data_metaball.py b/release/scripts/ui/properties_data_metaball.py index e36bdc991e1..8951693aaac 100644 --- a/release/scripts/ui/properties_data_metaball.py +++ b/release/scripts/ui/properties_data_metaball.py @@ -18,6 +18,7 @@ # import bpy +from rna_prop_ui import PropertyPanel narrowui = 180 @@ -58,6 +59,10 @@ class DATA_PT_context_metaball(DataButtonsPanel): layout.template_ID(space, "pin_id") +class DATA_PT_custom_props_metaball(DataButtonsPanel, PropertyPanel): + _context_path = "object.data" + + class DATA_PT_metaball(DataButtonsPanel): bl_label = "Metaball" @@ -133,3 +138,7 @@ class DATA_PT_metaball_element(DataButtonsPanel): bpy.types.register(DATA_PT_context_metaball) bpy.types.register(DATA_PT_metaball) bpy.types.register(DATA_PT_metaball_element) + +bpy.types.register(DATA_PT_custom_props_metaball) + + diff --git a/release/scripts/ui/properties_material.py b/release/scripts/ui/properties_material.py index a48b3b1a30a..dfd4270e97b 100644 --- a/release/scripts/ui/properties_material.py +++ b/release/scripts/ui/properties_material.py @@ -18,6 +18,7 @@ # import bpy +from rna_prop_ui import PropertyPanel narrowui = 180 @@ -125,6 +126,11 @@ class MATERIAL_PT_context_material(MaterialButtonsPanel): layout.prop(mat, "type", text="") +class MATERIAL_PT_custom_props(MaterialButtonsPanel, PropertyPanel): + COMPAT_ENGINES = {'BLENDER_RENDER'} + _context_path = "material" + + class MATERIAL_PT_shading(MaterialButtonsPanel): bl_label = "Shading" COMPAT_ENGINES = {'BLENDER_RENDER', 'BLENDER_GAME'} @@ -880,3 +886,5 @@ bpy.types.register(MATERIAL_PT_volume_shading) bpy.types.register(MATERIAL_PT_volume_lighting) bpy.types.register(MATERIAL_PT_volume_transp) bpy.types.register(MATERIAL_PT_volume_integration) + +bpy.types.register(MATERIAL_PT_custom_props) diff --git a/release/scripts/ui/properties_object.py b/release/scripts/ui/properties_object.py index 05a48225f82..3b539506552 100644 --- a/release/scripts/ui/properties_object.py +++ b/release/scripts/ui/properties_object.py @@ -18,6 +18,7 @@ # import bpy +from rna_prop_ui import PropertyPanel narrowui = 180 @@ -42,6 +43,10 @@ class OBJECT_PT_context_object(ObjectButtonsPanel): row.prop(ob, "name", text="") +class OBJECT_PT_custom_props(ObjectButtonsPanel, PropertyPanel): + _context_path = "object" + + class OBJECT_PT_transform(ObjectButtonsPanel): bl_label = "Transform" @@ -300,16 +305,6 @@ class OBJECT_PT_animation(ObjectButtonsPanel): row.active = (ob.parent is not None) -class OBJECT_PT_properties(ObjectButtonsPanel): - bl_label = "Properties" - bl_default_closed = True - - def draw(self, context): - import rna_prop_ui - # reload(rna_prop_ui) - - rna_prop_ui.draw(self.layout, context, "object") - bpy.types.register(OBJECT_PT_context_object) bpy.types.register(OBJECT_PT_transform) bpy.types.register(OBJECT_PT_transform_locks) @@ -318,4 +313,5 @@ bpy.types.register(OBJECT_PT_groups) bpy.types.register(OBJECT_PT_display) bpy.types.register(OBJECT_PT_duplication) bpy.types.register(OBJECT_PT_animation) -bpy.types.register(OBJECT_PT_properties) + +bpy.types.register(OBJECT_PT_custom_props) diff --git a/release/scripts/ui/properties_particle.py b/release/scripts/ui/properties_particle.py index a33a1a12f1b..14278ea197c 100644 --- a/release/scripts/ui/properties_particle.py +++ b/release/scripts/ui/properties_particle.py @@ -18,6 +18,7 @@ # import bpy +from rna_prop_ui import PropertyPanel from properties_physics_common import point_cache_ui from properties_physics_common import effector_weights_ui @@ -47,7 +48,7 @@ class ParticleButtonsPanel(bpy.types.Panel): return particle_panel_poll(context) -class PARTICLE_PT_particles(ParticleButtonsPanel): +class PARTICLE_PT_context_particles(ParticleButtonsPanel): bl_label = "" bl_show_header = False @@ -130,6 +131,10 @@ class PARTICLE_PT_particles(ParticleButtonsPanel): split.prop(psys, "reactor_target_particle_system", text="Particle System") +class PARTICLE_PT_custom_props(ParticleButtonsPanel, PropertyPanel): + _context_path = "particle_system.settings" + + class PARTICLE_PT_emission(ParticleButtonsPanel): bl_label = "Emission" @@ -992,7 +997,7 @@ class PARTICLE_PT_vertexgroups(ParticleButtonsPanel): row.prop_object(psys, "vertex_group_field", ob, "vertex_groups", text="Field") row.prop(psys, "vertex_group_field_negate", text="") -bpy.types.register(PARTICLE_PT_particles) +bpy.types.register(PARTICLE_PT_context_particles) bpy.types.register(PARTICLE_PT_hair_dynamics) bpy.types.register(PARTICLE_PT_cache) bpy.types.register(PARTICLE_PT_emission) @@ -1006,3 +1011,5 @@ bpy.types.register(PARTICLE_PT_children) bpy.types.register(PARTICLE_PT_field_weights) bpy.types.register(PARTICLE_PT_force_fields) bpy.types.register(PARTICLE_PT_vertexgroups) + +bpy.types.register(PARTICLE_PT_custom_props) diff --git a/release/scripts/ui/properties_scene.py b/release/scripts/ui/properties_scene.py index c059339c14e..68936a45759 100644 --- a/release/scripts/ui/properties_scene.py +++ b/release/scripts/ui/properties_scene.py @@ -18,6 +18,7 @@ # import bpy +from rna_prop_ui import PropertyPanel narrowui = 180 @@ -48,6 +49,10 @@ class SCENE_PT_scene(SceneButtonsPanel): layout.prop(scene, "set", text="") +class SCENE_PT_custom_props(SceneButtonsPanel, PropertyPanel): + _context_path = "scene" + + class SCENE_PT_unit(SceneButtonsPanel): bl_label = "Units" COMPAT_ENGINES = {'BLENDER_RENDER'} @@ -178,3 +183,6 @@ bpy.types.register(SCENE_PT_unit) bpy.types.register(SCENE_PT_keying_sets) bpy.types.register(SCENE_PT_keying_set_paths) bpy.types.register(SCENE_PT_physics) + +bpy.types.register(SCENE_PT_custom_props) + diff --git a/release/scripts/ui/properties_texture.py b/release/scripts/ui/properties_texture.py index 711ba4f8a02..7b70b355731 100644 --- a/release/scripts/ui/properties_texture.py +++ b/release/scripts/ui/properties_texture.py @@ -18,6 +18,7 @@ # import bpy +from rna_prop_ui import PropertyPanel narrowui = 180 @@ -149,6 +150,13 @@ class TEXTURE_PT_context_texture(TextureButtonsPanel): layout.prop(tex, "type", text="") +class TEXTURE_PT_custom_props(TextureButtonsPanel, PropertyPanel): + _context_path = "texture" + + def poll(self, context): # use alternate poll since NONE texture type is ok + return context.texture + + class TEXTURE_PT_colors(TextureButtonsPanel): bl_label = "Colors" bl_default_closed = True @@ -976,3 +984,5 @@ bpy.types.register(TEXTURE_PT_pointdensity_turbulence) bpy.types.register(TEXTURE_PT_colors) bpy.types.register(TEXTURE_PT_mapping) bpy.types.register(TEXTURE_PT_influence) + +bpy.types.register(TEXTURE_PT_custom_props) diff --git a/release/scripts/ui/properties_world.py b/release/scripts/ui/properties_world.py index b23a0dffbad..e488265d76d 100644 --- a/release/scripts/ui/properties_world.py +++ b/release/scripts/ui/properties_world.py @@ -18,6 +18,7 @@ # import bpy +from rna_prop_ui import PropertyPanel narrowui = 180 @@ -69,6 +70,10 @@ class WORLD_PT_context_world(WorldButtonsPanel): layout.template_ID(scene, "world", new="world.new") +class WORLD_PT_custom_props(WorldButtonsPanel, PropertyPanel): + _context_path = "world" + + class WORLD_PT_world(WorldButtonsPanel): bl_label = "World" COMPAT_ENGINES = {'BLENDER_RENDER'} @@ -232,3 +237,5 @@ bpy.types.register(WORLD_PT_world) bpy.types.register(WORLD_PT_ambient_occlusion) bpy.types.register(WORLD_PT_mist) bpy.types.register(WORLD_PT_stars) + +bpy.types.register(WORLD_PT_custom_props)