Changeset View
Changeset View
Standalone View
Standalone View
source/blender/blenkernel/intern/brush.c
| Show First 20 Lines • Show All 83 Lines • ▼ Show 20 Lines | static void brush_copy_data(Main *UNUSED(bmain), ID *id_dst, const ID *id_src, const int flag) | ||||
| if (brush_src->gpencil_settings != NULL) { | if (brush_src->gpencil_settings != NULL) { | ||||
| brush_dst->gpencil_settings = MEM_dupallocN(brush_src->gpencil_settings); | brush_dst->gpencil_settings = MEM_dupallocN(brush_src->gpencil_settings); | ||||
| brush_dst->gpencil_settings->curve_sensitivity = BKE_curvemapping_copy( | brush_dst->gpencil_settings->curve_sensitivity = BKE_curvemapping_copy( | ||||
| brush_src->gpencil_settings->curve_sensitivity); | brush_src->gpencil_settings->curve_sensitivity); | ||||
| brush_dst->gpencil_settings->curve_strength = BKE_curvemapping_copy( | brush_dst->gpencil_settings->curve_strength = BKE_curvemapping_copy( | ||||
| brush_src->gpencil_settings->curve_strength); | brush_src->gpencil_settings->curve_strength); | ||||
| brush_dst->gpencil_settings->curve_jitter = BKE_curvemapping_copy( | brush_dst->gpencil_settings->curve_jitter = BKE_curvemapping_copy( | ||||
| brush_src->gpencil_settings->curve_jitter); | brush_src->gpencil_settings->curve_jitter); | ||||
| brush_dst->gpencil_settings->curve_rand_pressure = BKE_curvemapping_copy( | |||||
| brush_src->gpencil_settings->curve_rand_pressure); | |||||
| brush_dst->gpencil_settings->curve_rand_strength = BKE_curvemapping_copy( | |||||
| brush_src->gpencil_settings->curve_rand_strength); | |||||
| brush_dst->gpencil_settings->curve_rand_uv = BKE_curvemapping_copy( | |||||
| brush_src->gpencil_settings->curve_rand_uv); | |||||
| brush_dst->gpencil_settings->curve_rand_hue = BKE_curvemapping_copy( | |||||
| brush_src->gpencil_settings->curve_rand_hue); | |||||
| brush_dst->gpencil_settings->curve_rand_saturation = BKE_curvemapping_copy( | |||||
| brush_src->gpencil_settings->curve_rand_saturation); | |||||
| brush_dst->gpencil_settings->curve_rand_value = BKE_curvemapping_copy( | |||||
| brush_src->gpencil_settings->curve_rand_value); | |||||
| } | } | ||||
| /* enable fake user by default */ | /* enable fake user by default */ | ||||
| id_fake_user_set(&brush_dst->id); | id_fake_user_set(&brush_dst->id); | ||||
| } | } | ||||
| static void brush_free_data(ID *id) | static void brush_free_data(ID *id) | ||||
| { | { | ||||
| Brush *brush = (Brush *)id; | Brush *brush = (Brush *)id; | ||||
| if (brush->icon_imbuf) { | if (brush->icon_imbuf) { | ||||
| IMB_freeImBuf(brush->icon_imbuf); | IMB_freeImBuf(brush->icon_imbuf); | ||||
| } | } | ||||
| BKE_curvemapping_free(brush->curve); | BKE_curvemapping_free(brush->curve); | ||||
| if (brush->gpencil_settings != NULL) { | if (brush->gpencil_settings != NULL) { | ||||
| BKE_curvemapping_free(brush->gpencil_settings->curve_sensitivity); | BKE_curvemapping_free(brush->gpencil_settings->curve_sensitivity); | ||||
| BKE_curvemapping_free(brush->gpencil_settings->curve_strength); | BKE_curvemapping_free(brush->gpencil_settings->curve_strength); | ||||
| BKE_curvemapping_free(brush->gpencil_settings->curve_jitter); | BKE_curvemapping_free(brush->gpencil_settings->curve_jitter); | ||||
| BKE_curvemapping_free(brush->gpencil_settings->curve_rand_pressure); | |||||
| BKE_curvemapping_free(brush->gpencil_settings->curve_rand_strength); | |||||
| BKE_curvemapping_free(brush->gpencil_settings->curve_rand_uv); | |||||
| BKE_curvemapping_free(brush->gpencil_settings->curve_rand_hue); | |||||
| BKE_curvemapping_free(brush->gpencil_settings->curve_rand_saturation); | |||||
| BKE_curvemapping_free(brush->gpencil_settings->curve_rand_value); | |||||
| MEM_SAFE_FREE(brush->gpencil_settings); | MEM_SAFE_FREE(brush->gpencil_settings); | ||||
| } | } | ||||
| MEM_SAFE_FREE(brush->gradient); | MEM_SAFE_FREE(brush->gradient); | ||||
| BKE_previewimg_free(&(brush->preview)); | BKE_previewimg_free(&(brush->preview)); | ||||
| } | } | ||||
| ▲ Show 20 Lines • Show All 157 Lines • ▼ Show 20 Lines | void BKE_brush_init_gpencil_settings(Brush *brush) | ||||
| brush->gpencil_settings->draw_jitter = 0.0f; | brush->gpencil_settings->draw_jitter = 0.0f; | ||||
| brush->gpencil_settings->flag |= GP_BRUSH_USE_JITTER_PRESSURE; | brush->gpencil_settings->flag |= GP_BRUSH_USE_JITTER_PRESSURE; | ||||
| brush->gpencil_settings->icon_id = GP_BRUSH_ICON_PEN; | brush->gpencil_settings->icon_id = GP_BRUSH_ICON_PEN; | ||||
| /* curves */ | /* curves */ | ||||
| brush->gpencil_settings->curve_sensitivity = BKE_curvemapping_add(1, 0.0f, 0.0f, 1.0f, 1.0f); | brush->gpencil_settings->curve_sensitivity = BKE_curvemapping_add(1, 0.0f, 0.0f, 1.0f, 1.0f); | ||||
| brush->gpencil_settings->curve_strength = BKE_curvemapping_add(1, 0.0f, 0.0f, 1.0f, 1.0f); | brush->gpencil_settings->curve_strength = BKE_curvemapping_add(1, 0.0f, 0.0f, 1.0f, 1.0f); | ||||
| brush->gpencil_settings->curve_jitter = BKE_curvemapping_add(1, 0.0f, 0.0f, 1.0f, 1.0f); | brush->gpencil_settings->curve_jitter = BKE_curvemapping_add(1, 0.0f, 0.0f, 1.0f, 1.0f); | ||||
| brush->gpencil_settings->curve_rand_pressure = BKE_curvemapping_add(1, 0.0f, 0.0f, 1.0f, 1.0f); | |||||
| brush->gpencil_settings->curve_rand_strength = BKE_curvemapping_add(1, 0.0f, 0.0f, 1.0f, 1.0f); | |||||
| brush->gpencil_settings->curve_rand_uv = BKE_curvemapping_add(1, 0.0f, 0.0f, 1.0f, 1.0f); | |||||
| brush->gpencil_settings->curve_rand_hue = BKE_curvemapping_add(1, 0.0f, 0.0f, 1.0f, 1.0f); | |||||
| brush->gpencil_settings->curve_rand_saturation = BKE_curvemapping_add(1, 0.0f, 0.0f, 1.0f, 1.0f); | |||||
| brush->gpencil_settings->curve_rand_value = BKE_curvemapping_add(1, 0.0f, 0.0f, 1.0f, 1.0f); | |||||
| } | } | ||||
| /* add a new gp-brush */ | /* add a new gp-brush */ | ||||
| Brush *BKE_brush_add_gpencil(Main *bmain, ToolSettings *ts, const char *name, eObjectMode mode) | Brush *BKE_brush_add_gpencil(Main *bmain, ToolSettings *ts, const char *name, eObjectMode mode) | ||||
| { | { | ||||
| Paint *paint = NULL; | Paint *paint = NULL; | ||||
| Brush *brush; | Brush *brush; | ||||
| switch (mode) { | switch (mode) { | ||||
| ▲ Show 20 Lines • Show All 1,840 Lines • Show Last 20 Lines | |||||