diff options
author | Campbell Barton <ideasman42@gmail.com> | 2018-12-20 10:18:42 +0300 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2018-12-20 10:18:42 +0300 |
commit | 7d8f57e0c013ef43d4d1f1b7afd0477d690e70c5 (patch) | |
tree | 80201d8548d9ff21f025d97f4e1d62c534ade7f6 /source/blender/makesrna/intern/rna_scene.c | |
parent | d5f87bdde68f3849b353989d0af296ea0b7e402b (diff) |
Correct own error in 1ce9a142b6abd
Enum for scene orientations included default.
Diffstat (limited to 'source/blender/makesrna/intern/rna_scene.c')
-rw-r--r-- | source/blender/makesrna/intern/rna_scene.c | 28 |
1 files changed, 15 insertions, 13 deletions
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 |