[Bf-blender-cvs] [0de94b2b62c] soc-2020-custom-menus: Custom Menus : add property edition

TempoDev noreply at git.blender.org
Fri Jul 31 23:04:07 CEST 2020


Commit: 0de94b2b62c88bf51c864be0459b06cc541c536d
Author: TempoDev
Date:   Fri Jul 31 23:04:00 2020 +0200
Branches: soc-2020-custom-menus
https://developer.blender.org/rB0de94b2b62c88bf51c864be0459b06cc541c536d

Custom Menus : add property edition

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

M	release/scripts/modules/rna_user_menus_ui.py
M	source/blender/makesrna/intern/rna_userdef.c

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

diff --git a/release/scripts/modules/rna_user_menus_ui.py b/release/scripts/modules/rna_user_menus_ui.py
index 879169d9ff1..f6b2effa026 100644
--- a/release/scripts/modules/rna_user_menus_ui.py
+++ b/release/scripts/modules/rna_user_menus_ui.py
@@ -153,6 +153,10 @@ def draw_item_editor(context, row):
         if (current.type == "MENU"):
             umi_pm = current.get_menu()
             col.prop(umi_pm, "id_name", text="ID name")
+        if (current.type == "PROPERTY"):
+            umi_prop = current.get_property()
+            col.prop(umi_prop, "id_name")
+            col.prop(umi_prop, "context")
     else:
         col.label(text="No item selected.")
 
diff --git a/source/blender/makesrna/intern/rna_userdef.c b/source/blender/makesrna/intern/rna_userdef.c
index 48d69e19e8e..bd203565730 100644
--- a/source/blender/makesrna/intern/rna_userdef.c
+++ b/source/blender/makesrna/intern/rna_userdef.c
@@ -6460,7 +6460,7 @@ static void rna_def_userdef_usermenus_items_subtypes(BlenderRNA *brna)
   srna = RNA_def_struct(brna, "um_item_prop", NULL);
   RNA_def_struct_sdna(srna, "bUserMenuItem_Prop");
   RNA_def_struct_ui_text(
-      srna, "User Menu preperty item", "an item of the user menus that can store a property");
+      srna, "User Menu property item", "an item of the user menus that can store a property");
 
   prop = RNA_def_property(srna, "item", PROP_POINTER, PROP_NONE);
   RNA_def_property_pointer_sdna(prop, NULL, "item");
@@ -6469,7 +6469,12 @@ static void rna_def_userdef_usermenus_items_subtypes(BlenderRNA *brna)
 
   prop = RNA_def_property(srna, "id_name", PROP_STRING, PROP_NONE);
   RNA_def_property_string_sdna(prop, NULL, "prop_id");
-  RNA_def_property_ui_text(prop, "id name", "the preperty id name");
+  RNA_def_property_ui_text(prop, "id name", "the property id name");
+  RNA_def_struct_name_property(srna, prop);
+
+  prop = RNA_def_property(srna, "context", PROP_STRING, PROP_NONE);
+  RNA_def_property_string_sdna(prop, NULL, "context_data_path");
+  RNA_def_property_ui_text(prop, "context", "the context data path of the property");
   RNA_def_struct_name_property(srna, prop);
 
   /* sub menu item */



More information about the Bf-blender-cvs mailing list