Freestyle: Added handling of a user-specified name for creating a new line set.
This commit is contained in:
@@ -50,7 +50,7 @@ void BKE_freestyle_module_move_up(FreestyleConfig *config, FreestyleModuleConfig
|
||||
void BKE_freestyle_module_move_down(FreestyleConfig *config, FreestyleModuleConfig *module_conf);
|
||||
|
||||
/* FreestyleConfig.linesets */
|
||||
FreestyleLineSet *BKE_freestyle_lineset_add(FreestyleConfig *config);
|
||||
FreestyleLineSet *BKE_freestyle_lineset_add(FreestyleConfig *config, const char *name);
|
||||
bool BKE_freestyle_lineset_delete(FreestyleConfig *config, FreestyleLineSet *lineset);
|
||||
FreestyleLineSet *BKE_freestyle_lineset_get_active(FreestyleConfig *config);
|
||||
short BKE_freestyle_lineset_get_active_index(FreestyleConfig *config);
|
||||
|
||||
@@ -169,7 +169,7 @@ static FreestyleLineSet *alloc_lineset(void)
|
||||
return (FreestyleLineSet *)MEM_callocN(sizeof(FreestyleLineSet), "Freestyle line set");
|
||||
}
|
||||
|
||||
FreestyleLineSet *BKE_freestyle_lineset_add(FreestyleConfig *config)
|
||||
FreestyleLineSet *BKE_freestyle_lineset_add(FreestyleConfig *config, const char *name)
|
||||
{
|
||||
int lineset_index = BLI_countlist(&config->linesets);
|
||||
|
||||
@@ -186,10 +186,15 @@ FreestyleLineSet *BKE_freestyle_lineset_add(FreestyleConfig *config)
|
||||
lineset->edge_types = FREESTYLE_FE_SILHOUETTE | FREESTYLE_FE_BORDER | FREESTYLE_FE_CREASE;
|
||||
lineset->exclude_edge_types = 0;
|
||||
lineset->group = NULL;
|
||||
if (lineset_index > 0)
|
||||
if (name) {
|
||||
BLI_strncpy(lineset->name, name, sizeof(lineset->name));
|
||||
}
|
||||
else if (lineset_index > 0) {
|
||||
sprintf(lineset->name, "LineSet %i", lineset_index + 1);
|
||||
else
|
||||
}
|
||||
else {
|
||||
strcpy(lineset->name, "LineSet");
|
||||
}
|
||||
BKE_freestyle_lineset_unique_name(config, lineset);
|
||||
|
||||
return lineset;
|
||||
|
||||
@@ -712,7 +712,7 @@ static int freestyle_lineset_add_exec(bContext *C, wmOperator *UNUSED(op))
|
||||
Scene *scene = CTX_data_scene(C);
|
||||
SceneRenderLayer *srl = BLI_findlink(&scene->r.layers, scene->r.actlay);
|
||||
|
||||
BKE_freestyle_lineset_add(&srl->freestyleConfig);
|
||||
BKE_freestyle_lineset_add(&srl->freestyleConfig, NULL);
|
||||
|
||||
WM_event_add_notifier(C, NC_SCENE | ND_RENDER_OPTIONS, scene);
|
||||
|
||||
|
||||
@@ -1586,7 +1586,7 @@ static void rna_FreestyleLineSet_linestyle_set(PointerRNA *ptr, PointerRNA value
|
||||
static FreestyleLineSet *FreestyleSettings_lineset_add(ID *id, struct FreestyleSettings *config, const char *name)
|
||||
{
|
||||
Scene *scene = (Scene *)id;
|
||||
FreestyleLineSet *lineset = BKE_freestyle_lineset_add((FreestyleConfig *)config);
|
||||
FreestyleLineSet *lineset = BKE_freestyle_lineset_add((FreestyleConfig *)config, name);
|
||||
|
||||
DAG_id_tag_update(&scene->id, 0);
|
||||
WM_main_add_notifier(NC_SCENE | ND_RENDER_OPTIONS, NULL);
|
||||
|
||||
Reference in New Issue
Block a user