[Bf-blender-cvs] [d5708fd] master: Fix expanding enum property in sub-layout of pie menus

Julian Eisel noreply at git.blender.org
Thu Dec 8 12:23:58 CET 2016


Commit: d5708fdad6a09e1c3b8c6f68e9e852ae673705f2
Author: Julian Eisel
Date:   Thu Dec 8 11:53:48 2016 +0100
Branches: master
https://developer.blender.org/rBd5708fdad6a09e1c3b8c6f68e9e852ae673705f2

Fix expanding enum property in sub-layout of pie menus

//ui_item_enum_expand// function replaces all pie menu's sub-layouts with radial layout. It should replace only root layout.

To reproduce the issue paste the code in Blender's text editor and press Run Script button.
```
import bpy

class VIEW3D_PIE_template(bpy.types.Menu):
    bl_label = "Select Mode"

    def draw(self, context):
        layout = self.layout.menu_pie()
        layout.column().prop(
            context.scene.render.image_settings, "color_mode", expand=True)

def register():
    bpy.utils.register_class(VIEW3D_PIE_template)

def unregister():
    bpy.utils.unregister_class(VIEW3D_PIE_template)

if __name__ == "__main__":
    register()
    bpy.ops.wm.call_menu_pie(name="VIEW3D_PIE_template")
```

Differential Revision: https://developer.blender.org/D2394 by @raa

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

M	source/blender/editors/interface/interface_layout.c

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

diff --git a/source/blender/editors/interface/interface_layout.c b/source/blender/editors/interface/interface_layout.c
index b128bf4..342c718 100644
--- a/source/blender/editors/interface/interface_layout.c
+++ b/source/blender/editors/interface/interface_layout.c
@@ -570,8 +570,13 @@ static void ui_item_enum_expand(
 
 	/* we dont want nested rows, cols in menus */
 	if (radial) {
-		layout_radial = uiLayoutRadial(layout);
-		UI_block_layout_set_current(block, layout_radial);
+		if (layout->root->layout == layout) {
+			layout_radial = uiLayoutRadial(layout);
+			UI_block_layout_set_current(block, layout_radial);
+		}
+		else {
+			UI_block_layout_set_current(block, layout);
+		}
 	}
 	else if (layout->root->type != UI_LAYOUT_MENU) {
 		UI_block_layout_set_current(block, ui_item_local_sublayout(layout, layout, 1));




More information about the Bf-blender-cvs mailing list