Changeset View
Changeset View
Standalone View
Standalone View
source/blender/blenkernel/intern/DerivedMesh.c
| Show First 20 Lines • Show All 1,066 Lines • ▼ Show 20 Lines | enum { | ||||
| CALC_WP_GROUP_USER_ACTIVE = (1 << 1), | CALC_WP_GROUP_USER_ACTIVE = (1 << 1), | ||||
| CALC_WP_GROUP_USER_ALL = (1 << 2), | CALC_WP_GROUP_USER_ALL = (1 << 2), | ||||
| CALC_WP_MULTIPAINT = (1 << 3), | CALC_WP_MULTIPAINT = (1 << 3), | ||||
| CALC_WP_AUTO_NORMALIZE = (1 << 4) | CALC_WP_AUTO_NORMALIZE = (1 << 4) | ||||
| }; | }; | ||||
| typedef struct DMWeightColorInfo { | typedef struct DMWeightColorInfo { | ||||
| const ColorBand *coba; | const ColorBand *coba; // color mapping to weight range [0.0,1.0] | ||||
| const char *alert_color; | const char *alert_color; // color for unreferenced verts. | ||||
| signed char weight_user; // see enum for OB_DRAW_GROUPUSER_NONE, ... | |||||
campbellbarton: All these can be removed, just pass via the callback `data` | |||||
| } DMWeightColorInfo; | } DMWeightColorInfo; | ||||
| static int dm_drawflag_calc(ToolSettings *ts) | static int dm_drawflag_calc(ToolSettings *ts) | ||||
| { | { | ||||
| return ((ts->multipaint ? CALC_WP_MULTIPAINT : | return ((ts->multipaint ? CALC_WP_MULTIPAINT : | ||||
| /* CALC_WP_GROUP_USER_ACTIVE or CALC_WP_GROUP_USER_ALL*/ | /* CALC_WP_GROUP_USER_ACTIVE or CALC_WP_GROUP_USER_ALL*/ | ||||
| (1 << ts->weightuser)) | | (1 << ts->weightuser)) | | ||||
| ▲ Show 20 Lines • Show All 86 Lines • ▼ Show 20 Lines | |||||
| } | } | ||||
| static DMWeightColorInfo G_dm_wcinfo; | static DMWeightColorInfo G_dm_wcinfo; | ||||
| void vDM_ColorBand_store(const ColorBand *coba, const char alert_color[4]) | void vDM_ColorBand_store(const ColorBand *coba, const char alert_color[4]) | ||||
| { | { | ||||
| G_dm_wcinfo.coba = coba; | G_dm_wcinfo.coba = coba; | ||||
| G_dm_wcinfo.alert_color = alert_color; | G_dm_wcinfo.alert_color = alert_color; | ||||
| G_dm_wcinfo.weight_user = OB_DRAW_GROUPUSER_NONE; | |||||
| } | |||||
| void DM_set_weight_user(const signed char weightuser) | |||||
| { | |||||
| G_dm_wcinfo.weight_user = weightuser; | |||||
| } | |||||
| const char DM_get_weight_user() | |||||
| { | |||||
| return G_dm_wcinfo.weight_user; | |||||
| } | |||||
| void DM_get_weight_alert_color(float *col) | |||||
| { | |||||
| if (G_dm_wcinfo.weight_user != OB_DRAW_GROUPUSER_NONE) { | |||||
| col[0] = (float)G_dm_wcinfo.alert_color[0] / 255.0; | |||||
| col[1] = (float)G_dm_wcinfo.alert_color[1] / 255.0; | |||||
| col[2] = (float)G_dm_wcinfo.alert_color[2] / 255.0; | |||||
| } | |||||
| else { | |||||
| weight_to_rgb(col, 0.0); | |||||
| } | |||||
| } | } | ||||
| /* return an array of vertex weight colors, caller must free. | /* return an array of vertex weight colors, caller must free. | ||||
| * | * | ||||
| * note that we could save some memory and allocate RGB only but then we'd need to | * note that we could save some memory and allocate RGB only but then we'd need to | ||||
| * re-arrange the colors when copying to the face since MCol has odd ordering, | * re-arrange the colors when copying to the face since MCol has odd ordering, | ||||
| * so leave this as is - campbell */ | * so leave this as is - campbell */ | ||||
| static void calc_weightpaint_vert_array(Object *ob, DerivedMesh *dm, int const draw_flag, DMWeightColorInfo *dm_wcinfo, | static void calc_weightpaint_vert_array(Object *ob, DerivedMesh *dm, int const draw_flag, DMWeightColorInfo *dm_wcinfo, | ||||
| ▲ Show 20 Lines • Show All 2,250 Lines • Show Last 20 Lines | |||||
All these can be removed, just pass via the callback data