[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [25932] trunk/blender/source/blender: Proxy Protection Fixes

Brecht Van Lommel brecht at blender.org
Tue Jan 12 18:08:28 CET 2010


Revision: 25932
          http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=25932
Author:   blendix
Date:     2010-01-12 18:08:28 +0100 (Tue, 12 Jan 2010)

Log Message:
-----------
Proxy Protection Fixes

* Mostly revert #24880: Transform Locks affecting animation system. This
  was implemented as a feature request from Nathan but was not the
  intended functionality, and actually gives problems instead. The transform
  locks should really only affect what the user can do, not if the property
  can be animated internally.
* Revert #25868: fix for lib linked scenes not animating. This was needed
  due to the above feature, but meant that all lib linked properties were
  editable in the UI.
* Make bone properties of on proxy-protected layers not editable. They will
  be overriden on reload/redo like lib linked data, so should not be edited.

Modified Paths:
--------------
    trunk/blender/source/blender/blenkernel/intern/anim_sys.c
    trunk/blender/source/blender/editors/transform/transform_conversions.c
    trunk/blender/source/blender/makesrna/intern/rna_access.c
    trunk/blender/source/blender/makesrna/intern/rna_pose.c

Modified: trunk/blender/source/blender/blenkernel/intern/anim_sys.c
===================================================================
--- trunk/blender/source/blender/blenkernel/intern/anim_sys.c	2010-01-12 16:35:34 UTC (rev 25931)
+++ trunk/blender/source/blender/blenkernel/intern/anim_sys.c	2010-01-12 17:08:28 UTC (rev 25932)
@@ -733,26 +733,20 @@
 			switch (RNA_property_type(prop)) 
 			{
 				case PROP_BOOLEAN:
-					if (RNA_property_array_length(&new_ptr, prop)) {
-						if (RNA_property_editable_index(&new_ptr, prop, array_index))
-							RNA_property_boolean_set_index(&new_ptr, prop, array_index, (int)value);
-					}
+					if (RNA_property_array_length(&new_ptr, prop))
+						RNA_property_boolean_set_index(&new_ptr, prop, array_index, (int)value);
 					else
 						RNA_property_boolean_set(&new_ptr, prop, (int)value);
 					break;
 				case PROP_INT:
-					if (RNA_property_array_length(&new_ptr, prop)){
-						if (RNA_property_editable_index(&new_ptr, prop, array_index))
-							RNA_property_int_set_index(&new_ptr, prop, array_index, (int)value);
-					}
+					if (RNA_property_array_length(&new_ptr, prop))
+						RNA_property_int_set_index(&new_ptr, prop, array_index, (int)value);
 					else
 						RNA_property_int_set(&new_ptr, prop, (int)value);
 					break;
 				case PROP_FLOAT:
-					if (RNA_property_array_length(&new_ptr, prop)) {
-						if (RNA_property_editable_index(&new_ptr, prop, array_index))
-							RNA_property_float_set_index(&new_ptr, prop, array_index, value);
-					}
+					if (RNA_property_array_length(&new_ptr, prop))
+						RNA_property_float_set_index(&new_ptr, prop, array_index, value);
 					else
 						RNA_property_float_set(&new_ptr, prop, value);
 					break;
@@ -1476,26 +1470,20 @@
 		switch (RNA_property_type(prop)) 
 		{
 			case PROP_BOOLEAN:
-				if (RNA_property_array_length(ptr, prop)) {
-					if (RNA_property_editable_index(ptr, prop, array_index))
-						RNA_property_boolean_set_index(ptr, prop, array_index, (int)value);
-				}
+				if (RNA_property_array_length(ptr, prop))
+					RNA_property_boolean_set_index(ptr, prop, array_index, (int)value);
 				else
 					RNA_property_boolean_set(ptr, prop, (int)value);
 				break;
 			case PROP_INT:
-				if (RNA_property_array_length(ptr, prop)) {
-					if (RNA_property_editable_index(ptr, prop, array_index))
-						RNA_property_int_set_index(ptr, prop, array_index, (int)value);
-				}
+				if (RNA_property_array_length(ptr, prop))
+					RNA_property_int_set_index(ptr, prop, array_index, (int)value);
 				else
 					RNA_property_int_set(ptr, prop, (int)value);
 				break;
 			case PROP_FLOAT:
-				if (RNA_property_array_length(ptr, prop)) {
-					if (RNA_property_editable_index(ptr, prop, array_index))
-						RNA_property_float_set_index(ptr, prop, array_index, value);
-				}
+				if (RNA_property_array_length(ptr, prop))
+					RNA_property_float_set_index(ptr, prop, array_index, value);
 				else
 					RNA_property_float_set(ptr, prop, value);
 				break;

Modified: trunk/blender/source/blender/editors/transform/transform_conversions.c
===================================================================
--- trunk/blender/source/blender/editors/transform/transform_conversions.c	2010-01-12 16:35:34 UTC (rev 25931)
+++ trunk/blender/source/blender/editors/transform/transform_conversions.c	2010-01-12 17:08:28 UTC (rev 25932)
@@ -714,7 +714,7 @@
 	for(pchan = ob->pose->chanbase.first; pchan; pchan = pchan->next) {
 		bone = pchan->bone;
 		if(bone->layer & arm->layer) {
-			if(bone->flag & BONE_SELECTED)
+			if((bone->flag & BONE_SELECTED) && !(ob->proxy && pchan->bone->layer & arm->layer_protected))
 				bone->flag |= BONE_TRANSFORM;
 			else
 				bone->flag &= ~BONE_TRANSFORM;

Modified: trunk/blender/source/blender/makesrna/intern/rna_access.c
===================================================================
--- trunk/blender/source/blender/makesrna/intern/rna_access.c	2010-01-12 16:35:34 UTC (rev 25931)
+++ trunk/blender/source/blender/makesrna/intern/rna_access.c	2010-01-12 17:08:28 UTC (rev 25932)
@@ -1060,9 +1060,7 @@
 	
 	id= ptr->id.data;
 
-	/* with this, libdata is not animated by its own library fcurves, FIXME */
-//	return (flag & PROP_EDITABLE) && (!id || !id->lib || (flag & PROP_LIB_EXCEPTION));
-	return (flag & PROP_EDITABLE) ? 1:0;
+	return (flag & PROP_EDITABLE) && (!id || !id->lib || (prop->flag & PROP_LIB_EXCEPTION));
 }
 
 /* same as RNA_property_editable(), except this checks individual items in an array */
@@ -1072,18 +1070,18 @@
 	int flag;
 
 	prop= rna_ensure_property(prop);
+
+	flag= prop->flag;
 	
-	/* if there is no function to do this for a given index, 
-	 * just resort to doing this on the whole array
-	 */
-	if (prop->itemeditable == NULL)
-		return RNA_property_editable(ptr, prop);
-		
-	flag= prop->itemeditable(ptr, index);
+	if(prop->editable)
+		flag &= prop->editable(ptr);
+
+	if (prop->itemeditable)
+		flag &= prop->itemeditable(ptr, index);
+
 	id= ptr->id.data;
-	/* with this, libdata is not animated by its own library fcurves, FIXME */
-//	return (flag & PROP_EDITABLE) && (!id || !id->lib || (flag & PROP_LIB_EXCEPTION));
-	return (flag & PROP_EDITABLE) ? 1:0;
+
+	return (flag & PROP_EDITABLE) && (!id || !id->lib || (prop->flag & PROP_LIB_EXCEPTION));
 }
 
 int RNA_property_animateable(PointerRNA *ptr, PropertyRNA *prop)
@@ -1095,12 +1093,7 @@
 	if(!(prop->flag & PROP_ANIMATEABLE))
 		return 0;
 
-	if(prop->editable)
-		flag= prop->editable(ptr);
-	else
-		flag= prop->flag;
-
-	return (flag & PROP_EDITABLE);
+	return (prop->flag & PROP_EDITABLE);
 }
 
 int RNA_property_animated(PointerRNA *ptr, PropertyRNA *prop)

Modified: trunk/blender/source/blender/makesrna/intern/rna_pose.c
===================================================================
--- trunk/blender/source/blender/makesrna/intern/rna_pose.c	2010-01-12 16:35:34 UTC (rev 25931)
+++ trunk/blender/source/blender/makesrna/intern/rna_pose.c	2010-01-12 17:08:28 UTC (rev 25932)
@@ -446,10 +446,19 @@
 	return remove_constraint_index(&pchan->constraints, index);
 }
 
+static int rna_PoseChannel_proxy_editable(PointerRNA *ptr)
+{
+	Object *ob= (Object*)ptr->id.data;
+	bArmature *arm= ob->data;
+	bPoseChannel *pchan= (bPoseChannel*)ptr->data;
+	
+	return (ob->proxy && pchan->bone && (pchan->bone->layer & arm->layer_protected))? 0: PROP_EDITABLE;
+}
+
 static int rna_PoseChannel_location_editable(PointerRNA *ptr, int index)
 {
 	bPoseChannel *pchan= (bPoseChannel*)ptr->data;
-	
+
 	/* only if the axis in question is locked, not editable... */
 	if ((index == 0) && (pchan->protectflag & OB_LOCK_LOCX))
 		return 0;
@@ -674,6 +683,7 @@
 	prop= RNA_def_property(srna, "name", PROP_STRING, PROP_NONE);
 	RNA_def_property_string_funcs(prop, NULL, NULL, "rna_PoseChannel_name_set");
 	RNA_def_property_ui_text(prop, "Name", "");
+	RNA_def_property_editable_func(prop, "rna_PoseChannel_proxy_editable");
 	RNA_def_struct_name_property(srna, prop);
 
 	prop= RNA_def_property(srna, "selected", PROP_BOOLEAN, PROP_NONE);
@@ -685,12 +695,14 @@
 	RNA_def_property_int_sdna(prop, NULL, "pathsf");
 	RNA_def_property_clear_flag(prop, PROP_EDITABLE);
 	RNA_def_property_ui_text(prop, "Bone Paths Calculation Start Frame", "Starting frame of range of frames to use for Bone Path calculations.");
+	RNA_def_property_editable_func(prop, "rna_PoseChannel_proxy_editable");
 	RNA_def_property_update(prop, NC_OBJECT|ND_POSE, "rna_Pose_update");
 
 	prop= RNA_def_property(srna, "path_end_frame", PROP_INT, PROP_TIME);
 	RNA_def_property_int_sdna(prop, NULL, "pathef");
 	RNA_def_property_clear_flag(prop, PROP_EDITABLE);
 	RNA_def_property_ui_text(prop, "Bone Paths Calculation End Frame", "End frame of range of frames to use for Bone Path calculations.");
+	RNA_def_property_editable_func(prop, "rna_PoseChannel_proxy_editable");
 	RNA_def_property_update(prop, NC_OBJECT|ND_POSE, "rna_Pose_update");
 	
 	rna_def_motionpath_common(srna);
@@ -717,12 +729,14 @@
 	RNA_def_property_float_sdna(prop, NULL, "loc");
 	RNA_def_property_editable_array_func(prop, "rna_PoseChannel_location_editable");
 	RNA_def_property_ui_text(prop, "Location", "");
+	RNA_def_property_editable_func(prop, "rna_PoseChannel_proxy_editable");
 	RNA_def_property_update(prop, NC_OBJECT|ND_TRANSFORM, "rna_Pose_update");
 
 	prop= RNA_def_property(srna, "scale", PROP_FLOAT, PROP_XYZ);
 	RNA_def_property_float_sdna(prop, NULL, "size");
 	RNA_def_property_editable_array_func(prop, "rna_PoseChannel_scale_editable");
 	RNA_def_property_ui_text(prop, "Scale", "");
+	RNA_def_property_editable_func(prop, "rna_PoseChannel_proxy_editable");
 	RNA_def_property_update(prop, NC_OBJECT|ND_TRANSFORM, "rna_Pose_update");
 
 	prop= RNA_def_property(srna, "rotation_quaternion", PROP_FLOAT, PROP_QUATERNION);
@@ -730,6 +744,7 @@
 	RNA_def_property_editable_array_func(prop, "rna_PoseChannel_rotation_4d_editable");
 	RNA_def_property_float_array_default(prop, default_quat);
 	RNA_def_property_ui_text(prop, "Quaternion Rotation", "Rotation in Quaternions.");
+	RNA_def_property_editable_func(prop, "rna_PoseChannel_proxy_editable");
 	RNA_def_property_update(prop, NC_OBJECT|ND_TRANSFORM, "rna_Pose_update");
 	
 		/* XXX: for axis-angle, it would have been nice to have 2 separate fields for UI purposes, but
@@ -741,11 +756,13 @@
 	RNA_def_property_editable_array_func(prop, "rna_PoseChannel_rotation_4d_editable");
 	RNA_def_property_float_array_default(prop, default_axisAngle);
 	RNA_def_property_ui_text(prop, "Axis-Angle Rotation", "Angle of Rotation for Axis-Angle rotation representation.");
+	RNA_def_property_editable_func(prop, "rna_PoseChannel_proxy_editable");
 	RNA_def_property_update(prop, NC_OBJECT|ND_TRANSFORM, "rna_Pose_update");
 	
 	prop= RNA_def_property(srna, "rotation_euler", PROP_FLOAT, PROP_EULER);
 	RNA_def_property_float_sdna(prop, NULL, "eul");
 	RNA_def_property_editable_array_func(prop, "rna_PoseChannel_rotation_euler_editable");
+	RNA_def_property_editable_func(prop, "rna_PoseChannel_proxy_editable");
 	RNA_def_property_ui_text(prop, "Euler Rotation", "Rotation in Eulers.");
 	RNA_def_property_update(prop, NC_OBJECT|ND_TRANSFORM, "rna_Pose_update");
 	
@@ -753,6 +770,7 @@
 	RNA_def_property_enum_sdna(prop, NULL, "rotmode");
 	RNA_def_property_enum_items(prop, prop_rotmode_items); // XXX move to using a single define of this someday
 	RNA_def_property_enum_funcs(prop, NULL, "rna_PoseChannel_rotation_mode_set", NULL);

@@ Diff output truncated at 10240 characters. @@




More information about the Bf-blender-cvs mailing list