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:
authorAntony Riakiotakis <kalast@gmail.com>2013-03-07 02:54:44 +0400
committerAntony Riakiotakis <kalast@gmail.com>2013-03-07 02:54:44 +0400
commit65869589b6bc0caf9a08a10415a18dc563a447cf (patch)
tree3caa53de3471be33d642efe41c5913398bb8711f /source/blender/blenkernel/intern/paint.c
parent53b7bc8f1f7126600f431e63398a7678e643c8ae (diff)
Support position jittering on new texpaint code using the stroke system.
Diffstat (limited to 'source/blender/blenkernel/intern/paint.c')
-rw-r--r--source/blender/blenkernel/intern/paint.c49
1 files changed, 49 insertions, 0 deletions
diff --git a/source/blender/blenkernel/intern/paint.c b/source/blender/blenkernel/intern/paint.c
index d34d5eaa250..a001a13d000 100644
--- a/source/blender/blenkernel/intern/paint.c
+++ b/source/blender/blenkernel/intern/paint.c
@@ -137,6 +137,55 @@ Paint *paint_get_active_from_context(const bContext *C)
return NULL;
}
+PaintMode paintmode_get_active_from_context(const bContext *C)
+{
+ Scene *sce = CTX_data_scene(C);
+ SpaceImage *sima;
+
+ if (sce) {
+ ToolSettings *ts = sce->toolsettings;
+ Object *obact = NULL;
+
+ if (sce->basact && sce->basact->object)
+ obact = sce->basact->object;
+
+ if ((sima = CTX_wm_space_image(C)) != NULL) {
+ if (obact && obact->mode == OB_MODE_EDIT) {
+ if (sima->mode == SI_MODE_PAINT)
+ return PAINT_TEXTURE_2D;
+ else if (ts->use_uv_sculpt)
+ return PAINT_SCULPT_UV;
+ }
+ else {
+ return PAINT_TEXTURE_2D;
+ }
+ }
+ else if (obact) {
+ switch (obact->mode) {
+ case OB_MODE_SCULPT:
+ return PAINT_SCULPT;
+ case OB_MODE_VERTEX_PAINT:
+ return PAINT_VERTEX;
+ case OB_MODE_WEIGHT_PAINT:
+ return PAINT_WEIGHT;
+ case OB_MODE_TEXTURE_PAINT:
+ return PAINT_TEXTURE_PROJECTIVE;
+ case OB_MODE_EDIT:
+ if (ts->use_uv_sculpt)
+ return PAINT_SCULPT_UV;
+ else
+ return PAINT_TEXTURE_2D;
+ }
+ }
+ else {
+ /* default to image paint */
+ return PAINT_TEXTURE_2D;
+ }
+ }
+
+ return PAINT_INVALID;
+}
+
Brush *paint_brush(Paint *p)
{
return p ? p->brush : NULL;