[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [33734] trunk/blender/release/scripts: bugfix [#25240] Custom properties panel on pinned data fail.
Campbell Barton
ideasman42 at gmail.com
Fri Dec 17 11:33:28 CET 2010
Revision: 33734
http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=33734
Author: campbellbarton
Date: 2010-12-17 11:33:28 +0100 (Fri, 17 Dec 2010)
Log Message:
-----------
bugfix [#25240] Custom properties panel on pinned data fail.
Modified Paths:
--------------
trunk/blender/release/scripts/modules/rna_prop_ui.py
trunk/blender/release/scripts/ui/properties_data_armature.py
trunk/blender/release/scripts/ui/properties_data_bone.py
trunk/blender/release/scripts/ui/properties_data_camera.py
trunk/blender/release/scripts/ui/properties_data_curve.py
trunk/blender/release/scripts/ui/properties_data_lamp.py
trunk/blender/release/scripts/ui/properties_data_lattice.py
trunk/blender/release/scripts/ui/properties_data_mesh.py
trunk/blender/release/scripts/ui/properties_data_metaball.py
trunk/blender/release/scripts/ui/properties_material.py
trunk/blender/release/scripts/ui/properties_object.py
trunk/blender/release/scripts/ui/properties_particle.py
trunk/blender/release/scripts/ui/properties_scene.py
trunk/blender/release/scripts/ui/properties_texture.py
trunk/blender/release/scripts/ui/properties_world.py
Modified: trunk/blender/release/scripts/modules/rna_prop_ui.py
===================================================================
--- trunk/blender/release/scripts/modules/rna_prop_ui.py 2010-12-17 08:53:49 UTC (rev 33733)
+++ trunk/blender/release/scripts/modules/rna_prop_ui.py 2010-12-17 10:33:28 UTC (rev 33734)
@@ -58,8 +58,21 @@
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
prop.property = key
@@ -69,12 +82,14 @@
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 @@
@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)
Modified: trunk/blender/release/scripts/ui/properties_data_armature.py
===================================================================
--- trunk/blender/release/scripts/ui/properties_data_armature.py 2010-12-17 08:53:49 UTC (rev 33733)
+++ trunk/blender/release/scripts/ui/properties_data_armature.py 2010-12-17 10:33:28 UTC (rev 33734)
@@ -101,7 +101,8 @@
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_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():
Modified: trunk/blender/release/scripts/ui/properties_data_bone.py
===================================================================
--- trunk/blender/release/scripts/ui/properties_data_bone.py 2010-12-17 08:53:49 UTC (rev 33733)
+++ trunk/blender/release/scripts/ui/properties_data_bone.py 2010-12-17 10:33:28 UTC (rev 33734)
@@ -135,7 +135,7 @@
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 @@
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_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):
Modified: trunk/blender/release/scripts/ui/properties_data_camera.py
===================================================================
--- trunk/blender/release/scripts/ui/properties_data_camera.py 2010-12-17 08:53:49 UTC (rev 33733)
+++ trunk/blender/release/scripts/ui/properties_data_camera.py 2010-12-17 10:33:28 UTC (rev 33734)
@@ -135,6 +135,7 @@
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():
Modified: trunk/blender/release/scripts/ui/properties_data_curve.py
===================================================================
--- trunk/blender/release/scripts/ui/properties_data_curve.py 2010-12-17 08:53:49 UTC (rev 33733)
+++ trunk/blender/release/scripts/ui/properties_data_curve.py 2010-12-17 10:33:28 UTC (rev 33734)
@@ -396,6 +396,7 @@
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():
Modified: trunk/blender/release/scripts/ui/properties_data_lamp.py
===================================================================
--- trunk/blender/release/scripts/ui/properties_data_lamp.py 2010-12-17 08:53:49 UTC (rev 33733)
+++ trunk/blender/release/scripts/ui/properties_data_lamp.py 2010-12-17 10:33:28 UTC (rev 33734)
@@ -390,6 +390,7 @@
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():
Modified: trunk/blender/release/scripts/ui/properties_data_lattice.py
===================================================================
--- trunk/blender/release/scripts/ui/properties_data_lattice.py 2010-12-17 08:53:49 UTC (rev 33733)
+++ trunk/blender/release/scripts/ui/properties_data_lattice.py 2010-12-17 10:33:28 UTC (rev 33734)
@@ -85,6 +85,7 @@
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():
Modified: trunk/blender/release/scripts/ui/properties_data_mesh.py
===================================================================
--- trunk/blender/release/scripts/ui/properties_data_mesh.py 2010-12-17 08:53:49 UTC (rev 33733)
+++ trunk/blender/release/scripts/ui/properties_data_mesh.py 2010-12-17 10:33:28 UTC (rev 33734)
@@ -302,7 +302,7 @@
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_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():
Modified: trunk/blender/release/scripts/ui/properties_data_metaball.py
===================================================================
--- trunk/blender/release/scripts/ui/properties_data_metaball.py 2010-12-17 08:53:49 UTC (rev 33733)
+++ trunk/blender/release/scripts/ui/properties_data_metaball.py 2010-12-17 10:33:28 UTC (rev 33734)
@@ -115,9 +115,10 @@
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():
Modified: trunk/blender/release/scripts/ui/properties_material.py
===================================================================
--- trunk/blender/release/scripts/ui/properties_material.py 2010-12-17 08:53:49 UTC (rev 33733)
+++ trunk/blender/release/scripts/ui/properties_material.py 2010-12-17 10:33:28 UTC (rev 33734)
@@ -892,6 +892,7 @@
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():
Modified: trunk/blender/release/scripts/ui/properties_object.py
===================================================================
--- trunk/blender/release/scripts/ui/properties_object.py 2010-12-17 08:53:49 UTC (rev 33733)
+++ trunk/blender/release/scripts/ui/properties_object.py 2010-12-17 10:33:28 UTC (rev 33734)
@@ -335,9 +335,10 @@
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():
Modified: trunk/blender/release/scripts/ui/properties_particle.py
===================================================================
--- trunk/blender/release/scripts/ui/properties_particle.py 2010-12-17 08:53:49 UTC (rev 33733)
+++ trunk/blender/release/scripts/ui/properties_particle.py 2010-12-17 10:33:28 UTC (rev 33734)
@@ -1093,6 +1093,7 @@
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():
Modified: trunk/blender/release/scripts/ui/properties_scene.py
===================================================================
--- trunk/blender/release/scripts/ui/properties_scene.py 2010-12-17 08:53:49 UTC (rev 33733)
+++ trunk/blender/release/scripts/ui/properties_scene.py 2010-12-17 10:33:28 UTC (rev 33734)
@@ -197,6 +197,7 @@
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 *
Modified: trunk/blender/release/scripts/ui/properties_texture.py
@@ Diff output truncated at 10240 characters. @@
More information about the Bf-blender-cvs
mailing list