Changeset View
Changeset View
Standalone View
Standalone View
source/blender/makesrna/intern/rna_ui.c
| Show First 20 Lines • Show All 938 Lines • ▼ Show 20 Lines | static void rna_def_panel(BlenderRNA *brna) | ||||
| RNA_def_struct_translation_context(srna, BLT_I18NCONTEXT_DEFAULT_BPYRNA); | RNA_def_struct_translation_context(srna, BLT_I18NCONTEXT_DEFAULT_BPYRNA); | ||||
| /* poll */ | /* poll */ | ||||
| func = RNA_def_function(srna, "poll", NULL); | func = RNA_def_function(srna, "poll", NULL); | ||||
| RNA_def_function_ui_description(func, "If this method returns a non-null output, then the panel can be drawn"); | RNA_def_function_ui_description(func, "If this method returns a non-null output, then the panel can be drawn"); | ||||
| RNA_def_function_flag(func, FUNC_NO_SELF | FUNC_REGISTER_OPTIONAL); | RNA_def_function_flag(func, FUNC_NO_SELF | FUNC_REGISTER_OPTIONAL); | ||||
| RNA_def_function_return(func, RNA_def_boolean(func, "visible", 1, "", "")); | RNA_def_function_return(func, RNA_def_boolean(func, "visible", 1, "", "")); | ||||
| parm = RNA_def_pointer(func, "context", "Context", "", ""); | parm = RNA_def_pointer(func, "context", "Context", "", ""); | ||||
| RNA_def_property_flag(parm, PROP_REQUIRED | PROP_NEVER_NULL); | RNA_def_parameter_flags(parm, PROP_NEVER_NULL, PARM_REQUIRED); | ||||
| /* draw */ | /* draw */ | ||||
| func = RNA_def_function(srna, "draw", NULL); | func = RNA_def_function(srna, "draw", NULL); | ||||
| RNA_def_function_ui_description(func, "Draw UI elements into the panel UI layout"); | RNA_def_function_ui_description(func, "Draw UI elements into the panel UI layout"); | ||||
| RNA_def_function_flag(func, FUNC_REGISTER); | RNA_def_function_flag(func, FUNC_REGISTER); | ||||
| parm = RNA_def_pointer(func, "context", "Context", "", ""); | parm = RNA_def_pointer(func, "context", "Context", "", ""); | ||||
| RNA_def_property_flag(parm, PROP_REQUIRED | PROP_NEVER_NULL); | RNA_def_parameter_flags(parm, PROP_NEVER_NULL, PARM_REQUIRED); | ||||
| func = RNA_def_function(srna, "draw_header", NULL); | func = RNA_def_function(srna, "draw_header", NULL); | ||||
| RNA_def_function_ui_description(func, "Draw UI elements into the panel's header UI layout"); | RNA_def_function_ui_description(func, "Draw UI elements into the panel's header UI layout"); | ||||
| RNA_def_function_flag(func, FUNC_REGISTER_OPTIONAL); | RNA_def_function_flag(func, FUNC_REGISTER_OPTIONAL); | ||||
| parm = RNA_def_pointer(func, "context", "Context", "", ""); | parm = RNA_def_pointer(func, "context", "Context", "", ""); | ||||
| RNA_def_property_flag(parm, PROP_REQUIRED | PROP_NEVER_NULL); | RNA_def_parameter_flags(parm, PROP_NEVER_NULL, PARM_REQUIRED); | ||||
| prop = RNA_def_property(srna, "layout", PROP_POINTER, PROP_NONE); | prop = RNA_def_property(srna, "layout", PROP_POINTER, PROP_NONE); | ||||
| RNA_def_property_struct_type(prop, "UILayout"); | RNA_def_property_struct_type(prop, "UILayout"); | ||||
| RNA_def_property_ui_text(prop, "Layout", "Defines the structure of the panel in the UI"); | RNA_def_property_ui_text(prop, "Layout", "Defines the structure of the panel in the UI"); | ||||
| prop = RNA_def_property(srna, "text", PROP_STRING, PROP_NONE); | prop = RNA_def_property(srna, "text", PROP_STRING, PROP_NONE); | ||||
| RNA_def_property_string_sdna(prop, NULL, "drawname"); | RNA_def_property_string_sdna(prop, NULL, "drawname"); | ||||
| RNA_def_property_ui_text(prop, "Text", "XXX todo"); | RNA_def_property_ui_text(prop, "Text", "XXX todo"); | ||||
| ▲ Show 20 Lines • Show All 110 Lines • ▼ Show 20 Lines | static void rna_def_uilist(BlenderRNA *brna) | ||||
| RNA_def_property_ui_text(prop, "Invert", "Invert the order of shown items"); | RNA_def_property_ui_text(prop, "Invert", "Invert the order of shown items"); | ||||
| /* draw_item */ | /* draw_item */ | ||||
| func = RNA_def_function(srna, "draw_item", NULL); | func = RNA_def_function(srna, "draw_item", NULL); | ||||
| RNA_def_function_ui_description(func, "Draw an item in the list (NOTE: when you define your own draw_item " | RNA_def_function_ui_description(func, "Draw an item in the list (NOTE: when you define your own draw_item " | ||||
| "function, you may want to check given 'item' is of the right type...)"); | "function, you may want to check given 'item' is of the right type...)"); | ||||
| RNA_def_function_flag(func, FUNC_REGISTER_OPTIONAL); | RNA_def_function_flag(func, FUNC_REGISTER_OPTIONAL); | ||||
| parm = RNA_def_pointer(func, "context", "Context", "", ""); | parm = RNA_def_pointer(func, "context", "Context", "", ""); | ||||
| RNA_def_property_flag(parm, PROP_REQUIRED); | RNA_def_parameter_flags(parm, 0, PARM_REQUIRED); | ||||
| parm = RNA_def_pointer(func, "layout", "UILayout", "", "Layout to draw the item"); | parm = RNA_def_pointer(func, "layout", "UILayout", "", "Layout to draw the item"); | ||||
| RNA_def_property_flag(parm, PROP_REQUIRED | PROP_NEVER_NULL); | RNA_def_parameter_flags(parm, PROP_NEVER_NULL, PARM_REQUIRED); | ||||
| parm = RNA_def_pointer(func, "data", "AnyType", "", "Data from which to take Collection property"); | parm = RNA_def_pointer(func, "data", "AnyType", "", "Data from which to take Collection property"); | ||||
| RNA_def_property_flag(parm, PROP_REQUIRED | PROP_RNAPTR); | RNA_def_parameter_flags(parm, 0, PARM_REQUIRED | PARM_RNAPTR); | ||||
| parm = RNA_def_pointer(func, "item", "AnyType", "", "Item of the collection property"); | parm = RNA_def_pointer(func, "item", "AnyType", "", "Item of the collection property"); | ||||
| RNA_def_property_flag(parm, PROP_REQUIRED | PROP_RNAPTR); | RNA_def_parameter_flags(parm, 0, PARM_REQUIRED | PARM_RNAPTR); | ||||
| parm = RNA_def_int(func, "icon", 0, 0, INT_MAX, "", "Icon of the item in the collection", 0, INT_MAX); | parm = RNA_def_int(func, "icon", 0, 0, INT_MAX, "", "Icon of the item in the collection", 0, INT_MAX); | ||||
| RNA_def_property_flag(parm, PROP_REQUIRED); | RNA_def_parameter_flags(parm, 0, PARM_REQUIRED); | ||||
| parm = RNA_def_pointer(func, "active_data", "AnyType", "", | parm = RNA_def_pointer(func, "active_data", "AnyType", "", | ||||
| "Data from which to take property for the active element"); | "Data from which to take property for the active element"); | ||||
| RNA_def_property_flag(parm, PROP_REQUIRED | PROP_RNAPTR | PROP_NEVER_NULL); | RNA_def_parameter_flags(parm, PROP_NEVER_NULL, PARM_REQUIRED | PARM_RNAPTR); | ||||
| parm = RNA_def_string(func, "active_property", NULL, 0, "", | parm = RNA_def_string(func, "active_property", NULL, 0, "", | ||||
| "Identifier of property in active_data, for the active element"); | "Identifier of property in active_data, for the active element"); | ||||
| RNA_def_property_flag(parm, PROP_REQUIRED); | RNA_def_parameter_flags(parm, 0, PARM_REQUIRED); | ||||
| RNA_def_int(func, "index", 0, 0, INT_MAX, "", "Index of the item in the collection", 0, INT_MAX); | RNA_def_int(func, "index", 0, 0, INT_MAX, "", "Index of the item in the collection", 0, INT_MAX); | ||||
| RNA_def_property_flag(parm, PROP_REQUIRED | PROP_PYFUNC_OPTIONAL); | RNA_def_parameter_flags(parm, 0, PARM_REQUIRED | PARM_PYFUNC_OPTIONAL); | ||||
| prop = RNA_def_property(func, "flt_flag", PROP_INT, PROP_UNSIGNED); | prop = RNA_def_property(func, "flt_flag", PROP_INT, PROP_UNSIGNED); | ||||
| RNA_def_property_ui_text(prop, "", "The filter-flag result for this item"); | RNA_def_property_ui_text(prop, "", "The filter-flag result for this item"); | ||||
| RNA_def_property_flag(parm, PROP_REQUIRED | PROP_PYFUNC_OPTIONAL); | RNA_def_parameter_flags(parm, 0, PARM_REQUIRED | PARM_PYFUNC_OPTIONAL); | ||||
| /* draw_filter */ | /* draw_filter */ | ||||
| func = RNA_def_function(srna, "draw_filter", NULL); | func = RNA_def_function(srna, "draw_filter", NULL); | ||||
| RNA_def_function_ui_description(func, "Draw filtering options"); | RNA_def_function_ui_description(func, "Draw filtering options"); | ||||
| RNA_def_function_flag(func, FUNC_REGISTER_OPTIONAL); | RNA_def_function_flag(func, FUNC_REGISTER_OPTIONAL); | ||||
| parm = RNA_def_pointer(func, "context", "Context", "", ""); | parm = RNA_def_pointer(func, "context", "Context", "", ""); | ||||
| RNA_def_property_flag(parm, PROP_REQUIRED); | RNA_def_parameter_flags(parm, 0, PARM_REQUIRED); | ||||
| parm = RNA_def_pointer(func, "layout", "UILayout", "", "Layout to draw the item"); | parm = RNA_def_pointer(func, "layout", "UILayout", "", "Layout to draw the item"); | ||||
| RNA_def_property_flag(parm, PROP_REQUIRED | PROP_NEVER_NULL); | RNA_def_parameter_flags(parm, PROP_NEVER_NULL, PARM_REQUIRED); | ||||
| /* filter */ | /* filter */ | ||||
| func = RNA_def_function(srna, "filter_items", NULL); | func = RNA_def_function(srna, "filter_items", NULL); | ||||
| RNA_def_function_ui_description(func, "Filter and/or re-order items of the collection (output filter results in " | RNA_def_function_ui_description(func, "Filter and/or re-order items of the collection (output filter results in " | ||||
| "filter_flags, and reorder results in filter_neworder arrays)"); | "filter_flags, and reorder results in filter_neworder arrays)"); | ||||
| RNA_def_function_flag(func, FUNC_REGISTER_OPTIONAL); | RNA_def_function_flag(func, FUNC_REGISTER_OPTIONAL); | ||||
| parm = RNA_def_pointer(func, "context", "Context", "", ""); | parm = RNA_def_pointer(func, "context", "Context", "", ""); | ||||
| RNA_def_property_flag(parm, PROP_REQUIRED); | RNA_def_parameter_flags(parm, 0, PARM_REQUIRED); | ||||
| parm = RNA_def_pointer(func, "data", "AnyType", "", "Data from which to take Collection property"); | parm = RNA_def_pointer(func, "data", "AnyType", "", "Data from which to take Collection property"); | ||||
| RNA_def_property_flag(parm, PROP_REQUIRED | PROP_RNAPTR); | RNA_def_parameter_flags(parm, 0, PARM_REQUIRED | PARM_RNAPTR); | ||||
| parm = RNA_def_string(func, "property", NULL, 0, "", "Identifier of property in data, for the collection"); | parm = RNA_def_string(func, "property", NULL, 0, "", "Identifier of property in data, for the collection"); | ||||
| RNA_def_property_flag(parm, PROP_REQUIRED); | RNA_def_parameter_flags(parm, 0, PARM_REQUIRED); | ||||
| prop = RNA_def_property(func, "filter_flags", PROP_INT, PROP_UNSIGNED); | prop = RNA_def_property(func, "filter_flags", PROP_INT, PROP_UNSIGNED); | ||||
| RNA_def_property_flag(prop, PROP_REQUIRED | PROP_DYNAMIC); | RNA_def_property_flag(prop, PARM_REQUIRED | PROP_DYNAMIC); | ||||
| RNA_def_property_array(prop, 1); /* XXX Dummy value, default 0 does not work */ | RNA_def_property_array(prop, 1); /* XXX Dummy value, default 0 does not work */ | ||||
| RNA_def_property_ui_text(prop, "", "An array of filter flags, one for each item in the collection (NOTE: " | RNA_def_property_ui_text(prop, "", "An array of filter flags, one for each item in the collection (NOTE: " | ||||
| "FILTER_ITEM bit is reserved, it defines whether the item is shown or not)"); | "FILTER_ITEM bit is reserved, it defines whether the item is shown or not)"); | ||||
| RNA_def_function_output(func, prop); | RNA_def_function_output(func, prop); | ||||
| prop = RNA_def_property(func, "filter_neworder", PROP_INT, PROP_UNSIGNED); | prop = RNA_def_property(func, "filter_neworder", PROP_INT, PROP_UNSIGNED); | ||||
| RNA_def_property_flag(prop, PROP_REQUIRED | PROP_DYNAMIC); | RNA_def_property_flag(prop, PARM_REQUIRED | PROP_DYNAMIC); | ||||
| RNA_def_property_array(prop, 1); /* XXX Dummy value, default 0 does not work */ | RNA_def_property_array(prop, 1); /* XXX Dummy value, default 0 does not work */ | ||||
| RNA_def_property_ui_text(prop, "", "An array of indices, one for each item in the collection, mapping the org " | RNA_def_property_ui_text(prop, "", "An array of indices, one for each item in the collection, mapping the org " | ||||
| "index to the new one"); | "index to the new one"); | ||||
| RNA_def_function_output(func, prop); | RNA_def_function_output(func, prop); | ||||
| /* "Constants"! */ | /* "Constants"! */ | ||||
| RNA_define_verify_sdna(0); /* not in sdna */ | RNA_define_verify_sdna(0); /* not in sdna */ | ||||
| Show All 17 Lines | static void rna_def_header(BlenderRNA *brna) | ||||
| RNA_def_struct_refine_func(srna, "rna_Header_refine"); | RNA_def_struct_refine_func(srna, "rna_Header_refine"); | ||||
| RNA_def_struct_register_funcs(srna, "rna_Header_register", "rna_Header_unregister", NULL); | RNA_def_struct_register_funcs(srna, "rna_Header_register", "rna_Header_unregister", NULL); | ||||
| /* draw */ | /* draw */ | ||||
| func = RNA_def_function(srna, "draw", NULL); | func = RNA_def_function(srna, "draw", NULL); | ||||
| RNA_def_function_ui_description(func, "Draw UI elements into the header UI layout"); | RNA_def_function_ui_description(func, "Draw UI elements into the header UI layout"); | ||||
| RNA_def_function_flag(func, FUNC_REGISTER); | RNA_def_function_flag(func, FUNC_REGISTER); | ||||
| parm = RNA_def_pointer(func, "context", "Context", "", ""); | parm = RNA_def_pointer(func, "context", "Context", "", ""); | ||||
| RNA_def_property_flag(parm, PROP_REQUIRED); | RNA_def_parameter_flags(parm, 0, PARM_REQUIRED); | ||||
| RNA_define_verify_sdna(0); /* not in sdna */ | RNA_define_verify_sdna(0); /* not in sdna */ | ||||
| prop = RNA_def_property(srna, "layout", PROP_POINTER, PROP_NONE); | prop = RNA_def_property(srna, "layout", PROP_POINTER, PROP_NONE); | ||||
| RNA_def_property_pointer_sdna(prop, NULL, "layout"); | RNA_def_property_pointer_sdna(prop, NULL, "layout"); | ||||
| RNA_def_property_struct_type(prop, "UILayout"); | RNA_def_property_struct_type(prop, "UILayout"); | ||||
| RNA_def_property_ui_text(prop, "Layout", "Structure of the header in the UI"); | RNA_def_property_ui_text(prop, "Layout", "Structure of the header in the UI"); | ||||
| Show All 31 Lines | static void rna_def_menu(BlenderRNA *brna) | ||||
| RNA_def_struct_translation_context(srna, BLT_I18NCONTEXT_DEFAULT_BPYRNA); | RNA_def_struct_translation_context(srna, BLT_I18NCONTEXT_DEFAULT_BPYRNA); | ||||
| /* poll */ | /* poll */ | ||||
| func = RNA_def_function(srna, "poll", NULL); | func = RNA_def_function(srna, "poll", NULL); | ||||
| RNA_def_function_ui_description(func, "If this method returns a non-null output, then the menu can be drawn"); | RNA_def_function_ui_description(func, "If this method returns a non-null output, then the menu can be drawn"); | ||||
| RNA_def_function_flag(func, FUNC_NO_SELF | FUNC_REGISTER_OPTIONAL); | RNA_def_function_flag(func, FUNC_NO_SELF | FUNC_REGISTER_OPTIONAL); | ||||
| RNA_def_function_return(func, RNA_def_boolean(func, "visible", 1, "", "")); | RNA_def_function_return(func, RNA_def_boolean(func, "visible", 1, "", "")); | ||||
| parm = RNA_def_pointer(func, "context", "Context", "", ""); | parm = RNA_def_pointer(func, "context", "Context", "", ""); | ||||
| RNA_def_property_flag(parm, PROP_REQUIRED); | RNA_def_parameter_flags(parm, 0, PARM_REQUIRED); | ||||
| /* draw */ | /* draw */ | ||||
| func = RNA_def_function(srna, "draw", NULL); | func = RNA_def_function(srna, "draw", NULL); | ||||
| RNA_def_function_ui_description(func, "Draw UI elements into the menu UI layout"); | RNA_def_function_ui_description(func, "Draw UI elements into the menu UI layout"); | ||||
| RNA_def_function_flag(func, FUNC_REGISTER); | RNA_def_function_flag(func, FUNC_REGISTER); | ||||
| parm = RNA_def_pointer(func, "context", "Context", "", ""); | parm = RNA_def_pointer(func, "context", "Context", "", ""); | ||||
| RNA_def_property_flag(parm, PROP_REQUIRED); | RNA_def_parameter_flags(parm, 0, PARM_REQUIRED); | ||||
| RNA_define_verify_sdna(false); /* not in sdna */ | RNA_define_verify_sdna(false); /* not in sdna */ | ||||
| prop = RNA_def_property(srna, "layout", PROP_POINTER, PROP_NONE); | prop = RNA_def_property(srna, "layout", PROP_POINTER, PROP_NONE); | ||||
| RNA_def_property_pointer_sdna(prop, NULL, "layout"); | RNA_def_property_pointer_sdna(prop, NULL, "layout"); | ||||
| RNA_def_property_struct_type(prop, "UILayout"); | RNA_def_property_struct_type(prop, "UILayout"); | ||||
| RNA_def_property_ui_text(prop, "Layout", "Defines the structure of the menu in the UI"); | RNA_def_property_ui_text(prop, "Layout", "Defines the structure of the menu in the UI"); | ||||
| ▲ Show 20 Lines • Show All 42 Lines • Show Last 20 Lines | |||||