Changeset View
Changeset View
Standalone View
Standalone View
source/blender/editors/gpencil/gpencil_add_monkey.c
| Show All 13 Lines | |||||
| #include "DNA_scene_types.h" | #include "DNA_scene_types.h" | ||||
| #include "BKE_context.h" | #include "BKE_context.h" | ||||
| #include "BKE_gpencil.h" | #include "BKE_gpencil.h" | ||||
| #include "BKE_gpencil_geom.h" | #include "BKE_gpencil_geom.h" | ||||
| #include "BKE_main.h" | #include "BKE_main.h" | ||||
| #include "BKE_material.h" | #include "BKE_material.h" | ||||
| #include "BLT_translation.h" | |||||
| #include "DEG_depsgraph.h" | #include "DEG_depsgraph.h" | ||||
| #include "ED_gpencil.h" | #include "ED_gpencil.h" | ||||
| void ED_gpencil_stroke_init_data(bGPDstroke *gps, | void ED_gpencil_stroke_init_data(bGPDstroke *gps, | ||||
| const float *array, | const float *array, | ||||
| const int totpoints, | const int totpoints, | ||||
| const float mat[4][4]) | const float mat[4][4]) | ||||
| Show All 19 Lines | typedef struct ColorTemplate { | ||||
| float fill[4]; | float fill[4]; | ||||
| } ColorTemplate; | } ColorTemplate; | ||||
| /* Add color an ensure duplications (matched by name) */ | /* Add color an ensure duplications (matched by name) */ | ||||
| static int gpencil_monkey_color( | static int gpencil_monkey_color( | ||||
| Main *bmain, Object *ob, const ColorTemplate *pct, bool stroke, bool fill) | Main *bmain, Object *ob, const ColorTemplate *pct, bool stroke, bool fill) | ||||
| { | { | ||||
| int index; | int index; | ||||
| Material *ma = BKE_gpencil_object_material_ensure_by_name(bmain, ob, pct->name, &index); | Material *ma = BKE_gpencil_object_material_ensure_by_name(bmain, ob, DATA_(pct->name), &index); | ||||
| copy_v4_v4(ma->gp_style->stroke_rgba, pct->line); | copy_v4_v4(ma->gp_style->stroke_rgba, pct->line); | ||||
| srgb_to_linearrgb_v4(ma->gp_style->stroke_rgba, ma->gp_style->stroke_rgba); | srgb_to_linearrgb_v4(ma->gp_style->stroke_rgba, ma->gp_style->stroke_rgba); | ||||
| copy_v4_v4(ma->gp_style->fill_rgba, pct->fill); | copy_v4_v4(ma->gp_style->fill_rgba, pct->fill); | ||||
| srgb_to_linearrgb_v4(ma->gp_style->fill_rgba, ma->gp_style->fill_rgba); | srgb_to_linearrgb_v4(ma->gp_style->fill_rgba, ma->gp_style->fill_rgba); | ||||
| if (!stroke) { | if (!stroke) { | ||||
| ▲ Show 20 Lines • Show All 710 Lines • ▼ Show 20 Lines | static const float data27[33 * GP_PRIM_DATABUF_SIZE] = { | ||||
| -0.2339f, 0.0f, 0.3137f, 0.5396f, 1.0f, -0.2118f, 0.0f, 0.2882f, 0.36f, 1.0f, | -0.2339f, 0.0f, 0.3137f, 0.5396f, 1.0f, -0.2118f, 0.0f, 0.2882f, 0.36f, 1.0f, | ||||
| -0.1906f, 0.0f, 0.2516f, 0.1f, 1.0f, | -0.1906f, 0.0f, 0.2516f, 0.1f, 1.0f, | ||||
| }; | }; | ||||
| /* ***************************************************************** */ | /* ***************************************************************** */ | ||||
| /* Monkey Color Data */ | /* Monkey Color Data */ | ||||
| static const ColorTemplate gp_monkey_pct_black = { | static const ColorTemplate gp_monkey_pct_black = { | ||||
| "Black", | N_("Black"), | ||||
| {0.0f, 0.0f, 0.0f, 1.0f}, | {0.0f, 0.0f, 0.0f, 1.0f}, | ||||
| {0.0f, 0.0f, 0.0f, 0.0f}, | {0.0f, 0.0f, 0.0f, 0.0f}, | ||||
| }; | }; | ||||
| static const ColorTemplate gp_monkey_pct_skin = { | static const ColorTemplate gp_monkey_pct_skin = { | ||||
| "Skin", | N_("Skin"), | ||||
| {0.733f, 0.569f, 0.361f, 1.0f}, | {0.733f, 0.569f, 0.361f, 1.0f}, | ||||
| {0.745f, 0.502f, 0.278f, 1.0f}, | {0.745f, 0.502f, 0.278f, 1.0f}, | ||||
| }; | }; | ||||
| static const ColorTemplate gp_monkey_pct_skin_light = { | static const ColorTemplate gp_monkey_pct_skin_light = { | ||||
| "Skin_Light", | N_("Skin_Light"), | ||||
| {0.914f, 0.827f, 0.635f, 1.0f}, | {0.914f, 0.827f, 0.635f, 1.0f}, | ||||
| {0.913f, 0.828f, 0.637f, 0.0f}, | {0.913f, 0.828f, 0.637f, 0.0f}, | ||||
| }; | }; | ||||
| static const ColorTemplate gp_monkey_pct_skin_shadow = { | static const ColorTemplate gp_monkey_pct_skin_shadow = { | ||||
| "Skin_Shadow", | N_("Skin_Shadow"), | ||||
| {0.322f, 0.29f, 0.224f, 0.5f}, | {0.322f, 0.29f, 0.224f, 0.5f}, | ||||
| {0.32f, 0.29f, 0.223f, 0.3f}, | {0.32f, 0.29f, 0.223f, 0.3f}, | ||||
| }; | }; | ||||
| static const ColorTemplate gp_monkey_pct_eyes = { | static const ColorTemplate gp_monkey_pct_eyes = { | ||||
| "Eyes", | N_("Eyes"), | ||||
| {0.553f, 0.39f, 0.266f, 0.0f}, | {0.553f, 0.39f, 0.266f, 0.0f}, | ||||
| {0.847f, 0.723f, 0.599f, 1.0f}, | {0.847f, 0.723f, 0.599f, 1.0f}, | ||||
| }; | }; | ||||
| static const ColorTemplate gp_monkey_pct_pupils = { | static const ColorTemplate gp_monkey_pct_pupils = { | ||||
| "Pupils", | N_("Pupils"), | ||||
| {0.0f, 0.0f, 0.0f, 0.0f}, | {0.0f, 0.0f, 0.0f, 0.0f}, | ||||
| {0.0f, 0.0f, 0.0f, 1.0f}, | {0.0f, 0.0f, 0.0f, 1.0f}, | ||||
| }; | }; | ||||
| /* ***************************************************************** */ | /* ***************************************************************** */ | ||||
| /* Monkey API */ | /* Monkey API */ | ||||
| void ED_gpencil_create_monkey(bContext *C, Object *ob, float mat[4][4]) | void ED_gpencil_create_monkey(bContext *C, Object *ob, float mat[4][4]) | ||||
| ▲ Show 20 Lines • Show All 146 Lines • Show Last 20 Lines | |||||