Changeset View
Changeset View
Standalone View
Standalone View
source/blender/blenkernel/intern/paint.c
| Show First 20 Lines • Show All 69 Lines • ▼ Show 20 Lines | |||||
| const char PAINT_CURSOR_SCULPT[3] = {255, 100, 100}; | const char PAINT_CURSOR_SCULPT[3] = {255, 100, 100}; | ||||
| const char PAINT_CURSOR_VERTEX_PAINT[3] = {255, 255, 255}; | const char PAINT_CURSOR_VERTEX_PAINT[3] = {255, 255, 255}; | ||||
| const char PAINT_CURSOR_WEIGHT_PAINT[3] = {200, 200, 255}; | const char PAINT_CURSOR_WEIGHT_PAINT[3] = {200, 200, 255}; | ||||
| const char PAINT_CURSOR_TEXTURE_PAINT[3] = {255, 255, 255}; | const char PAINT_CURSOR_TEXTURE_PAINT[3] = {255, 255, 255}; | ||||
| static eOverlayControlFlags overlay_flags = 0; | static eOverlayControlFlags overlay_flags = 0; | ||||
| void BKE_paint_invalidate_overlay_tex(Scene *scene, SceneLayer *sl, const Tex *tex) | void BKE_paint_invalidate_overlay_tex(Scene *scene, ViewLayer *sl, const Tex *tex) | ||||
| { | { | ||||
| Paint *p = BKE_paint_get_active(scene, sl); | Paint *p = BKE_paint_get_active(scene, sl); | ||||
| Brush *br = p->brush; | Brush *br = p->brush; | ||||
| if (!br) | if (!br) | ||||
| return; | return; | ||||
| if (br->mtex.tex == tex) | if (br->mtex.tex == tex) | ||||
| overlay_flags |= PAINT_INVALID_OVERLAY_TEXTURE_PRIMARY; | overlay_flags |= PAINT_INVALID_OVERLAY_TEXTURE_PRIMARY; | ||||
| if (br->mask_mtex.tex == tex) | if (br->mask_mtex.tex == tex) | ||||
| overlay_flags |= PAINT_INVALID_OVERLAY_TEXTURE_SECONDARY; | overlay_flags |= PAINT_INVALID_OVERLAY_TEXTURE_SECONDARY; | ||||
| } | } | ||||
| void BKE_paint_invalidate_cursor_overlay(Scene *scene, SceneLayer *sl, CurveMapping *curve) | void BKE_paint_invalidate_cursor_overlay(Scene *scene, ViewLayer *sl, CurveMapping *curve) | ||||
| { | { | ||||
| Paint *p = BKE_paint_get_active(scene, sl); | Paint *p = BKE_paint_get_active(scene, sl); | ||||
| Brush *br = p->brush; | Brush *br = p->brush; | ||||
| if (br && br->curve == curve) | if (br && br->curve == curve) | ||||
| overlay_flags |= PAINT_INVALID_OVERLAY_CURVE; | overlay_flags |= PAINT_INVALID_OVERLAY_CURVE; | ||||
| } | } | ||||
| ▲ Show 20 Lines • Show All 51 Lines • ▼ Show 20 Lines | switch (mode) { | ||||
| default: | default: | ||||
| return &ts->imapaint.paint; | return &ts->imapaint.paint; | ||||
| } | } | ||||
| } | } | ||||
| return NULL; | return NULL; | ||||
| } | } | ||||
| Paint *BKE_paint_get_active(Scene *sce, SceneLayer *sl) | Paint *BKE_paint_get_active(Scene *sce, ViewLayer *sl) | ||||
| { | { | ||||
| if (sce && sl) { | if (sce && sl) { | ||||
| ToolSettings *ts = sce->toolsettings; | ToolSettings *ts = sce->toolsettings; | ||||
| if (sl->basact && sl->basact->object) { | if (sl->basact && sl->basact->object) { | ||||
| switch (sl->basact->object->mode) { | switch (sl->basact->object->mode) { | ||||
| case OB_MODE_SCULPT: | case OB_MODE_SCULPT: | ||||
| return &ts->sculpt->paint; | return &ts->sculpt->paint; | ||||
| Show All 15 Lines | Paint *BKE_paint_get_active(Scene *sce, ViewLayer *sl) | ||||
| } | } | ||||
| return NULL; | return NULL; | ||||
| } | } | ||||
| Paint *BKE_paint_get_active_from_context(const bContext *C) | Paint *BKE_paint_get_active_from_context(const bContext *C) | ||||
| { | { | ||||
| Scene *sce = CTX_data_scene(C); | Scene *sce = CTX_data_scene(C); | ||||
| SceneLayer *sl = CTX_data_scene_layer(C); | ViewLayer *sl = CTX_data_view_layer(C); | ||||
| SpaceImage *sima; | SpaceImage *sima; | ||||
| if (sce && sl) { | if (sce && sl) { | ||||
| ToolSettings *ts = sce->toolsettings; | ToolSettings *ts = sce->toolsettings; | ||||
| Object *obact = NULL; | Object *obact = NULL; | ||||
| if (sl->basact && sl->basact->object) | if (sl->basact && sl->basact->object) | ||||
| obact = sl->basact->object; | obact = sl->basact->object; | ||||
| Show All 34 Lines | Paint *BKE_paint_get_active_from_context(const bContext *C) | ||||
| } | } | ||||
| return NULL; | return NULL; | ||||
| } | } | ||||
| ePaintMode BKE_paintmode_get_active_from_context(const bContext *C) | ePaintMode BKE_paintmode_get_active_from_context(const bContext *C) | ||||
| { | { | ||||
| Scene *sce = CTX_data_scene(C); | Scene *sce = CTX_data_scene(C); | ||||
| SceneLayer *sl = CTX_data_scene_layer(C); | ViewLayer *sl = CTX_data_view_layer(C); | ||||
| SpaceImage *sima; | SpaceImage *sima; | ||||
| if (sce && sl) { | if (sce && sl) { | ||||
| ToolSettings *ts = sce->toolsettings; | ToolSettings *ts = sce->toolsettings; | ||||
| Object *obact = NULL; | Object *obact = NULL; | ||||
| if (sl->basact && sl->basact->object) | if (sl->basact && sl->basact->object) | ||||
| obact = sl->basact->object; | obact = sl->basact->object; | ||||
| ▲ Show 20 Lines • Show All 806 Lines • Show Last 20 Lines | |||||