Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCampbell Barton <ideasman42@gmail.com>2010-12-17 13:33:28 +0300
committerCampbell Barton <ideasman42@gmail.com>2010-12-17 13:33:28 +0300
commit676d795d7e215052246507a1c8809e6464a696df (patch)
tree1caf186fc971aabbb637867a326e1baba49ec761 /release
parent0ec7f95245478baa4b3608888d70db72cca5348b (diff)
bugfix [#25240] Custom properties panel on pinned data fail.
Diffstat (limited to 'release')
-rw-r--r--release/scripts/modules/rna_prop_ui.py32
-rw-r--r--release/scripts/ui/properties_data_armature.py4
-rw-r--r--release/scripts/ui/properties_data_bone.py5
-rw-r--r--release/scripts/ui/properties_data_camera.py1
-rw-r--r--release/scripts/ui/properties_data_curve.py1
-rw-r--r--release/scripts/ui/properties_data_lamp.py1
-rw-r--r--release/scripts/ui/properties_data_lattice.py1
-rw-r--r--release/scripts/ui/properties_data_mesh.py3
-rw-r--r--release/scripts/ui/properties_data_metaball.py3
-rw-r--r--release/scripts/ui/properties_material.py1
-rw-r--r--release/scripts/ui/properties_object.py3
-rw-r--r--release/scripts/ui/properties_particle.py1
-rw-r--r--release/scripts/ui/properties_scene.py1
-rw-r--r--release/scripts/ui/properties_texture.py1
-rw-r--r--release/scripts/ui/properties_world.py1
15 files changed, 49 insertions, 10 deletions
diff --git a/release/scripts/modules/rna_prop_ui.py b/release/scripts/modules/rna_prop_ui.py
index cbe0b668e77..7c77a01d646 100644
--- a/release/scripts/modules/rna_prop_ui.py
+++ b/release/scripts/modules/rna_prop_ui.py
@@ -58,7 +58,20 @@ def rna_idprop_ui_prop_clear(item, prop):
pass
-def draw(layout, context, context_member, use_edit=True):
+def rna_idprop_context_value(context, context_member, property_type):
+ space = context.space_data
+ pin_id = space.pin_id
+
+ if pin_id and isinstance(pin_id, property_type):
+ rna_item = pin_id
+ context_member = "space_data.pin_id"
+ else:
+ rna_item = eval("context." + context_member)
+
+ return rna_item, context_member
+
+
+def draw(layout, context, context_member, property_type, use_edit=True):
def assign_props(prop, val, key):
prop.data_path = context_member
@@ -69,12 +82,14 @@ def draw(layout, context, context_member, use_edit=True):
except:
pass
- rna_item = eval("context." + context_member)
+ rna_item, context_member = rna_idprop_context_value(context, context_member, property_type)
# poll should really get this...
if not rna_item:
return
+ assert(isinstance(rna_item, property_type))
+
items = rna_item.items()
items.sort()
@@ -139,7 +154,16 @@ class PropertyPanel():
@classmethod
def poll(cls, context):
- return bool(eval("context.%s" % cls._context_path))
+ rna_item, context_member = rna_idprop_context_value(context, cls._context_path, cls._property_type)
+ return bool(rna_item)
+
+ """
+ def draw_header(self, context):
+ rna_item, context_member = rna_idprop_context_value(context, self._context_path, self._property_type)
+ tot = len(rna_item.keys())
+ if tot:
+ self.layout().label("%d:" % tot)
+ """
def draw(self, context):
- draw(self.layout, context, self._context_path)
+ draw(self.layout, context, self._context_path, self._property_type)
diff --git a/release/scripts/ui/properties_data_armature.py b/release/scripts/ui/properties_data_armature.py
index 5cb7016a908..5e13560136b 100644
--- a/release/scripts/ui/properties_data_armature.py
+++ b/release/scripts/ui/properties_data_armature.py
@@ -101,7 +101,8 @@ class DATA_PT_display(ArmatureButtonsPanel, bpy.types.Panel):
col = split.column()
col.prop(arm, "show_group_colors", text="Colors")
- col.prop(ob, "show_x_ray", text="X-Ray")
+ if ob:
+ col.prop(ob, "show_x_ray", text="X-Ray")
col.prop(arm, "use_deform_delay", text="Delay Refresh")
@@ -287,6 +288,7 @@ class DATA_PT_onion_skinning(OnionSkinButtonsPanel): # , bpy.types.Panel): # in
class DATA_PT_custom_props_arm(ArmatureButtonsPanel, PropertyPanel, bpy.types.Panel):
COMPAT_ENGINES = {'BLENDER_RENDER', 'BLENDER_GAME'}
_context_path = "object.data"
+ _property_type = bpy.types.Armature
def register():
diff --git a/release/scripts/ui/properties_data_bone.py b/release/scripts/ui/properties_data_bone.py
index 488aa01a475..30a4c635f6f 100644
--- a/release/scripts/ui/properties_data_bone.py
+++ b/release/scripts/ui/properties_data_bone.py
@@ -135,7 +135,7 @@ class BONE_PT_relations(BoneButtonsPanel, bpy.types.Panel):
bone = context.bone
arm = context.armature
- if bone:
+ if ob and bone:
pchan = ob.pose.bones[bone.name]
else:
bone = context.edit_bone
@@ -185,7 +185,7 @@ class BONE_PT_display(BoneButtonsPanel, bpy.types.Panel):
ob = context.object
bone = context.bone
- if bone:
+ if ob and bone:
pchan = ob.pose.bones[bone.name]
else:
bone = context.edit_bone
@@ -348,6 +348,7 @@ class BONE_PT_deform(BoneButtonsPanel, bpy.types.Panel):
class BONE_PT_custom_props(BoneButtonsPanel, PropertyPanel, bpy.types.Panel):
COMPAT_ENGINES = {'BLENDER_RENDER', 'BLENDER_GAME'}
+ _property_type = bpy.types.Bone, bpy.types.EditBone, bpy.types.PoseBone
@property
def _context_path(self):
diff --git a/release/scripts/ui/properties_data_camera.py b/release/scripts/ui/properties_data_camera.py
index ce8f9f7ef59..9c4f19b4c51 100644
--- a/release/scripts/ui/properties_data_camera.py
+++ b/release/scripts/ui/properties_data_camera.py
@@ -135,6 +135,7 @@ class DATA_PT_camera_display(CameraButtonsPanel, bpy.types.Panel):
class DATA_PT_custom_props_camera(CameraButtonsPanel, PropertyPanel, bpy.types.Panel):
COMPAT_ENGINES = {'BLENDER_RENDER', 'BLENDER_GAME'}
_context_path = "object.data"
+ _property_type = bpy.types.Camera
def register():
diff --git a/release/scripts/ui/properties_data_curve.py b/release/scripts/ui/properties_data_curve.py
index 821f815ed5e..33dcd8d4c7c 100644
--- a/release/scripts/ui/properties_data_curve.py
+++ b/release/scripts/ui/properties_data_curve.py
@@ -396,6 +396,7 @@ class DATA_PT_textboxes(CurveButtonsPanel, bpy.types.Panel):
class DATA_PT_custom_props_curve(CurveButtonsPanel, PropertyPanel, bpy.types.Panel):
COMPAT_ENGINES = {'BLENDER_RENDER', 'BLENDER_GAME'}
_context_path = "object.data"
+ _property_type = bpy.types.Curve
def register():
diff --git a/release/scripts/ui/properties_data_lamp.py b/release/scripts/ui/properties_data_lamp.py
index 72e95989b06..9961bf1e77f 100644
--- a/release/scripts/ui/properties_data_lamp.py
+++ b/release/scripts/ui/properties_data_lamp.py
@@ -390,6 +390,7 @@ class DATA_PT_falloff_curve(DataButtonsPanel, bpy.types.Panel):
class DATA_PT_custom_props_lamp(DataButtonsPanel, PropertyPanel, bpy.types.Panel):
COMPAT_ENGINES = {'BLENDER_RENDER', 'BLENDER_GAME'}
_context_path = "object.data"
+ _property_type = bpy.types.Lamp
def register():
diff --git a/release/scripts/ui/properties_data_lattice.py b/release/scripts/ui/properties_data_lattice.py
index 469bd07b691..ae9e9e6f3a8 100644
--- a/release/scripts/ui/properties_data_lattice.py
+++ b/release/scripts/ui/properties_data_lattice.py
@@ -85,6 +85,7 @@ class DATA_PT_lattice(DataButtonsPanel, bpy.types.Panel):
class DATA_PT_custom_props_lattice(DataButtonsPanel, PropertyPanel, bpy.types.Panel):
COMPAT_ENGINES = {'BLENDER_RENDER', 'BLENDER_GAME'}
_context_path = "object.data"
+ _property_type = bpy.types.Lattice
def register():
diff --git a/release/scripts/ui/properties_data_mesh.py b/release/scripts/ui/properties_data_mesh.py
index c26a36d8ef5..4814d067436 100644
--- a/release/scripts/ui/properties_data_mesh.py
+++ b/release/scripts/ui/properties_data_mesh.py
@@ -302,7 +302,7 @@ class DATA_PT_texface(MeshButtonsPanel, bpy.types.Panel):
split = layout.split()
col = split.column()
-
+
col.prop(tf, "use_image")
col.prop(tf, "use_light")
col.prop(tf, "hide")
@@ -352,6 +352,7 @@ class DATA_PT_vertex_colors(MeshButtonsPanel, bpy.types.Panel):
class DATA_PT_custom_props_mesh(MeshButtonsPanel, PropertyPanel, bpy.types.Panel):
COMPAT_ENGINES = {'BLENDER_RENDER', 'BLENDER_GAME'}
_context_path = "object.data"
+ _property_type = bpy.types.Mesh
def register():
diff --git a/release/scripts/ui/properties_data_metaball.py b/release/scripts/ui/properties_data_metaball.py
index 051841562e0..6cb58cb4939 100644
--- a/release/scripts/ui/properties_data_metaball.py
+++ b/release/scripts/ui/properties_data_metaball.py
@@ -115,9 +115,10 @@ class DATA_PT_metaball_element(DataButtonsPanel, bpy.types.Panel):
col.prop(metaelem, "size_y", text="Y")
-class DATA_PT_custom_props_metaball(PropertyPanel, DataButtonsPanel, bpy.types.Panel):
+class DATA_PT_custom_props_metaball(DataButtonsPanel, PropertyPanel, bpy.types.Panel):
COMPAT_ENGINES = {'BLENDER_RENDER', 'BLENDER_GAME'}
_context_path = "object.data"
+ _property_type = bpy.types.MetaBall
def register():
diff --git a/release/scripts/ui/properties_material.py b/release/scripts/ui/properties_material.py
index 6877d5da43a..6bfebc444b9 100644
--- a/release/scripts/ui/properties_material.py
+++ b/release/scripts/ui/properties_material.py
@@ -892,6 +892,7 @@ class MATERIAL_PT_volume_options(VolumeButtonsPanel, bpy.types.Panel):
class MATERIAL_PT_custom_props(MaterialButtonsPanel, PropertyPanel, bpy.types.Panel):
COMPAT_ENGINES = {'BLENDER_RENDER', 'BLENDER_GAME'}
_context_path = "material"
+ _property_type = bpy.types.Material
def register():
diff --git a/release/scripts/ui/properties_object.py b/release/scripts/ui/properties_object.py
index 6390f13b668..d0184c2d0af 100644
--- a/release/scripts/ui/properties_object.py
+++ b/release/scripts/ui/properties_object.py
@@ -335,9 +335,10 @@ class OBJECT_PT_onion_skinning(OnionSkinButtonsPanel): # , bpy.types.Panel): #
self.draw_settings(context, ob.animation_visualisation)
-class OBJECT_PT_custom_props(bpy.types.Panel, PropertyPanel, ObjectButtonsPanel):
+class OBJECT_PT_custom_props(ObjectButtonsPanel, PropertyPanel, bpy.types.Panel):
COMPAT_ENGINES = {'BLENDER_RENDER', 'BLENDER_GAME'}
_context_path = "object"
+ _property_type = bpy.types.Object
def register():
diff --git a/release/scripts/ui/properties_particle.py b/release/scripts/ui/properties_particle.py
index af60c5fd784..e8bfdf913f1 100644
--- a/release/scripts/ui/properties_particle.py
+++ b/release/scripts/ui/properties_particle.py
@@ -1093,6 +1093,7 @@ class PARTICLE_PT_vertexgroups(ParticleButtonsPanel, bpy.types.Panel):
class PARTICLE_PT_custom_props(ParticleButtonsPanel, PropertyPanel, bpy.types.Panel):
COMPAT_ENGINES = {'BLENDER_RENDER'}
_context_path = "particle_system.settings"
+ _property_type = bpy.types.ParticleSettings
def register():
diff --git a/release/scripts/ui/properties_scene.py b/release/scripts/ui/properties_scene.py
index 4855b309bf4..bc735e57493 100644
--- a/release/scripts/ui/properties_scene.py
+++ b/release/scripts/ui/properties_scene.py
@@ -197,6 +197,7 @@ class SCENE_PT_simplify(SceneButtonsPanel, bpy.types.Panel):
class SCENE_PT_custom_props(SceneButtonsPanel, PropertyPanel, bpy.types.Panel):
COMPAT_ENGINES = {'BLENDER_RENDER', 'BLENDER_GAME'}
_context_path = "scene"
+ _property_type = bpy.types.Scene
from bpy.props import *
diff --git a/release/scripts/ui/properties_texture.py b/release/scripts/ui/properties_texture.py
index b343035b29a..c6fa942eb2d 100644
--- a/release/scripts/ui/properties_texture.py
+++ b/release/scripts/ui/properties_texture.py
@@ -1003,6 +1003,7 @@ class TEXTURE_PT_influence(TextureSlotPanel, bpy.types.Panel):
class TEXTURE_PT_custom_props(TextureButtonsPanel, PropertyPanel, bpy.types.Panel):
COMPAT_ENGINES = {'BLENDER_RENDER', 'BLENDER_GAME'}
_context_path = "texture"
+ _property_type = bpy.types.Texture
def register():
diff --git a/release/scripts/ui/properties_world.py b/release/scripts/ui/properties_world.py
index 76fb70f47d1..8b6ad827c1d 100644
--- a/release/scripts/ui/properties_world.py
+++ b/release/scripts/ui/properties_world.py
@@ -264,6 +264,7 @@ class WORLD_PT_stars(WorldButtonsPanel, bpy.types.Panel):
class WORLD_PT_custom_props(WorldButtonsPanel, PropertyPanel, bpy.types.Panel):
COMPAT_ENGINES = {'BLENDER_RENDER', 'BLENDER_GAME'}
_context_path = "world"
+ _property_type = bpy.types.World
def register():