[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [33951] trunk/blender: revert part of Tons commit r33884.
Campbell Barton
ideasman42 at gmail.com
Thu Dec 30 13:22:28 CET 2010
Revision: 33951
http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=33951
Author: campbellbarton
Date: 2010-12-30 13:22:28 +0100 (Thu, 30 Dec 2010)
Log Message:
-----------
revert part of Tons commit r33884.
- rather then use unlink="None", just don't pass unlink as a keyword. This is more pythonic.
- added an RNA flag for properties which cant be unlinked by setting to None.
Modified Paths:
--------------
trunk/blender/release/scripts/ui/properties_data_armature.py
trunk/blender/release/scripts/ui/properties_data_curve.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_object.py
trunk/blender/source/blender/editors/animation/drivers.c
trunk/blender/source/blender/editors/interface/interface_templates.c
trunk/blender/source/blender/makesrna/RNA_types.h
trunk/blender/source/blender/makesrna/intern/rna_object.c
Modified: trunk/blender/release/scripts/ui/properties_data_armature.py
===================================================================
--- trunk/blender/release/scripts/ui/properties_data_armature.py 2010-12-30 11:35:56 UTC (rev 33950)
+++ trunk/blender/release/scripts/ui/properties_data_armature.py 2010-12-30 12:22:28 UTC (rev 33951)
@@ -43,9 +43,9 @@
space = context.space_data
if ob:
- layout.template_ID(ob, "data", unlink="None")
+ layout.template_ID(ob, "data")
elif arm:
- layout.template_ID(space, "pin_id", unlink="None")
+ layout.template_ID(space, "pin_id")
class DATA_PT_skeleton(ArmatureButtonsPanel, bpy.types.Panel):
Modified: trunk/blender/release/scripts/ui/properties_data_curve.py
===================================================================
--- trunk/blender/release/scripts/ui/properties_data_curve.py 2010-12-30 11:35:56 UTC (rev 33950)
+++ trunk/blender/release/scripts/ui/properties_data_curve.py 2010-12-30 12:22:28 UTC (rev 33951)
@@ -60,9 +60,9 @@
space = context.space_data
if ob:
- layout.template_ID(ob, "data", unlink="None")
+ layout.template_ID(ob, "data")
elif curve:
- layout.template_ID(space, "pin_id", unlink="None") # XXX: broken
+ layout.template_ID(space, "pin_id") # XXX: broken
class DATA_PT_shape_curve(CurveButtonsPanel, bpy.types.Panel):
Modified: trunk/blender/release/scripts/ui/properties_data_mesh.py
===================================================================
--- trunk/blender/release/scripts/ui/properties_data_mesh.py 2010-12-30 11:35:56 UTC (rev 33950)
+++ trunk/blender/release/scripts/ui/properties_data_mesh.py 2010-12-30 12:22:28 UTC (rev 33951)
@@ -71,9 +71,9 @@
space = context.space_data
if ob:
- layout.template_ID(ob, "data", unlink="None")
+ layout.template_ID(ob, "data")
elif mesh:
- layout.template_ID(space, "pin_id", unlink="None")
+ layout.template_ID(space, "pin_id")
class DATA_PT_normals(MeshButtonsPanel, bpy.types.Panel):
Modified: trunk/blender/release/scripts/ui/properties_data_metaball.py
===================================================================
--- trunk/blender/release/scripts/ui/properties_data_metaball.py 2010-12-30 11:35:56 UTC (rev 33950)
+++ trunk/blender/release/scripts/ui/properties_data_metaball.py 2010-12-30 12:22:28 UTC (rev 33951)
@@ -43,9 +43,9 @@
space = context.space_data
if ob:
- layout.template_ID(ob, "data", unlink="None")
+ layout.template_ID(ob, "data")
elif mball:
- layout.template_ID(space, "pin_id", unlink="None")
+ layout.template_ID(space, "pin_id")
class DATA_PT_metaball(DataButtonsPanel, bpy.types.Panel):
Modified: trunk/blender/release/scripts/ui/properties_object.py
===================================================================
--- trunk/blender/release/scripts/ui/properties_object.py 2010-12-30 11:35:56 UTC (rev 33950)
+++ trunk/blender/release/scripts/ui/properties_object.py 2010-12-30 12:22:28 UTC (rev 33951)
@@ -37,7 +37,7 @@
ob = context.object
if space.use_pin_id:
- layout.template_ID(space, "pin_id", unlink="None")
+ layout.template_ID(space, "pin_id")
else:
row = layout.row()
row.label(text="", icon='OBJECT_DATA')
Modified: trunk/blender/source/blender/editors/animation/drivers.c
===================================================================
--- trunk/blender/source/blender/editors/animation/drivers.c 2010-12-30 11:35:56 UTC (rev 33950)
+++ trunk/blender/source/blender/editors/animation/drivers.c 2010-12-30 12:22:28 UTC (rev 33951)
@@ -212,7 +212,7 @@
/* Main Driver Management API calls:
* Remove the driver for the specified property on the given ID block (if available)
*/
-short ANIM_remove_driver (ReportList *reports, ID *id, const char rna_path[], int array_index, short UNUSED(flag))
+short ANIM_remove_driver (ReportList *UNUSED(reports), ID *id, const char rna_path[], int array_index, short UNUSED(flag))
{
AnimData *adt;
FCurve *fcu;
Modified: trunk/blender/source/blender/editors/interface/interface_templates.c
===================================================================
--- trunk/blender/source/blender/editors/interface/interface_templates.c 2010-12-30 11:35:56 UTC (rev 33950)
+++ trunk/blender/source/blender/editors/interface/interface_templates.c 2010-12-30 12:22:28 UTC (rev 33951)
@@ -450,7 +450,7 @@
}
/* delete button */
- if(id && (flag & UI_ID_DELETE)) {
+ if(id && (flag & UI_ID_DELETE) && (RNA_property_flag(template->prop) & PROP_NEVER_UNLINK)==0) {
if(unlinkop) {
but= uiDefIconButO(block, BUT, unlinkop, WM_OP_INVOKE_REGION_WIN, ICON_X, 0, 0, UI_UNIT_X, UI_UNIT_Y, NULL);
/* so we can access the template from operators, font unlinking needs this */
@@ -494,8 +494,6 @@
flag |= UI_ID_ADD_NEW;
if(openop)
flag |= UI_ID_OPEN;
- if(unlinkop && strcmp(unlinkop, "None") == 0)
- flag &= ~UI_ID_DELETE;
type= RNA_property_pointer_type(ptr, prop);
template->idlb= which_libbase(CTX_data_main(C), RNA_type_to_ID_code(type));
Modified: trunk/blender/source/blender/makesrna/RNA_types.h
===================================================================
--- trunk/blender/source/blender/makesrna/RNA_types.h 2010-12-30 11:35:56 UTC (rev 33950)
+++ trunk/blender/source/blender/makesrna/RNA_types.h 2010-12-30 12:22:28 UTC (rev 33951)
@@ -167,6 +167,10 @@
* only apply this to types that are derived from an ID ()*/
PROP_ID_SELF_CHECK = 1<<20,
PROP_NEVER_NULL = 1<<18,
+ /* currently only used for UI, this is similar to PROP_NEVER_NULL
+ * except that the value may be NULL at times, used for ObData, where an Empty's will be NULL
+ * but setting NULL on a mesh object is not possible. So, if its not NULL, setting NULL cant be done! */
+ PROP_NEVER_UNLINK = 1<<25,
/* flag contains multiple enums.
* note: not to be confused with prop->enumbitflags
Modified: trunk/blender/source/blender/makesrna/intern/rna_object.c
===================================================================
--- trunk/blender/source/blender/makesrna/intern/rna_object.c 2010-12-30 11:35:56 UTC (rev 33950)
+++ trunk/blender/source/blender/makesrna/intern/rna_object.c 2010-12-30 12:22:28 UTC (rev 33951)
@@ -1680,7 +1680,7 @@
RNA_def_property_struct_type(prop, "ID");
RNA_def_property_pointer_funcs(prop, NULL, "rna_Object_data_set", "rna_Object_data_typef", NULL);
RNA_def_property_editable_func(prop, "rna_Object_data_editable");
- RNA_def_property_flag(prop, PROP_EDITABLE);
+ RNA_def_property_flag(prop, PROP_EDITABLE|PROP_NEVER_UNLINK);
RNA_def_property_ui_text(prop, "Data", "Object data");
RNA_def_property_update(prop, 0, "rna_Object_internal_update_data");
More information about the Bf-blender-cvs
mailing list