diff options
Diffstat (limited to 'source/blender/makesrna/intern/rna_main_api.c')
-rw-r--r-- | source/blender/makesrna/intern/rna_main_api.c | 45 |
1 files changed, 44 insertions, 1 deletions
diff --git a/source/blender/makesrna/intern/rna_main_api.c b/source/blender/makesrna/intern/rna_main_api.c index 8ac620c2fcf..f96b28ac870 100644 --- a/source/blender/makesrna/intern/rna_main_api.c +++ b/source/blender/makesrna/intern/rna_main_api.c @@ -63,6 +63,7 @@ #include "BKE_particle.h" #include "BKE_font.h" #include "BKE_node.h" +#include "BKE_linestyle.h" #include "DNA_armature_types.h" #include "DNA_camera_types.h" @@ -479,6 +480,22 @@ void rna_Main_particles_remove(Main *bmain, ReportList *reports, ParticleSetting /* XXX python now has invalid pointer? */ } +FreestyleLineStyle *rna_Main_linestyles_new(Main *bmain, const char* name) +{ + FreestyleLineStyle *linestyle = FRS_new_linestyle(name, bmain); + linestyle->id.us--; + return linestyle; +} +void rna_Main_linestyles_remove(Main *bmain, ReportList *reports, FreestyleLineStyle *linestyle) +{ + if(ID_REAL_USERS(linestyle) <= 0) + free_libblock(&bmain->linestyle, linestyle); + else + BKE_reportf(reports, RPT_ERROR, "Line style \"%s\" must have zero users to be removed, found %d.", linestyle->id.name+2, ID_REAL_USERS(linestyle)); + + /* XXX python now has invalid pointer? */ +} + /* tag functions, all the same */ void rna_Main_cameras_tag(Main *bmain, int value) { tag_main_lb(&bmain->camera, value); } void rna_Main_scenes_tag(Main *bmain, int value) { tag_main_lb(&bmain->scene, value); } @@ -507,6 +524,7 @@ void rna_Main_armatures_tag(Main *bmain, int value) { tag_main_lb(&bmain->armatu void rna_Main_actions_tag(Main *bmain, int value) { tag_main_lb(&bmain->action, value); } void rna_Main_particles_tag(Main *bmain, int value) { tag_main_lb(&bmain->particle, value); } void rna_Main_gpencil_tag(Main *bmain, int value) { tag_main_lb(&bmain->gpencil, value); } +void rna_Main_linestyle_tag(Main *bmain, int value) { tag_main_lb(&bmain->linestyle, value); } #else @@ -783,7 +801,7 @@ void RNA_def_main_window_managers(BlenderRNA *brna, PropertyRNA *cprop) StructRNA *srna; FunctionRNA *func; PropertyRNA *parm; - + RNA_def_property_srna(cprop, "BlendDataWindowManagers"); srna= RNA_def_struct(brna, "BlendDataWindowManagers", NULL); RNA_def_struct_sdna(srna, "Main"); @@ -1236,6 +1254,31 @@ void RNA_def_main_gpencil(BlenderRNA *brna, PropertyRNA *cprop) parm= RNA_def_boolean(func, "value", 0, "Value", ""); RNA_def_property_flag(parm, PROP_REQUIRED); } +void RNA_def_main_linestyles(BlenderRNA *brna, PropertyRNA *cprop) +{ + StructRNA *srna; + FunctionRNA *func; + PropertyRNA *parm; + + RNA_def_property_srna(cprop, "BlendDataLineStyles"); + srna= RNA_def_struct(brna, "BlendDataLineStyles", NULL); + RNA_def_struct_sdna(srna, "Main"); + RNA_def_struct_ui_text(srna, "Main Line Styles", "Collection of line styles"); + + func= RNA_def_function(srna, "new", "rna_Main_linestyles_new"); + RNA_def_function_ui_description(func, "Add a new line style instance to the main database"); + parm= RNA_def_string(func, "name", "FreestyleLineStyle", 0, "", "New name for the datablock."); + RNA_def_property_flag(parm, PROP_REQUIRED); + /* return type */ + parm= RNA_def_pointer(func, "linestyle", "FreestyleLineStyle", "", "New line style datablock."); + RNA_def_function_return(func, parm); + + func= RNA_def_function(srna, "remove", "rna_Main_linestyles_remove"); + RNA_def_function_flag(func, FUNC_USE_REPORTS); + RNA_def_function_ui_description(func, "Remove a line style instance from the current blendfile."); + parm= RNA_def_pointer(func, "linestyle", "FreestyleLineStyle", "", "Line style to remove."); + RNA_def_property_flag(parm, PROP_REQUIRED); +} #endif |