Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCampbell Barton <ideasman42@gmail.com>2018-11-03 07:44:16 +0300
committerCampbell Barton <ideasman42@gmail.com>2018-11-03 07:55:45 +0300
commit13c3c9b22fd8453d4418577efbc2ccb93209e92e (patch)
treecb332a7ed0e9022db2d189cd11bd983e33248468 /source/blender/blenkernel/intern/paint.c
parenta18927463c18eec24c74ce8c0b3c261ff5ace889 (diff)
Cleanup: move brush query into utility function
Diffstat (limited to 'source/blender/blenkernel/intern/paint.c')
-rw-r--r--source/blender/blenkernel/intern/paint.c52
1 files changed, 52 insertions, 0 deletions
diff --git a/source/blender/blenkernel/intern/paint.c b/source/blender/blenkernel/intern/paint.c
index 93b54fcb132..7838fb69f1a 100644
--- a/source/blender/blenkernel/intern/paint.c
+++ b/source/blender/blenkernel/intern/paint.c
@@ -302,6 +302,58 @@ void BKE_paint_brush_set(Paint *p, Brush *br)
}
}
+bool BKE_paint_brush_tool_info(
+ const Scene *scene, const struct Paint *paint,
+ uint *r_tool_offset, eObjectMode *r_ob_mode)
+{
+ ToolSettings *ts = scene->toolsettings;
+ if (paint == &ts->imapaint.paint) {
+ if (r_tool_offset != NULL) {
+ *r_tool_offset = offsetof(Brush, imagepaint_tool);
+ }
+ if (r_ob_mode != NULL) {
+ *r_ob_mode = OB_MODE_TEXTURE_PAINT;
+ }
+ }
+ else if (paint == &ts->sculpt->paint) {
+ if (r_tool_offset != NULL) {
+ *r_tool_offset = offsetof(Brush, sculpt_tool);
+ }
+ if (r_ob_mode != NULL) {
+ *r_ob_mode = OB_MODE_SCULPT;
+ }
+ }
+ else if (paint == &ts->vpaint->paint) {
+ if (r_tool_offset != NULL) {
+ *r_tool_offset = offsetof(Brush, vertexpaint_tool);
+ }
+ if (r_ob_mode != NULL) {
+ *r_ob_mode = OB_MODE_VERTEX_PAINT;
+ }
+ }
+ else if (paint == &ts->wpaint->paint) {
+ if (r_tool_offset != NULL) {
+ *r_tool_offset = offsetof(Brush, vertexpaint_tool);
+ }
+ if (r_ob_mode != NULL) {
+ *r_ob_mode = OB_MODE_WEIGHT_PAINT;
+ }
+ }
+ else if (paint == &ts->gp_paint->paint) {
+ if (r_tool_offset != NULL) {
+ *r_tool_offset = offsetof(Brush, gpencil_tool);
+ }
+ if (r_ob_mode != NULL) {
+ *r_ob_mode = OB_MODE_GPENCIL_PAINT;
+ }
+ }
+ else {
+ return false;
+ }
+ return true;
+}
+
+
/** Free (or release) any data used by this paint curve (does not free the pcurve itself). */
void BKE_paint_curve_free(PaintCurve *pc)
{