2009-08-15 21:48:50 +02:00
|
|
|
/*
|
|
|
|
* ***** BEGIN GPL LICENSE BLOCK *****
|
|
|
|
*
|
|
|
|
* This program is free software; you can redistribute it and/or
|
|
|
|
* modify it under the terms of the GNU General Public License
|
|
|
|
* as published by the Free Software Foundation; either version 2
|
|
|
|
* of the License, or (at your option) any later version.
|
|
|
|
*
|
|
|
|
* This program is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
* GNU General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU General Public License
|
|
|
|
* along with this program; if not, write to the Free Software Foundation,
|
2010-02-12 14:34:04 +01:00
|
|
|
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
2009-08-15 21:48:50 +02:00
|
|
|
*
|
|
|
|
* The Original Code is Copyright (C) 2009 by Nicholas Bishop
|
|
|
|
* All rights reserved.
|
|
|
|
*
|
|
|
|
* The Original Code is: all of this file.
|
|
|
|
*
|
|
|
|
* Contributor(s): none yet.
|
|
|
|
*
|
|
|
|
* ***** END GPL LICENSE BLOCK *****
|
2018-06-01 18:19:39 +02:00
|
|
|
*/
|
2009-08-15 21:48:50 +02:00
|
|
|
|
2012-02-17 19:59:41 +01:00
|
|
|
#ifndef __BKE_PAINT_H__
|
|
|
|
#define __BKE_PAINT_H__
|
2009-08-15 21:48:50 +02:00
|
|
|
|
2011-02-18 14:05:18 +01:00
|
|
|
/** \file BKE_paint.h
|
|
|
|
* \ingroup bke
|
|
|
|
*/
|
|
|
|
|
2012-06-04 09:29:45 +02:00
|
|
|
struct bContext;
|
2012-12-30 19:27:33 +01:00
|
|
|
struct BMesh;
|
2013-01-19 17:10:21 +01:00
|
|
|
struct BMFace;
|
2009-08-16 21:50:00 +02:00
|
|
|
struct Brush;
|
Paint refactoring commit, non-disruptive (in theory :p)
* Fix precision overflow issue with overlay previews,
* Expose alpha mask mapping to UI (still not functional but coming soon).
* More overlay refactoring:
Overlay now does minimal checking for texture refresh.
Instead, we now have invalidation flags to set an aspect of the brush
overlay as invalid. This is necessary because this way we will be able to
separate and preview different brush attributes on the overlays, using
different textures:
These attributes/aspects are:
Primary texture (main texture for sculpt, vertex, imapaint)
Secondary texture (mask/alpha texture for imapaint)
Cursor texture (cursor texture. It involves brush strength and curves)
Modified the relevant RNA property update functions and C update callback
functions to call the relevant cursor invalidation functions instead
of checking every frame for multiple properties.
Properties that affect this are:
Image changes, if image is used by current brush,
Texture slot changes, similarly
Curve changes,
Object mode change invalidates the cursor
Paint tool change invalidates the cursor.
These changes give slightly more invalidation cases than simply
comparing the relevant properties each frame, but these do not occur in
performance critical moments and it's a much more elegant system than
adding more variables to check per frame each time we add something on
the system.
2013-04-12 19:21:31 +02:00
|
|
|
struct CurveMapping;
|
2012-03-17 05:41:36 +01:00
|
|
|
struct MeshElemMap;
|
2012-05-10 22:33:55 +02:00
|
|
|
struct GridPaintMask;
|
2014-07-21 12:02:05 +02:00
|
|
|
struct Main;
|
2018-06-08 17:04:54 +02:00
|
|
|
struct Mesh;
|
2015-07-16 19:36:03 +02:00
|
|
|
struct MLoop;
|
|
|
|
struct MLoopTri;
|
2009-08-28 23:47:11 +02:00
|
|
|
struct MFace;
|
|
|
|
struct MVert;
|
2009-08-15 21:48:50 +02:00
|
|
|
struct Object;
|
2009-08-16 21:50:00 +02:00
|
|
|
struct Paint;
|
2014-07-21 12:02:05 +02:00
|
|
|
struct PaintCurve;
|
|
|
|
struct Palette;
|
|
|
|
struct PaletteColor;
|
2009-10-27 20:53:34 +01:00
|
|
|
struct PBVH;
|
2014-10-06 15:12:06 +02:00
|
|
|
struct ReportList;
|
2009-08-16 21:50:00 +02:00
|
|
|
struct Scene;
|
2017-11-22 13:52:39 +01:00
|
|
|
struct ViewLayer;
|
2014-05-06 22:30:51 +02:00
|
|
|
struct Sculpt;
|
2009-08-28 23:47:11 +02:00
|
|
|
struct StrokeCache;
|
Paint refactoring commit, non-disruptive (in theory :p)
* Fix precision overflow issue with overlay previews,
* Expose alpha mask mapping to UI (still not functional but coming soon).
* More overlay refactoring:
Overlay now does minimal checking for texture refresh.
Instead, we now have invalidation flags to set an aspect of the brush
overlay as invalid. This is necessary because this way we will be able to
separate and preview different brush attributes on the overlays, using
different textures:
These attributes/aspects are:
Primary texture (main texture for sculpt, vertex, imapaint)
Secondary texture (mask/alpha texture for imapaint)
Cursor texture (cursor texture. It involves brush strength and curves)
Modified the relevant RNA property update functions and C update callback
functions to call the relevant cursor invalidation functions instead
of checking every frame for multiple properties.
Properties that affect this are:
Image changes, if image is used by current brush,
Texture slot changes, similarly
Curve changes,
Object mode change invalidates the cursor
Paint tool change invalidates the cursor.
These changes give slightly more invalidation cases than simply
comparing the relevant properties each frame, but these do not occur in
performance critical moments and it's a much more elegant system than
adding more variables to check per frame each time we add something on
the system.
2013-04-12 19:21:31 +02:00
|
|
|
struct Tex;
|
2013-01-21 09:49:42 +01:00
|
|
|
struct ImagePool;
|
2013-03-13 04:46:22 +01:00
|
|
|
struct UnifiedPaintSettings;
|
2018-04-06 12:07:27 +02:00
|
|
|
struct Depsgraph;
|
2009-08-16 21:50:00 +02:00
|
|
|
|
2017-10-17 04:43:10 +02:00
|
|
|
enum eOverlayFlags;
|
2013-04-23 02:32:51 +02:00
|
|
|
|
2018-02-06 13:27:49 +01:00
|
|
|
#include "DNA_object_enums.h"
|
|
|
|
|
2009-08-20 18:00:17 +02:00
|
|
|
extern const char PAINT_CURSOR_SCULPT[3];
|
|
|
|
extern const char PAINT_CURSOR_VERTEX_PAINT[3];
|
|
|
|
extern const char PAINT_CURSOR_WEIGHT_PAINT[3];
|
|
|
|
extern const char PAINT_CURSOR_TEXTURE_PAINT[3];
|
|
|
|
|
2017-10-17 04:43:10 +02:00
|
|
|
typedef enum ePaintMode {
|
2015-08-31 20:37:38 +02:00
|
|
|
ePaintSculpt = 0,
|
|
|
|
ePaintVertex = 1,
|
|
|
|
ePaintWeight = 2,
|
|
|
|
ePaintTextureProjective = 3,
|
|
|
|
ePaintTexture2D = 4,
|
|
|
|
ePaintSculptUV = 5,
|
|
|
|
ePaintInvalid = 6
|
2017-10-17 04:43:10 +02:00
|
|
|
} ePaintMode;
|
2013-03-06 23:54:44 +01:00
|
|
|
|
Paint refactoring commit, non-disruptive (in theory :p)
* Fix precision overflow issue with overlay previews,
* Expose alpha mask mapping to UI (still not functional but coming soon).
* More overlay refactoring:
Overlay now does minimal checking for texture refresh.
Instead, we now have invalidation flags to set an aspect of the brush
overlay as invalid. This is necessary because this way we will be able to
separate and preview different brush attributes on the overlays, using
different textures:
These attributes/aspects are:
Primary texture (main texture for sculpt, vertex, imapaint)
Secondary texture (mask/alpha texture for imapaint)
Cursor texture (cursor texture. It involves brush strength and curves)
Modified the relevant RNA property update functions and C update callback
functions to call the relevant cursor invalidation functions instead
of checking every frame for multiple properties.
Properties that affect this are:
Image changes, if image is used by current brush,
Texture slot changes, similarly
Curve changes,
Object mode change invalidates the cursor
Paint tool change invalidates the cursor.
These changes give slightly more invalidation cases than simply
comparing the relevant properties each frame, but these do not occur in
performance critical moments and it's a much more elegant system than
adding more variables to check per frame each time we add something on
the system.
2013-04-12 19:21:31 +02:00
|
|
|
/* overlay invalidation */
|
2017-10-17 04:43:10 +02:00
|
|
|
typedef enum eOverlayControlFlags {
|
2013-04-16 17:02:41 +02:00
|
|
|
PAINT_INVALID_OVERLAY_TEXTURE_PRIMARY = 1,
|
|
|
|
PAINT_INVALID_OVERLAY_TEXTURE_SECONDARY = (1 << 2),
|
2013-04-23 00:20:38 +02:00
|
|
|
PAINT_INVALID_OVERLAY_CURVE = (1 << 3),
|
2013-04-23 02:32:51 +02:00
|
|
|
PAINT_OVERLAY_OVERRIDE_CURSOR = (1 << 4),
|
|
|
|
PAINT_OVERLAY_OVERRIDE_PRIMARY = (1 << 5),
|
|
|
|
PAINT_OVERLAY_OVERRIDE_SECONDARY = (1 << 6)
|
2017-10-17 04:43:10 +02:00
|
|
|
} eOverlayControlFlags;
|
Paint refactoring commit, non-disruptive (in theory :p)
* Fix precision overflow issue with overlay previews,
* Expose alpha mask mapping to UI (still not functional but coming soon).
* More overlay refactoring:
Overlay now does minimal checking for texture refresh.
Instead, we now have invalidation flags to set an aspect of the brush
overlay as invalid. This is necessary because this way we will be able to
separate and preview different brush attributes on the overlays, using
different textures:
These attributes/aspects are:
Primary texture (main texture for sculpt, vertex, imapaint)
Secondary texture (mask/alpha texture for imapaint)
Cursor texture (cursor texture. It involves brush strength and curves)
Modified the relevant RNA property update functions and C update callback
functions to call the relevant cursor invalidation functions instead
of checking every frame for multiple properties.
Properties that affect this are:
Image changes, if image is used by current brush,
Texture slot changes, similarly
Curve changes,
Object mode change invalidates the cursor
Paint tool change invalidates the cursor.
These changes give slightly more invalidation cases than simply
comparing the relevant properties each frame, but these do not occur in
performance critical moments and it's a much more elegant system than
adding more variables to check per frame each time we add something on
the system.
2013-04-12 19:21:31 +02:00
|
|
|
|
2013-04-23 02:32:51 +02:00
|
|
|
#define PAINT_OVERRIDE_MASK (PAINT_OVERLAY_OVERRIDE_SECONDARY | \
|
|
|
|
PAINT_OVERLAY_OVERRIDE_PRIMARY | \
|
|
|
|
PAINT_OVERLAY_OVERRIDE_CURSOR)
|
|
|
|
|
2018-04-05 18:20:27 +02:00
|
|
|
void BKE_paint_invalidate_overlay_tex(struct Scene *scene, struct ViewLayer *view_layer, const struct Tex *tex);
|
|
|
|
void BKE_paint_invalidate_cursor_overlay(struct Scene *scene, struct ViewLayer *view_layer, struct CurveMapping *curve);
|
Paint refactoring commit, non-disruptive (in theory :p)
* Fix precision overflow issue with overlay previews,
* Expose alpha mask mapping to UI (still not functional but coming soon).
* More overlay refactoring:
Overlay now does minimal checking for texture refresh.
Instead, we now have invalidation flags to set an aspect of the brush
overlay as invalid. This is necessary because this way we will be able to
separate and preview different brush attributes on the overlays, using
different textures:
These attributes/aspects are:
Primary texture (main texture for sculpt, vertex, imapaint)
Secondary texture (mask/alpha texture for imapaint)
Cursor texture (cursor texture. It involves brush strength and curves)
Modified the relevant RNA property update functions and C update callback
functions to call the relevant cursor invalidation functions instead
of checking every frame for multiple properties.
Properties that affect this are:
Image changes, if image is used by current brush,
Texture slot changes, similarly
Curve changes,
Object mode change invalidates the cursor
Paint tool change invalidates the cursor.
These changes give slightly more invalidation cases than simply
comparing the relevant properties each frame, but these do not occur in
performance critical moments and it's a much more elegant system than
adding more variables to check per frame each time we add something on
the system.
2013-04-12 19:21:31 +02:00
|
|
|
void BKE_paint_invalidate_overlay_all(void);
|
2017-10-17 04:43:10 +02:00
|
|
|
eOverlayControlFlags BKE_paint_get_overlay_flags(void);
|
|
|
|
void BKE_paint_reset_overlay_invalid(eOverlayControlFlags flag);
|
|
|
|
void BKE_paint_set_overlay_override(enum eOverlayFlags flag);
|
Paint refactoring commit, non-disruptive (in theory :p)
* Fix precision overflow issue with overlay previews,
* Expose alpha mask mapping to UI (still not functional but coming soon).
* More overlay refactoring:
Overlay now does minimal checking for texture refresh.
Instead, we now have invalidation flags to set an aspect of the brush
overlay as invalid. This is necessary because this way we will be able to
separate and preview different brush attributes on the overlays, using
different textures:
These attributes/aspects are:
Primary texture (main texture for sculpt, vertex, imapaint)
Secondary texture (mask/alpha texture for imapaint)
Cursor texture (cursor texture. It involves brush strength and curves)
Modified the relevant RNA property update functions and C update callback
functions to call the relevant cursor invalidation functions instead
of checking every frame for multiple properties.
Properties that affect this are:
Image changes, if image is used by current brush,
Texture slot changes, similarly
Curve changes,
Object mode change invalidates the cursor
Paint tool change invalidates the cursor.
These changes give slightly more invalidation cases than simply
comparing the relevant properties each frame, but these do not occur in
performance critical moments and it's a much more elegant system than
adding more variables to check per frame each time we add something on
the system.
2013-04-12 19:21:31 +02:00
|
|
|
|
2014-07-21 12:02:05 +02:00
|
|
|
/* palettes */
|
|
|
|
void BKE_palette_free(struct Palette *palette);
|
|
|
|
struct Palette *BKE_palette_add(struct Main *bmain, const char *name);
|
Refactor ID copying (and to some extent, ID freeing).
This will allow much finer controll over how we copy data-blocks, from
full copy in Main database, to "lighter" ones (out of Main, inside an
already allocated datablock, etc.).
This commit also transfers a llot of what was previously handled by
per-ID-type custom code to generic ID handling code in BKE_library.
Hopefully will avoid in future inconsistencies and missing bits we had
all over the codebase in the past.
It also adds missing copying handling for a few types, most notably
Scene (which where using a fully customized handling previously).
Note that the type of allocation used during copying (regular in Main,
allocated but outside of Main, or not allocated by ID handling code at
all) is stored in ID's, which allows to handle them correctly when
freeing. This needs to be taken care of with caution when doing 'weird'
unusual things with ID copying and/or allocation!
As a final note, while rather noisy, this commit will hopefully not
break too much existing branches, old 'API' has been kept for the main
part, as a wrapper around new code. Cleaning it up will happen later.
Design task : T51804
Phab Diff: D2714
2017-08-07 16:39:55 +02:00
|
|
|
void BKE_palette_copy_data(
|
|
|
|
struct Main *bmain, struct Palette *palette_dst, const struct Palette *palette_src, const int flag);
|
2017-06-14 22:36:30 +02:00
|
|
|
struct Palette *BKE_palette_copy(struct Main *bmain, const struct Palette *palette);
|
2016-07-28 14:40:26 +02:00
|
|
|
void BKE_palette_make_local(struct Main *bmain, struct Palette *palette, const bool lib_local);
|
2014-07-21 12:02:05 +02:00
|
|
|
struct PaletteColor *BKE_palette_color_add(struct Palette *palette);
|
|
|
|
bool BKE_palette_is_empty(const struct Palette *palette);
|
|
|
|
void BKE_palette_color_remove(struct Palette *palette, struct PaletteColor *color);
|
2015-03-18 05:09:04 +01:00
|
|
|
void BKE_palette_clear(struct Palette *palette);
|
2014-07-21 12:02:05 +02:00
|
|
|
|
|
|
|
/* paint curves */
|
|
|
|
struct PaintCurve *BKE_paint_curve_add(struct Main *bmain, const char *name);
|
|
|
|
void BKE_paint_curve_free(struct PaintCurve *pc);
|
Refactor ID copying (and to some extent, ID freeing).
This will allow much finer controll over how we copy data-blocks, from
full copy in Main database, to "lighter" ones (out of Main, inside an
already allocated datablock, etc.).
This commit also transfers a llot of what was previously handled by
per-ID-type custom code to generic ID handling code in BKE_library.
Hopefully will avoid in future inconsistencies and missing bits we had
all over the codebase in the past.
It also adds missing copying handling for a few types, most notably
Scene (which where using a fully customized handling previously).
Note that the type of allocation used during copying (regular in Main,
allocated but outside of Main, or not allocated by ID handling code at
all) is stored in ID's, which allows to handle them correctly when
freeing. This needs to be taken care of with caution when doing 'weird'
unusual things with ID copying and/or allocation!
As a final note, while rather noisy, this commit will hopefully not
break too much existing branches, old 'API' has been kept for the main
part, as a wrapper around new code. Cleaning it up will happen later.
Design task : T51804
Phab Diff: D2714
2017-08-07 16:39:55 +02:00
|
|
|
void BKE_paint_curve_copy_data(
|
|
|
|
struct Main *bmain, struct PaintCurve *pc_dst, const struct PaintCurve *pc_src, const int flag);
|
2017-06-14 22:36:30 +02:00
|
|
|
struct PaintCurve *BKE_paint_curve_copy(struct Main *bmain, const struct PaintCurve *pc);
|
2016-07-28 14:40:26 +02:00
|
|
|
void BKE_paint_curve_make_local(struct Main *bmain, struct PaintCurve *pc, const bool lib_local);
|
2014-07-21 12:02:05 +02:00
|
|
|
|
2018-06-11 11:05:37 +02:00
|
|
|
void BKE_paint_init(struct Main *bmain, struct Scene *sce, ePaintMode mode, const char col[3]);
|
2012-07-26 00:37:52 +02:00
|
|
|
void BKE_paint_free(struct Paint *p);
|
Refactor ID copying (and to some extent, ID freeing).
This will allow much finer controll over how we copy data-blocks, from
full copy in Main database, to "lighter" ones (out of Main, inside an
already allocated datablock, etc.).
This commit also transfers a llot of what was previously handled by
per-ID-type custom code to generic ID handling code in BKE_library.
Hopefully will avoid in future inconsistencies and missing bits we had
all over the codebase in the past.
It also adds missing copying handling for a few types, most notably
Scene (which where using a fully customized handling previously).
Note that the type of allocation used during copying (regular in Main,
allocated but outside of Main, or not allocated by ID handling code at
all) is stored in ID's, which allows to handle them correctly when
freeing. This needs to be taken care of with caution when doing 'weird'
unusual things with ID copying and/or allocation!
As a final note, while rather noisy, this commit will hopefully not
break too much existing branches, old 'API' has been kept for the main
part, as a wrapper around new code. Cleaning it up will happen later.
Design task : T51804
Phab Diff: D2714
2017-08-07 16:39:55 +02:00
|
|
|
void BKE_paint_copy(struct Paint *src, struct Paint *tar, const int flag);
|
2009-08-16 21:50:00 +02:00
|
|
|
|
2015-02-11 15:07:04 +01:00
|
|
|
void BKE_paint_cavity_curve_preset(struct Paint *p, int preset);
|
|
|
|
|
2018-02-06 13:27:49 +01:00
|
|
|
eObjectMode BKE_paint_object_mode_from_paint_mode(ePaintMode mode);
|
2017-10-17 04:43:10 +02:00
|
|
|
struct Paint *BKE_paint_get_active_from_paintmode(struct Scene *sce, ePaintMode mode);
|
2018-04-05 18:20:27 +02:00
|
|
|
struct Paint *BKE_paint_get_active(struct Scene *sce, struct ViewLayer *view_layer);
|
Paint refactoring commit, non-disruptive (in theory :p)
* Fix precision overflow issue with overlay previews,
* Expose alpha mask mapping to UI (still not functional but coming soon).
* More overlay refactoring:
Overlay now does minimal checking for texture refresh.
Instead, we now have invalidation flags to set an aspect of the brush
overlay as invalid. This is necessary because this way we will be able to
separate and preview different brush attributes on the overlays, using
different textures:
These attributes/aspects are:
Primary texture (main texture for sculpt, vertex, imapaint)
Secondary texture (mask/alpha texture for imapaint)
Cursor texture (cursor texture. It involves brush strength and curves)
Modified the relevant RNA property update functions and C update callback
functions to call the relevant cursor invalidation functions instead
of checking every frame for multiple properties.
Properties that affect this are:
Image changes, if image is used by current brush,
Texture slot changes, similarly
Curve changes,
Object mode change invalidates the cursor
Paint tool change invalidates the cursor.
These changes give slightly more invalidation cases than simply
comparing the relevant properties each frame, but these do not occur in
performance critical moments and it's a much more elegant system than
adding more variables to check per frame each time we add something on
the system.
2013-04-12 19:21:31 +02:00
|
|
|
struct Paint *BKE_paint_get_active_from_context(const struct bContext *C);
|
2017-10-17 04:43:10 +02:00
|
|
|
ePaintMode BKE_paintmode_get_active_from_context(const struct bContext *C);
|
Paint refactoring commit, non-disruptive (in theory :p)
* Fix precision overflow issue with overlay previews,
* Expose alpha mask mapping to UI (still not functional but coming soon).
* More overlay refactoring:
Overlay now does minimal checking for texture refresh.
Instead, we now have invalidation flags to set an aspect of the brush
overlay as invalid. This is necessary because this way we will be able to
separate and preview different brush attributes on the overlays, using
different textures:
These attributes/aspects are:
Primary texture (main texture for sculpt, vertex, imapaint)
Secondary texture (mask/alpha texture for imapaint)
Cursor texture (cursor texture. It involves brush strength and curves)
Modified the relevant RNA property update functions and C update callback
functions to call the relevant cursor invalidation functions instead
of checking every frame for multiple properties.
Properties that affect this are:
Image changes, if image is used by current brush,
Texture slot changes, similarly
Curve changes,
Object mode change invalidates the cursor
Paint tool change invalidates the cursor.
These changes give slightly more invalidation cases than simply
comparing the relevant properties each frame, but these do not occur in
performance critical moments and it's a much more elegant system than
adding more variables to check per frame each time we add something on
the system.
2013-04-12 19:21:31 +02:00
|
|
|
struct Brush *BKE_paint_brush(struct Paint *paint);
|
|
|
|
void BKE_paint_brush_set(struct Paint *paint, struct Brush *br);
|
2014-07-21 12:02:05 +02:00
|
|
|
struct Palette *BKE_paint_palette(struct Paint *paint);
|
|
|
|
void BKE_paint_palette_set(struct Paint *p, struct Palette *palette);
|
|
|
|
void BKE_paint_curve_set(struct Brush *br, struct PaintCurve *pc);
|
2015-04-13 11:27:10 +02:00
|
|
|
void BKE_paint_curve_clamp_endpoint_add_index(struct PaintCurve *pc, const int add_index);
|
2009-08-15 21:48:50 +02:00
|
|
|
|
2014-10-06 15:12:06 +02:00
|
|
|
void BKE_paint_data_warning(struct ReportList *reports, bool uvs, bool mat, bool tex, bool stencil);
|
|
|
|
bool BKE_paint_proj_mesh_data_check(struct Scene *scene, struct Object *ob, bool *uvs, bool *mat, bool *tex, bool *stencil);
|
|
|
|
|
2009-08-15 21:48:50 +02:00
|
|
|
/* testing face select mode
|
|
|
|
* Texture paint could be removed since selected faces are not used
|
|
|
|
* however hiding faces is useful */
|
2018-04-05 18:20:27 +02:00
|
|
|
bool BKE_paint_select_face_test(struct Object *ob);
|
|
|
|
bool BKE_paint_select_vert_test(struct Object *ob);
|
|
|
|
bool BKE_paint_select_elem_test(struct Object *ob);
|
2009-08-15 21:48:50 +02:00
|
|
|
|
2012-03-14 07:31:38 +01:00
|
|
|
/* partial visibility */
|
2015-07-16 19:36:03 +02:00
|
|
|
bool paint_is_face_hidden(const struct MLoopTri *lt, const struct MVert *mvert, const struct MLoop *mloop);
|
2014-01-21 16:48:11 +01:00
|
|
|
bool paint_is_grid_face_hidden(const unsigned int *grid_hidden,
|
|
|
|
int gridsize, int x, int y);
|
|
|
|
bool paint_is_bmesh_face_hidden(struct BMFace *f);
|
2012-03-14 07:31:38 +01:00
|
|
|
|
2012-05-10 22:33:55 +02:00
|
|
|
/* paint masks */
|
|
|
|
float paint_grid_paint_mask(const struct GridPaintMask *gpm, unsigned level,
|
2012-05-11 10:05:47 +02:00
|
|
|
unsigned x, unsigned y);
|
2014-07-21 12:02:05 +02:00
|
|
|
|
|
|
|
/* stroke related */
|
2017-12-18 04:35:15 +01:00
|
|
|
bool paint_calculate_rake_rotation(struct UnifiedPaintSettings *ups, struct Brush *brush, const float mouse_pos[2]);
|
2015-05-07 18:10:34 +02:00
|
|
|
void paint_update_brush_rake_rotation(struct UnifiedPaintSettings *ups, struct Brush *brush, float rotation);
|
2014-07-21 12:02:05 +02:00
|
|
|
|
2014-12-29 11:35:22 +01:00
|
|
|
void BKE_paint_stroke_get_average(struct Scene *scene, struct Object *ob, float stroke[3]);
|
|
|
|
|
2017-09-27 17:38:17 +02:00
|
|
|
/* Used for both vertex color and weight paint */
|
|
|
|
struct SculptVertexPaintGeomMap {
|
|
|
|
int *vert_map_mem;
|
|
|
|
struct MeshElemMap *vert_to_loop;
|
|
|
|
int *poly_map_mem;
|
|
|
|
struct MeshElemMap *vert_to_poly;
|
|
|
|
};
|
|
|
|
|
2009-08-28 23:47:11 +02:00
|
|
|
/* Session data (mode-specific) */
|
|
|
|
|
|
|
|
typedef struct SculptSession {
|
|
|
|
/* Mesh data (not copied) can come either directly from a Mesh, or from a MultiresDM */
|
|
|
|
struct MultiresModifierData *multires; /* Special handling for multires meshes */
|
|
|
|
struct MVert *mvert;
|
2012-02-05 05:11:34 +01:00
|
|
|
struct MPoly *mpoly;
|
|
|
|
struct MLoop *mloop;
|
|
|
|
int totvert, totpoly;
|
2010-06-21 22:10:59 +02:00
|
|
|
struct KeyBlock *kb;
|
2012-05-10 22:34:47 +02:00
|
|
|
float *vmask;
|
2018-06-17 17:05:51 +02:00
|
|
|
|
2009-08-28 23:47:11 +02:00
|
|
|
/* Mesh connectivity */
|
2018-06-08 17:04:54 +02:00
|
|
|
struct MeshElemMap *pmap;
|
|
|
|
int *pmap_mem;
|
2009-08-28 23:47:11 +02:00
|
|
|
|
2012-12-30 19:27:33 +01:00
|
|
|
/* BMesh for dynamic topology sculpting */
|
|
|
|
struct BMesh *bm;
|
2014-04-17 18:02:55 +02:00
|
|
|
int cd_vert_node_offset;
|
|
|
|
int cd_face_node_offset;
|
2014-04-07 09:00:08 +02:00
|
|
|
bool bm_smooth_shading;
|
2012-12-30 19:27:33 +01:00
|
|
|
/* Undo/redo log for dynamic topology sculpting */
|
|
|
|
struct BMLog *bm_log;
|
|
|
|
|
2010-03-22 12:59:36 +01:00
|
|
|
/* PBVH acceleration structure */
|
|
|
|
struct PBVH *pbvh;
|
2014-02-03 08:55:59 +01:00
|
|
|
bool show_diffuse_color;
|
2018-01-15 11:38:56 +01:00
|
|
|
bool show_mask;
|
2010-03-22 12:59:36 +01:00
|
|
|
|
2014-08-13 01:33:46 +02:00
|
|
|
/* Painting on deformed mesh */
|
2014-04-07 09:00:08 +02:00
|
|
|
bool modifiers_active; /* object is deformed with some modifiers */
|
2011-01-31 21:02:51 +01:00
|
|
|
float (*orig_cos)[3]; /* coords of undeformed mesh */
|
|
|
|
float (*deform_cos)[3]; /* coords of deformed mesh but without stroke displacement */
|
2011-10-17 04:20:53 +02:00
|
|
|
float (*deform_imats)[3][3]; /* crazyspace deformation matrices */
|
2009-10-27 20:53:34 +01:00
|
|
|
|
|
|
|
/* Partial redraw */
|
2014-04-07 09:00:08 +02:00
|
|
|
bool partial_redraw;
|
2018-06-17 17:05:51 +02:00
|
|
|
|
2009-08-28 23:47:11 +02:00
|
|
|
/* Used to cache the render of the active texture */
|
|
|
|
unsigned int texcache_side, *texcache, texcache_actual;
|
2013-01-21 09:49:42 +01:00
|
|
|
struct ImagePool *tex_pool;
|
2009-08-28 23:47:11 +02:00
|
|
|
|
|
|
|
/* Layer brush persistence between strokes */
|
2011-11-11 14:09:14 +01:00
|
|
|
float (*layer_co)[3]; /* Copy of the mesh vertices' locations */
|
2009-08-28 23:47:11 +02:00
|
|
|
|
|
|
|
struct StrokeCache *cache;
|
2017-09-27 17:38:17 +02:00
|
|
|
|
|
|
|
union {
|
|
|
|
struct {
|
|
|
|
struct SculptVertexPaintGeomMap gmap;
|
|
|
|
|
|
|
|
/* For non-airbrush painting to re-apply from the original (MLoop aligned). */
|
|
|
|
unsigned int *previous_color;
|
|
|
|
} vpaint;
|
|
|
|
|
|
|
|
struct {
|
|
|
|
struct SculptVertexPaintGeomMap gmap;
|
|
|
|
/* Keep track of how much each vertex has been painted (non-airbrush only). */
|
|
|
|
float *alpha_weight;
|
2017-10-01 12:12:14 +02:00
|
|
|
|
2017-10-03 09:50:34 +02:00
|
|
|
/* Needed to continuously re-apply over the same weights (BRUSH_ACCUMULATE disabled).
|
2017-10-01 12:12:14 +02:00
|
|
|
* Lazy initialize as needed (flag is set to 1 to tag it as uninitialized). */
|
|
|
|
struct MDeformVert *dvert_prev;
|
2017-09-27 17:38:17 +02:00
|
|
|
} wpaint;
|
|
|
|
|
2018-04-16 17:08:27 +02:00
|
|
|
/* TODO: identify sculpt-only fields */
|
|
|
|
// struct { ... } sculpt;
|
2017-09-27 17:38:17 +02:00
|
|
|
} mode;
|
|
|
|
int mode_type;
|
|
|
|
|
|
|
|
/* This flag prevents PBVH from being freed when creating the vp_handle for texture paint. */
|
|
|
|
bool building_vp_handle;
|
2009-08-28 23:47:11 +02:00
|
|
|
} SculptSession;
|
|
|
|
|
2015-04-04 06:15:50 +02:00
|
|
|
void BKE_sculptsession_free(struct Object *ob);
|
|
|
|
void BKE_sculptsession_free_deformMats(struct SculptSession *ss);
|
2017-09-27 17:38:17 +02:00
|
|
|
void BKE_sculptsession_free_vwpaint_data(struct SculptSession *ss);
|
2014-05-07 01:59:23 +02:00
|
|
|
void BKE_sculptsession_bm_to_me(struct Object *ob, bool reorder);
|
|
|
|
void BKE_sculptsession_bm_to_me_for_render(struct Object *object);
|
2017-08-16 04:45:11 +02:00
|
|
|
void BKE_sculpt_update_mesh_elements(
|
2018-04-06 12:07:27 +02:00
|
|
|
struct Depsgraph *depsgraph, struct Scene *scene, struct Sculpt *sd, struct Object *ob,
|
2017-08-16 04:45:11 +02:00
|
|
|
bool need_pmap, bool need_mask);
|
2014-05-07 01:59:23 +02:00
|
|
|
struct MultiresModifierData *BKE_sculpt_multires_active(struct Scene *scene, struct Object *ob);
|
|
|
|
int BKE_sculpt_mask_layers_ensure(struct Object *ob,
|
2014-05-13 22:37:56 +02:00
|
|
|
struct MultiresModifierData *mmd);
|
2018-01-30 10:33:20 +01:00
|
|
|
void BKE_sculpt_toolsettings_data_ensure(struct Scene *scene);
|
2014-05-06 22:30:51 +02:00
|
|
|
|
2018-06-08 17:04:54 +02:00
|
|
|
struct PBVH *BKE_sculpt_object_pbvh_ensure(struct Object *ob, struct Mesh *me_eval_deform);
|
|
|
|
|
2014-05-06 22:30:51 +02:00
|
|
|
enum {
|
2014-05-07 01:59:23 +02:00
|
|
|
SCULPT_MASK_LAYER_CALC_VERT = (1 << 0),
|
|
|
|
SCULPT_MASK_LAYER_CALC_LOOP = (1 << 1)
|
2014-05-06 22:30:51 +02:00
|
|
|
};
|
2009-08-15 21:48:50 +02:00
|
|
|
#endif
|