[Bf-blender-cvs] [7d8f57e0c01] blender2.8: Correct own error in 1ce9a142b6abd

Campbell Barton noreply at git.blender.org
Thu Dec 20 08:20:42 CET 2018


Commit: 7d8f57e0c013ef43d4d1f1b7afd0477d690e70c5
Author: Campbell Barton
Date:   Thu Dec 20 18:18:42 2018 +1100
Branches: blender2.8
https://developer.blender.org/rB7d8f57e0c013ef43d4d1f1b7afd0477d690e70c5

Correct own error in 1ce9a142b6abd

Enum for scene orientations included default.

===================================================================

M	source/blender/makesrna/intern/rna_scene.c

===================================================================

diff --git a/source/blender/makesrna/intern/rna_scene.c b/source/blender/makesrna/intern/rna_scene.c
index 1fea0aa3e63..90aa997d179 100644
--- a/source/blender/makesrna/intern/rna_scene.c
+++ b/source/blender/makesrna/intern/rna_scene.c
@@ -2023,15 +2023,14 @@ static PointerRNA rna_TransformOrientationSlot_get(PointerRNA *ptr)
 }
 
 static const EnumPropertyItem *rna_TransformOrientation_impl_itemf(
-        bContext *C, PointerRNA *ptr,
-        const bool with_scene,
+        Scene *scene, const bool include_default,
         bool *r_free)
 {
 	EnumPropertyItem tmp = {0, "", 0, "", ""};
 	EnumPropertyItem *item = NULL;
 	int i = V3D_MANIP_CUSTOM, totitem = 0;
 
-	if (with_scene) {
+	if (include_default) {
 		tmp.identifier = "DEFAULT";
 		tmp.name = "Default";
 		tmp.description = "Use the scene orientation";
@@ -2045,13 +2044,6 @@ static const EnumPropertyItem *rna_TransformOrientation_impl_itemf(
 
 	RNA_enum_items_add(&item, &totitem, rna_enum_transform_orientation_items);
 
-	Scene *scene;
-	if (ptr->type == &RNA_Scene) {
-		scene = ptr->data;
-	}
-	else {
-		scene = CTX_data_scene(C);
-	}
 	const ListBase *transform_orientations = scene ? &scene->transform_spaces : NULL;
 
 	if (transform_orientations && (BLI_listbase_is_empty(transform_orientations) == false)) {
@@ -2073,13 +2065,23 @@ static const EnumPropertyItem *rna_TransformOrientation_impl_itemf(
 const EnumPropertyItem *rna_TransformOrientation_itemf(
         bContext *C, PointerRNA *ptr, PropertyRNA *UNUSED(prop), bool *r_free)
 {
-	return rna_TransformOrientation_impl_itemf(C, ptr, false, r_free);
+	Scene *scene;
+	if (ptr->id.data && (GS(((ID *)ptr->id.data)->name) == ID_SCE)) {
+		scene = ptr->id.data;
+	}
+	else {
+		scene = CTX_data_scene(C);
+	}
+	return rna_TransformOrientation_impl_itemf(scene, false, r_free);
 }
 
 const EnumPropertyItem *rna_TransformOrientation_with_scene_itemf(
-        bContext *C, PointerRNA *ptr, PropertyRNA *UNUSED(prop), bool *r_free)
+        bContext *UNUSED(C), PointerRNA *ptr, PropertyRNA *UNUSED(prop), bool *r_free)
 {
-	return rna_TransformOrientation_impl_itemf(C, ptr, true, r_free);
+	Scene *scene = ptr->id.data;
+	TransformOrientationSlot *orient_slot = ptr->data;
+	bool include_default = (orient_slot != &scene->orientation_slots[SCE_ORIENT_DEFAULT]);
+	return rna_TransformOrientation_impl_itemf(scene, include_default, r_free);
 }
 
 #undef V3D_MANIP_DEFAULT



More information about the Bf-blender-cvs mailing list