Changeset View
Changeset View
Standalone View
Standalone View
source/blender/makesrna/intern/rna_ui.c
| Show First 20 Lines • Show All 261 Lines • ▼ Show 20 Lines | if (pt->flag & PNL_NO_HEADER) { | ||||
| if (pth) | if (pth) | ||||
| BLI_insertlinkbefore(&art->paneltypes, pth, pt); | BLI_insertlinkbefore(&art->paneltypes, pth, pt); | ||||
| else | else | ||||
| BLI_addtail(&art->paneltypes, pt); | BLI_addtail(&art->paneltypes, pt); | ||||
| } | } | ||||
| else | else | ||||
| BLI_addtail(&art->paneltypes, pt); | BLI_addtail(&art->paneltypes, pt); | ||||
| { | |||||
| const char *bl_origin = RNA_struct_state_bl_origin_get(); | |||||
| if (bl_origin) { | |||||
| BLI_strncpy(pt->bl_origin, bl_origin, sizeof(pt->bl_origin)); | |||||
| } | |||||
| } | |||||
| /* update while blender is running */ | /* update while blender is running */ | ||||
| WM_main_add_notifier(NC_WINDOW, NULL); | WM_main_add_notifier(NC_WINDOW, NULL); | ||||
| return pt->ext.srna; | return pt->ext.srna; | ||||
| } | } | ||||
| static StructRNA *rna_Panel_refine(PointerRNA *ptr) | static StructRNA *rna_Panel_refine(PointerRNA *ptr) | ||||
| { | { | ||||
| ▲ Show 20 Lines • Show All 490 Lines • ▼ Show 20 Lines | static StructRNA *rna_Menu_register( | ||||
| mt->ext.call = call; | mt->ext.call = call; | ||||
| mt->ext.free = free; | mt->ext.free = free; | ||||
| RNA_struct_blender_type_set(mt->ext.srna, mt); | RNA_struct_blender_type_set(mt->ext.srna, mt); | ||||
| RNA_def_struct_flag(mt->ext.srna, STRUCT_NO_IDPROPERTIES); | RNA_def_struct_flag(mt->ext.srna, STRUCT_NO_IDPROPERTIES); | ||||
| mt->poll = (have_function[0]) ? menu_poll : NULL; | mt->poll = (have_function[0]) ? menu_poll : NULL; | ||||
| mt->draw = (have_function[1]) ? menu_draw : NULL; | mt->draw = (have_function[1]) ? menu_draw : NULL; | ||||
| { | |||||
| const char *bl_origin = RNA_struct_state_bl_origin_get(); | |||||
| if (bl_origin) { | |||||
| BLI_strncpy(mt->bl_origin, bl_origin, sizeof(mt->bl_origin)); | |||||
| } | |||||
| } | |||||
| WM_menutype_add(mt); | WM_menutype_add(mt); | ||||
| /* update while blender is running */ | /* update while blender is running */ | ||||
| WM_main_add_notifier(NC_WINDOW, NULL); | WM_main_add_notifier(NC_WINDOW, NULL); | ||||
| return mt->ext.srna; | return mt->ext.srna; | ||||
| } | } | ||||
| ▲ Show 20 Lines • Show All 234 Lines • ▼ Show 20 Lines | static void rna_def_panel(BlenderRNA *brna) | ||||
| RNA_def_property_string_default(prop, BLT_I18NCONTEXT_DEFAULT_BPYRNA); | RNA_def_property_string_default(prop, BLT_I18NCONTEXT_DEFAULT_BPYRNA); | ||||
| RNA_def_property_flag(prop, PROP_REGISTER_OPTIONAL); | RNA_def_property_flag(prop, PROP_REGISTER_OPTIONAL); | ||||
| RNA_define_verify_sdna(true); | RNA_define_verify_sdna(true); | ||||
| prop = RNA_def_property(srna, "bl_category", PROP_STRING, PROP_NONE); | prop = RNA_def_property(srna, "bl_category", PROP_STRING, PROP_NONE); | ||||
| RNA_def_property_string_sdna(prop, NULL, "type->category"); | RNA_def_property_string_sdna(prop, NULL, "type->category"); | ||||
| RNA_def_property_flag(prop, PROP_REGISTER_OPTIONAL); | RNA_def_property_flag(prop, PROP_REGISTER_OPTIONAL); | ||||
| prop = RNA_def_property(srna, "bl_origin", PROP_STRING, PROP_NONE); | |||||
| RNA_def_property_string_sdna(prop, NULL, "type->bl_origin"); | |||||
| RNA_def_property_flag(prop, PROP_REGISTER_OPTIONAL); | |||||
| prop = RNA_def_property(srna, "bl_space_type", PROP_ENUM, PROP_NONE); | prop = RNA_def_property(srna, "bl_space_type", PROP_ENUM, PROP_NONE); | ||||
| RNA_def_property_enum_sdna(prop, NULL, "type->space_type"); | RNA_def_property_enum_sdna(prop, NULL, "type->space_type"); | ||||
| RNA_def_property_enum_items(prop, rna_enum_space_type_items); | RNA_def_property_enum_items(prop, rna_enum_space_type_items); | ||||
| RNA_def_property_flag(prop, PROP_REGISTER); | RNA_def_property_flag(prop, PROP_REGISTER); | ||||
| RNA_def_property_ui_text(prop, "Space type", "The space where the panel is going to be used in"); | RNA_def_property_ui_text(prop, "Space type", "The space where the panel is going to be used in"); | ||||
| prop = RNA_def_property(srna, "bl_region_type", PROP_ENUM, PROP_NONE); | prop = RNA_def_property(srna, "bl_region_type", PROP_ENUM, PROP_NONE); | ||||
| RNA_def_property_enum_sdna(prop, NULL, "type->region_type"); | RNA_def_property_enum_sdna(prop, NULL, "type->region_type"); | ||||
| ▲ Show 20 Lines • Show All 251 Lines • ▼ Show 20 Lines | static void rna_def_menu(BlenderRNA *brna) | ||||
| prop = RNA_def_property(srna, "bl_description", PROP_STRING, PROP_NONE); | prop = RNA_def_property(srna, "bl_description", PROP_STRING, PROP_NONE); | ||||
| RNA_def_property_string_sdna(prop, NULL, "type->description"); | RNA_def_property_string_sdna(prop, NULL, "type->description"); | ||||
| RNA_def_property_string_maxlength(prop, RNA_DYN_DESCR_MAX); /* else it uses the pointer size! */ | RNA_def_property_string_maxlength(prop, RNA_DYN_DESCR_MAX); /* else it uses the pointer size! */ | ||||
| RNA_def_property_string_funcs(prop, NULL, NULL, "rna_Menu_bl_description_set"); | RNA_def_property_string_funcs(prop, NULL, NULL, "rna_Menu_bl_description_set"); | ||||
| /* RNA_def_property_clear_flag(prop, PROP_EDITABLE); */ | /* RNA_def_property_clear_flag(prop, PROP_EDITABLE); */ | ||||
| RNA_def_property_flag(prop, PROP_REGISTER_OPTIONAL); | RNA_def_property_flag(prop, PROP_REGISTER_OPTIONAL); | ||||
| RNA_def_property_clear_flag(prop, PROP_NEVER_NULL); /* check for NULL */ | RNA_def_property_clear_flag(prop, PROP_NEVER_NULL); /* check for NULL */ | ||||
| prop = RNA_def_property(srna, "bl_origin", PROP_STRING, PROP_NONE); | |||||
| RNA_def_property_string_sdna(prop, NULL, "type->bl_origin"); | |||||
| RNA_def_property_flag(prop, PROP_REGISTER_OPTIONAL); | |||||
| RNA_define_verify_sdna(1); | RNA_define_verify_sdna(1); | ||||
| } | } | ||||
| void RNA_def_ui(BlenderRNA *brna) | void RNA_def_ui(BlenderRNA *brna) | ||||
| { | { | ||||
| rna_def_ui_layout(brna); | rna_def_ui_layout(brna); | ||||
| rna_def_panel(brna); | rna_def_panel(brna); | ||||
| rna_def_uilist(brna); | rna_def_uilist(brna); | ||||
| rna_def_header(brna); | rna_def_header(brna); | ||||
| rna_def_menu(brna); | rna_def_menu(brna); | ||||
| } | } | ||||
| #endif /* RNA_RUNTIME */ | #endif /* RNA_RUNTIME */ | ||||