2023-08-15 16:20:26 +02:00
|
|
|
/* SPDX-FileCopyrightText: 2023 Blender Authors
|
2023-05-31 16:19:06 +02:00
|
|
|
*
|
|
|
|
* SPDX-License-Identifier: GPL-2.0-or-later */
|
2018-07-31 10:22:19 +02:00
|
|
|
#pragma once
|
|
|
|
|
2019-02-17 22:08:12 +01:00
|
|
|
/** \file
|
|
|
|
* \ingroup bke
|
2018-07-31 10:22:19 +02:00
|
|
|
*/
|
|
|
|
|
2020-06-19 20:42:08 +02:00
|
|
|
#include "BLI_compiler_attrs.h"
|
2018-07-31 10:22:19 +02:00
|
|
|
#include "DNA_gpencil_modifier_types.h" /* needed for all enum typdefs */
|
|
|
|
|
2020-03-02 15:07:49 +01:00
|
|
|
#ifdef __cplusplus
|
|
|
|
extern "C" {
|
|
|
|
#endif
|
|
|
|
|
2020-06-19 20:42:08 +02:00
|
|
|
struct ARegionType;
|
2020-12-16 06:26:23 +01:00
|
|
|
struct BlendDataReader;
|
|
|
|
struct BlendLibReader;
|
|
|
|
struct BlendWriter;
|
2018-07-31 10:22:19 +02:00
|
|
|
struct Depsgraph;
|
2019-01-28 11:08:24 +01:00
|
|
|
struct GpencilModifierData;
|
|
|
|
struct ID;
|
|
|
|
struct ListBase;
|
|
|
|
struct Main;
|
|
|
|
struct ModifierUpdateDepsgraphContext;
|
2018-07-31 10:22:19 +02:00
|
|
|
struct Object;
|
|
|
|
struct Scene;
|
2023-07-27 04:04:18 +02:00
|
|
|
/* NOTE: bake_modifier() called from UI:
|
2019-09-30 09:06:28 +02:00
|
|
|
* needs to create new data-blocks, hence the need for this. */
|
2018-07-31 10:22:19 +02:00
|
|
|
struct bGPDframe;
|
2019-01-28 11:08:24 +01:00
|
|
|
struct bGPDlayer;
|
2018-07-31 10:22:19 +02:00
|
|
|
struct bGPDstroke;
|
|
|
|
|
2018-12-13 12:56:19 +01:00
|
|
|
#define GPENCIL_MODIFIER_ACTIVE(_md, _is_render) \
|
|
|
|
((((_md)->mode & eGpencilModifierMode_Realtime) && (_is_render == false)) || \
|
|
|
|
(((_md)->mode & eGpencilModifierMode_Render) && (_is_render == true)))
|
|
|
|
#define GPENCIL_MODIFIER_EDIT(_md, _is_edit) \
|
|
|
|
((((_md)->mode & eGpencilModifierMode_Editmode) == 0) && (_is_edit))
|
2018-07-31 10:22:19 +02:00
|
|
|
|
|
|
|
typedef enum {
|
2019-07-07 07:38:41 +02:00
|
|
|
/** Should not be used, only for None modifier type. */
|
2018-07-31 10:22:19 +02:00
|
|
|
eGpencilModifierTypeType_None,
|
|
|
|
|
2019-07-07 07:38:41 +02:00
|
|
|
/** Grease pencil modifiers. */
|
2018-07-31 10:22:19 +02:00
|
|
|
eGpencilModifierTypeType_Gpencil,
|
|
|
|
} GpencilModifierTypeType;
|
|
|
|
|
|
|
|
typedef enum {
|
2020-02-20 00:21:23 +01:00
|
|
|
/* eGpencilModifierTypeFlag_SupportsMapping = (1 << 0), */ /* UNUSED */
|
2018-07-31 10:22:19 +02:00
|
|
|
eGpencilModifierTypeFlag_SupportsEditmode = (1 << 1),
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2019-07-07 07:38:41 +02:00
|
|
|
/**
|
|
|
|
* For modifiers that support edit-mode this determines if the
|
|
|
|
* modifier should be enabled by default in edit-mode. This should
|
2018-09-02 10:28:27 +02:00
|
|
|
* only be used by modifiers that are relatively speedy and
|
2019-07-07 07:38:41 +02:00
|
|
|
* also generally used in edit-mode, otherwise let the user enable it by hand.
|
2018-09-02 10:28:27 +02:00
|
|
|
*/
|
2018-07-31 10:22:19 +02:00
|
|
|
eGpencilModifierTypeFlag_EnableInEditmode = (1 << 2),
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2019-07-07 07:38:41 +02:00
|
|
|
/**
|
|
|
|
* For modifiers that require original data and so cannot
|
|
|
|
* be placed after any non-deform modifier.
|
2018-09-02 10:28:27 +02:00
|
|
|
*/
|
2020-02-20 00:21:23 +01:00
|
|
|
/* eGpencilModifierTypeFlag_RequiresOriginalData = (1 << 3), */ /* UNUSED */
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2019-07-07 07:38:41 +02:00
|
|
|
/** Max one per type. */
|
2018-07-31 10:22:19 +02:00
|
|
|
eGpencilModifierTypeFlag_Single = (1 << 4),
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2019-07-07 07:38:41 +02:00
|
|
|
/** Can't be added manually by user. */
|
2018-07-31 10:22:19 +02:00
|
|
|
eGpencilModifierTypeFlag_NoUserAdd = (1 << 5),
|
2019-07-07 07:38:41 +02:00
|
|
|
/** Can't be applied. */
|
2018-10-22 18:25:13 +02:00
|
|
|
eGpencilModifierTypeFlag_NoApply = (1 << 6),
|
2018-07-31 10:22:19 +02:00
|
|
|
} GpencilModifierTypeFlag;
|
|
|
|
|
2023-07-27 04:04:18 +02:00
|
|
|
typedef void (*GreasePencilIDWalkFunc)(void *user_data,
|
2018-07-31 10:22:19 +02:00
|
|
|
struct Object *ob,
|
|
|
|
struct ID **idpoin,
|
|
|
|
int cb_flag);
|
2023-07-27 04:04:18 +02:00
|
|
|
typedef void (*GreasePencilTexWalkFunc)(void *user_data,
|
2018-07-31 10:22:19 +02:00
|
|
|
struct Object *ob,
|
|
|
|
struct GpencilModifierData *md,
|
|
|
|
const char *propname);
|
|
|
|
|
|
|
|
typedef struct GpencilModifierTypeInfo {
|
2018-12-13 12:56:19 +01:00
|
|
|
/** The user visible name for this modifier */
|
2018-07-31 10:22:19 +02:00
|
|
|
char name[32];
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2018-12-13 12:56:19 +01:00
|
|
|
/**
|
|
|
|
* The DNA struct name for the modifier data type, used to
|
2018-07-31 10:22:19 +02:00
|
|
|
* write the DNA data out.
|
|
|
|
*/
|
|
|
|
char struct_name[32];
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2018-12-13 12:56:19 +01:00
|
|
|
/** The size of the modifier data type, used by allocation. */
|
2018-07-31 10:22:19 +02:00
|
|
|
int struct_size;
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2018-09-28 10:04:31 +02:00
|
|
|
GpencilModifierTypeType type;
|
2018-07-31 10:22:19 +02:00
|
|
|
GpencilModifierTypeFlag flags;
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2018-07-31 10:22:19 +02:00
|
|
|
/********************* Non-optional functions *********************/
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2018-12-13 12:56:19 +01:00
|
|
|
/**
|
|
|
|
* Copy instance data for this modifier type. Should copy all user
|
2018-07-31 10:22:19 +02:00
|
|
|
* level settings to the target modifier.
|
|
|
|
*/
|
2023-07-27 04:04:18 +02:00
|
|
|
void (*copy_data)(const struct GpencilModifierData *md, struct GpencilModifierData *target);
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2018-12-13 12:56:19 +01:00
|
|
|
/**
|
|
|
|
* Callback for GP "stroke" modifiers that operate on the
|
2018-07-31 10:22:19 +02:00
|
|
|
* shape and parameters of the provided strokes (e.g. Thickness, Noise, etc.)
|
|
|
|
*
|
|
|
|
* The gpl parameter contains the GP layer that the strokes come from.
|
|
|
|
* While access is provided to this data, you should not directly access
|
|
|
|
* the gpl->frames data from the modifier. Instead, use the gpf parameter
|
|
|
|
* instead.
|
|
|
|
*
|
|
|
|
* The gps parameter contains the GP stroke to operate on. This is usually a copy
|
|
|
|
* of the original (unmodified and saved to files) stroke data.
|
|
|
|
*/
|
2023-07-27 04:04:18 +02:00
|
|
|
void (*deform_stroke)(struct GpencilModifierData *md,
|
|
|
|
struct Depsgraph *depsgraph,
|
|
|
|
struct Object *ob,
|
|
|
|
struct bGPDlayer *gpl,
|
|
|
|
struct bGPDframe *gpf,
|
|
|
|
struct bGPDstroke *gps);
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2018-12-13 12:56:19 +01:00
|
|
|
/**
|
|
|
|
* Callback for GP "geometry" modifiers that create extra geometry
|
2018-07-31 10:22:19 +02:00
|
|
|
* in the frame (e.g. Array)
|
|
|
|
*/
|
2023-07-27 04:04:18 +02:00
|
|
|
void (*generate_strokes)(struct GpencilModifierData *md,
|
|
|
|
struct Depsgraph *depsgraph,
|
|
|
|
struct Object *ob);
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2018-12-13 12:56:19 +01:00
|
|
|
/**
|
2019-06-12 01:04:10 +02:00
|
|
|
* Bake-down GP modifier's effects into the GP data-block.
|
2018-07-31 10:22:19 +02:00
|
|
|
*
|
|
|
|
* This gets called when the user clicks the "Apply" button in the UI.
|
|
|
|
* As such, this callback needs to go through all layers/frames in the
|
2019-06-12 01:04:10 +02:00
|
|
|
* data-block, mutating the geometry and/or creating new data-blocks/objects
|
2018-07-31 10:22:19 +02:00
|
|
|
*/
|
2023-07-27 04:04:18 +02:00
|
|
|
void (*bake_modifier)(struct Main *bmain,
|
|
|
|
struct Depsgraph *depsgraph,
|
|
|
|
struct GpencilModifierData *md,
|
|
|
|
struct Object *ob);
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2018-07-31 10:22:19 +02:00
|
|
|
/********************* Optional functions *********************/
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2018-12-13 12:56:19 +01:00
|
|
|
/**
|
|
|
|
* Callback for GP "time" modifiers that offset keyframe time
|
2018-10-22 18:25:13 +02:00
|
|
|
* Returns the frame number to be used after apply the modifier. This is
|
2019-06-12 01:04:10 +02:00
|
|
|
* usually an offset of the animation for duplicated data-blocks.
|
2018-10-22 18:25:13 +02:00
|
|
|
*
|
|
|
|
* This function is optional.
|
|
|
|
*/
|
2023-07-27 04:04:18 +02:00
|
|
|
int (*remap_time)(struct GpencilModifierData *md,
|
|
|
|
struct Depsgraph *depsgraph,
|
|
|
|
struct Scene *scene,
|
|
|
|
struct Object *ob,
|
|
|
|
struct bGPDlayer *gpl,
|
|
|
|
int cfra);
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2018-12-13 12:56:19 +01:00
|
|
|
/**
|
|
|
|
* Initialize new instance data for this modifier type, this function
|
2018-07-31 10:22:19 +02:00
|
|
|
* should set modifier variables to their default values.
|
|
|
|
*
|
|
|
|
* This function is optional.
|
|
|
|
*/
|
2023-07-27 04:04:18 +02:00
|
|
|
void (*init_data)(struct GpencilModifierData *md);
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2018-12-13 12:56:19 +01:00
|
|
|
/**
|
|
|
|
* Free internal modifier data variables, this function should
|
2018-07-31 10:22:19 +02:00
|
|
|
* not free the md variable itself.
|
|
|
|
*
|
|
|
|
* This function is optional.
|
|
|
|
*/
|
2023-07-27 04:04:18 +02:00
|
|
|
void (*free_data)(struct GpencilModifierData *md);
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2018-12-13 12:56:19 +01:00
|
|
|
/**
|
|
|
|
* Return a boolean value indicating if this modifier is able to be
|
2018-07-31 10:22:19 +02:00
|
|
|
* calculated based on the modifier data. This is *not* regarding the
|
|
|
|
* md->flag, that is tested by the system, this is just if the data
|
|
|
|
* validates (for example, a lattice will return false if the lattice
|
|
|
|
* object is not defined).
|
|
|
|
*
|
|
|
|
* This function is optional (assumes never disabled if not present).
|
|
|
|
*/
|
2023-07-27 14:02:41 +02:00
|
|
|
bool (*is_disabled)(struct GpencilModifierData *md, bool use_render_params);
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2018-12-13 12:56:19 +01:00
|
|
|
/**
|
|
|
|
* Add the appropriate relations to the dependency graph.
|
2018-07-31 10:22:19 +02:00
|
|
|
*
|
|
|
|
* This function is optional.
|
|
|
|
*/
|
2023-07-27 04:04:18 +02:00
|
|
|
void (*update_depsgraph)(struct GpencilModifierData *md,
|
|
|
|
const struct ModifierUpdateDepsgraphContext *ctx,
|
|
|
|
int mode);
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2018-12-13 12:56:19 +01:00
|
|
|
/**
|
|
|
|
* Should return true if the modifier needs to be recalculated on time
|
2018-07-31 10:22:19 +02:00
|
|
|
* changes.
|
|
|
|
*
|
|
|
|
* This function is optional (assumes false if not present).
|
|
|
|
*/
|
2023-07-27 04:04:18 +02:00
|
|
|
bool (*depends_on_time)(struct GpencilModifierData *md);
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2018-12-13 12:56:19 +01:00
|
|
|
/**
|
|
|
|
* Should call the given walk function with a pointer to each ID
|
2019-06-12 01:04:10 +02:00
|
|
|
* pointer (i.e. each data-block pointer) that the modifier data
|
2018-07-31 10:22:19 +02:00
|
|
|
* stores. This is used for linking on file load and for
|
2019-06-12 01:04:10 +02:00
|
|
|
* unlinking data-blocks or forwarding data-block references.
|
2018-07-31 10:22:19 +02:00
|
|
|
*
|
2020-10-01 18:05:23 +02:00
|
|
|
* This function is optional.
|
2018-07-31 10:22:19 +02:00
|
|
|
*/
|
2023-07-27 04:04:18 +02:00
|
|
|
void (*foreach_ID_link)(struct GpencilModifierData *md,
|
|
|
|
struct Object *ob,
|
|
|
|
GreasePencilIDWalkFunc walk,
|
|
|
|
void *user_data);
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2018-12-13 12:56:19 +01:00
|
|
|
/**
|
|
|
|
* Should call the given walk function for each texture that the
|
2018-07-31 10:22:19 +02:00
|
|
|
* modifier data stores. This is used for finding all textures in
|
|
|
|
* the context for the UI.
|
|
|
|
*
|
|
|
|
* This function is optional. If it is not present, it will be
|
|
|
|
* assumed the modifier has no textures.
|
|
|
|
*/
|
2023-07-27 04:04:18 +02:00
|
|
|
void (*foreach_tex_link)(struct GpencilModifierData *md,
|
|
|
|
struct Object *ob,
|
|
|
|
GreasePencilTexWalkFunc walk,
|
|
|
|
void *user_data);
|
2020-06-19 20:42:08 +02:00
|
|
|
|
|
|
|
/* Register the panel types for the modifier's UI. */
|
2023-07-27 04:04:18 +02:00
|
|
|
void (*panel_register)(struct ARegionType *region_type);
|
2018-07-31 10:22:19 +02:00
|
|
|
} GpencilModifierTypeInfo;
|
|
|
|
|
2020-06-19 20:42:08 +02:00
|
|
|
#define GPENCIL_MODIFIER_TYPE_PANEL_PREFIX "MOD_PT_gpencil_"
|
|
|
|
|
2021-12-07 07:19:15 +01:00
|
|
|
/**
|
|
|
|
* Initialize modifier's global data (type info and some common global storage).
|
|
|
|
*/
|
2018-07-31 10:22:19 +02:00
|
|
|
void BKE_gpencil_modifier_init(void);
|
|
|
|
|
2021-12-07 07:19:15 +01:00
|
|
|
/**
|
2023-07-27 04:04:18 +02:00
|
|
|
* Get the idname of the modifier type's panel, which was defined in the #panel_register callback.
|
2021-12-07 07:19:15 +01:00
|
|
|
*
|
|
|
|
* \param type: Type of modifier.
|
|
|
|
* \param r_idname: ID name.
|
|
|
|
*/
|
2020-06-19 20:42:08 +02:00
|
|
|
void BKE_gpencil_modifierType_panel_id(GpencilModifierType type, char *r_idname);
|
2020-10-28 18:43:10 +01:00
|
|
|
void BKE_gpencil_modifier_panel_expand(struct GpencilModifierData *md);
|
2021-12-07 07:19:15 +01:00
|
|
|
/**
|
|
|
|
* Get grease pencil modifier information.
|
|
|
|
* \param type: Type of modifier.
|
|
|
|
* \return Pointer to type
|
|
|
|
*/
|
2020-05-08 10:32:30 +02:00
|
|
|
const GpencilModifierTypeInfo *BKE_gpencil_modifier_get_info(GpencilModifierType type);
|
2021-12-07 07:19:15 +01:00
|
|
|
/**
|
|
|
|
* Create new grease pencil modifier.
|
|
|
|
* \param type: Type of modifier.
|
|
|
|
* \return New modifier pointer.
|
|
|
|
*/
|
2018-07-31 10:22:19 +02:00
|
|
|
struct GpencilModifierData *BKE_gpencil_modifier_new(int type);
|
2021-12-07 07:19:15 +01:00
|
|
|
/**
|
|
|
|
* Free grease pencil modifier data
|
|
|
|
* \param md: Modifier data.
|
|
|
|
* \param flag: Flags.
|
|
|
|
*/
|
2022-01-07 01:38:08 +01:00
|
|
|
void BKE_gpencil_modifier_free_ex(struct GpencilModifierData *md, int flag);
|
2021-12-07 07:19:15 +01:00
|
|
|
/**
|
|
|
|
* Free grease pencil modifier data
|
|
|
|
* \param md: Modifier data.
|
|
|
|
*/
|
2018-07-31 10:22:19 +02:00
|
|
|
void BKE_gpencil_modifier_free(struct GpencilModifierData *md);
|
2021-12-07 07:19:15 +01:00
|
|
|
/* check unique name */
|
2023-10-19 15:07:57 +02:00
|
|
|
void BKE_gpencil_modifier_unique_name(struct ListBase *modifiers, struct GpencilModifierData *gmd);
|
2021-12-07 07:19:15 +01:00
|
|
|
/**
|
|
|
|
* Check if grease pencil modifier depends on time.
|
|
|
|
* \param md: Modifier data.
|
|
|
|
* \return True if depends on time.
|
|
|
|
*/
|
2020-05-08 10:32:30 +02:00
|
|
|
bool BKE_gpencil_modifier_depends_ontime(struct GpencilModifierData *md);
|
|
|
|
struct GpencilModifierData *BKE_gpencil_modifiers_findby_type(struct Object *ob,
|
2020-05-08 11:02:03 +02:00
|
|
|
GpencilModifierType type);
|
2021-12-07 07:19:15 +01:00
|
|
|
/**
|
|
|
|
* Find grease pencil modifier by name.
|
|
|
|
* \param ob: Grease pencil object.
|
|
|
|
* \param name: Name to find.
|
|
|
|
* \return Pointer to modifier.
|
|
|
|
*/
|
2020-05-08 11:15:42 +02:00
|
|
|
struct GpencilModifierData *BKE_gpencil_modifiers_findby_name(struct Object *ob, const char *name);
|
2021-12-07 07:19:15 +01:00
|
|
|
/**
|
|
|
|
* Generic grease pencil modifier copy data.
|
|
|
|
* \param md_src: Source modifier data.
|
|
|
|
* \param md_dst: Target modifier data.
|
|
|
|
*/
|
2020-05-08 10:32:30 +02:00
|
|
|
void BKE_gpencil_modifier_copydata_generic(const struct GpencilModifierData *md_src,
|
2018-07-31 10:22:19 +02:00
|
|
|
struct GpencilModifierData *md_dst);
|
2021-12-07 07:19:15 +01:00
|
|
|
/**
|
|
|
|
* Copy grease pencil modifier data.
|
|
|
|
* \param md: Source modifier data.
|
|
|
|
* \param target: Target modifier data.
|
|
|
|
*/
|
2020-05-08 10:32:30 +02:00
|
|
|
void BKE_gpencil_modifier_copydata(struct GpencilModifierData *md,
|
2018-07-31 10:22:19 +02:00
|
|
|
struct GpencilModifierData *target);
|
2021-12-07 07:19:15 +01:00
|
|
|
/**
|
|
|
|
* Copy grease pencil modifier data.
|
|
|
|
* \param md: Source modifier data.
|
|
|
|
* \param target: Target modifier data.
|
|
|
|
* \param flag: Flags.
|
|
|
|
*/
|
2020-05-08 10:32:30 +02:00
|
|
|
void BKE_gpencil_modifier_copydata_ex(struct GpencilModifierData *md,
|
2018-07-31 10:22:19 +02:00
|
|
|
struct GpencilModifierData *target,
|
2022-01-07 01:38:08 +01:00
|
|
|
int flag);
|
2021-12-07 07:19:15 +01:00
|
|
|
/**
|
|
|
|
* Set grease pencil modifier error.
|
|
|
|
* \param md: Modifier data.
|
2021-12-14 08:35:23 +01:00
|
|
|
* \param format: Format.
|
2021-12-07 07:19:15 +01:00
|
|
|
*/
|
2020-06-19 20:42:08 +02:00
|
|
|
void BKE_gpencil_modifier_set_error(struct GpencilModifierData *md, const char *format, ...)
|
|
|
|
ATTR_PRINTF_FORMAT(2, 3);
|
2021-12-07 07:19:15 +01:00
|
|
|
/**
|
|
|
|
* Link grease pencil modifier related IDs.
|
|
|
|
* \param ob: Grease pencil object.
|
|
|
|
* \param walk: Walk option.
|
2023-07-27 04:04:18 +02:00
|
|
|
* \param user_data: User data.
|
2021-12-07 07:19:15 +01:00
|
|
|
*/
|
2020-05-08 10:32:30 +02:00
|
|
|
void BKE_gpencil_modifiers_foreach_ID_link(struct Object *ob,
|
2020-05-08 11:02:03 +02:00
|
|
|
GreasePencilIDWalkFunc walk,
|
2023-07-27 04:04:18 +02:00
|
|
|
void *user_data);
|
2021-12-07 07:19:15 +01:00
|
|
|
/**
|
|
|
|
* Link grease pencil modifier related Texts.
|
|
|
|
* \param ob: Grease pencil object.
|
|
|
|
* \param walk: Walk option.
|
2023-07-27 04:04:18 +02:00
|
|
|
* \param user_data: User data.
|
2021-12-07 07:19:15 +01:00
|
|
|
*/
|
2020-05-08 10:32:30 +02:00
|
|
|
void BKE_gpencil_modifiers_foreach_tex_link(struct Object *ob,
|
2020-05-08 11:02:03 +02:00
|
|
|
GreasePencilTexWalkFunc walk,
|
2023-07-27 04:04:18 +02:00
|
|
|
void *user_data);
|
2018-07-31 10:22:19 +02:00
|
|
|
|
2021-12-07 07:19:15 +01:00
|
|
|
/**
|
|
|
|
* Check whether given modifier is not local (i.e. from linked data) when the object is a library
|
|
|
|
* override.
|
|
|
|
*
|
|
|
|
* \param gmd: May be NULL, in which case we consider it as a non-local modifier case.
|
|
|
|
*/
|
2020-12-08 09:40:42 +01:00
|
|
|
bool BKE_gpencil_modifier_is_nonlocal_in_liboverride(const struct Object *ob,
|
|
|
|
const struct GpencilModifierData *gmd);
|
2020-12-07 16:52:45 +01:00
|
|
|
|
2020-09-03 14:59:34 +02:00
|
|
|
typedef struct GpencilVirtualModifierData {
|
|
|
|
ArmatureGpencilModifierData amd;
|
|
|
|
LatticeGpencilModifierData lmd;
|
|
|
|
} GpencilVirtualModifierData;
|
|
|
|
|
2021-12-07 07:19:15 +01:00
|
|
|
/**
|
|
|
|
* This is to include things that are not modifiers in the evaluation of the modifier stack,
|
|
|
|
* for example parenting to an armature or lattice without having a real modifier.
|
|
|
|
*/
|
2020-09-03 14:59:34 +02:00
|
|
|
struct GpencilModifierData *BKE_gpencil_modifiers_get_virtual_modifierlist(
|
|
|
|
const struct Object *ob, struct GpencilVirtualModifierData *data);
|
|
|
|
|
2021-12-07 07:19:15 +01:00
|
|
|
/**
|
|
|
|
* Check if object has grease pencil Geometry modifiers.
|
|
|
|
* \param ob: Grease pencil object.
|
|
|
|
* \return True if exist.
|
|
|
|
*/
|
2018-07-31 10:22:19 +02:00
|
|
|
bool BKE_gpencil_has_geometry_modifiers(struct Object *ob);
|
2021-12-07 07:19:15 +01:00
|
|
|
/**
|
|
|
|
* Check if object has grease pencil Time modifiers.
|
|
|
|
* \param ob: Grease pencil object.
|
|
|
|
* \return True if exist.
|
|
|
|
*/
|
2018-10-22 18:25:13 +02:00
|
|
|
bool BKE_gpencil_has_time_modifiers(struct Object *ob);
|
2021-12-07 07:19:15 +01:00
|
|
|
/**
|
|
|
|
* Check if object has grease pencil transform stroke modifiers.
|
|
|
|
* \param ob: Grease pencil object.
|
|
|
|
* \return True if exist.
|
|
|
|
*/
|
2019-09-21 16:13:23 +02:00
|
|
|
bool BKE_gpencil_has_transform_modifiers(struct Object *ob);
|
2018-07-31 10:22:19 +02:00
|
|
|
|
2021-06-16 16:38:47 +02:00
|
|
|
/* Stores the maximum calculation range in the whole modifier stack for line art so the cache can
|
|
|
|
* cover everything that will be visible. */
|
|
|
|
typedef struct GpencilLineartLimitInfo {
|
|
|
|
char min_level;
|
|
|
|
char max_level;
|
|
|
|
short edge_types;
|
2022-06-29 16:54:29 +02:00
|
|
|
char shadow_selection;
|
|
|
|
char silhouette_selection;
|
2021-06-16 16:38:47 +02:00
|
|
|
} GpencilLineartLimitInfo;
|
|
|
|
|
|
|
|
GpencilLineartLimitInfo BKE_gpencil_get_lineart_modifier_limits(const struct Object *ob);
|
|
|
|
|
|
|
|
void BKE_gpencil_set_lineart_modifier_limits(struct GpencilModifierData *md,
|
|
|
|
const struct GpencilLineartLimitInfo *info,
|
2022-01-07 01:38:08 +01:00
|
|
|
bool is_first_lineart);
|
2021-06-16 16:38:47 +02:00
|
|
|
bool BKE_gpencil_is_first_lineart_in_stack(const struct Object *ob,
|
|
|
|
const struct GpencilModifierData *md);
|
|
|
|
|
2022-01-06 09:00:35 +01:00
|
|
|
/**
|
|
|
|
* Init grease pencil cache deform data.
|
|
|
|
* \param ob: Grease pencil object
|
|
|
|
*/
|
2021-12-13 17:09:22 +01:00
|
|
|
void BKE_gpencil_cache_data_init(struct Depsgraph *depsgraph, struct Object *ob);
|
2022-01-06 09:00:35 +01:00
|
|
|
/**
|
|
|
|
* Clear grease pencil cache deform data.
|
|
|
|
* \param ob: Grease pencil object
|
|
|
|
*/
|
2021-12-13 17:09:22 +01:00
|
|
|
void BKE_gpencil_cache_data_clear(struct Object *ob);
|
2018-07-31 10:22:19 +02:00
|
|
|
|
2021-12-07 07:19:15 +01:00
|
|
|
/**
|
|
|
|
* Calculate grease-pencil modifiers.
|
|
|
|
* \param depsgraph: Current depsgraph.
|
|
|
|
* \param scene: Current scene.
|
|
|
|
* \param ob: Grease pencil object.
|
|
|
|
*/
|
2019-08-23 23:10:41 +02:00
|
|
|
void BKE_gpencil_modifiers_calc(struct Depsgraph *depsgraph,
|
|
|
|
struct Scene *scene,
|
|
|
|
struct Object *ob);
|
|
|
|
|
2021-12-07 07:19:15 +01:00
|
|
|
/**
|
|
|
|
* Prepare grease pencil eval data for modifiers
|
|
|
|
* \param depsgraph: Current depsgraph.
|
|
|
|
* \param scene: Current scene.
|
|
|
|
* \param ob: Grease pencil object.
|
|
|
|
*/
|
2020-03-09 16:27:24 +01:00
|
|
|
void BKE_gpencil_prepare_eval_data(struct Depsgraph *depsgraph,
|
|
|
|
struct Scene *scene,
|
|
|
|
struct Object *ob);
|
|
|
|
|
2021-12-07 07:19:15 +01:00
|
|
|
/**
|
|
|
|
* Get the current frame re-timed with time modifiers.
|
|
|
|
* \param depsgraph: Current depsgraph.
|
|
|
|
* \param scene: Current scene.
|
|
|
|
* \param ob: Grease pencil object.
|
|
|
|
* \param gpl: Grease pencil layer.
|
|
|
|
* \return New frame number.
|
|
|
|
*/
|
2020-03-09 16:27:24 +01:00
|
|
|
struct bGPDframe *BKE_gpencil_frame_retime_get(struct Depsgraph *depsgraph,
|
|
|
|
struct Scene *scene,
|
|
|
|
struct Object *ob,
|
|
|
|
struct bGPDlayer *gpl);
|
2021-12-07 07:19:15 +01:00
|
|
|
/**
|
|
|
|
* Get Time modifier frame number.
|
|
|
|
*/
|
2021-07-14 11:09:25 +02:00
|
|
|
int BKE_gpencil_time_modifier_cfra(struct Depsgraph *depsgraph,
|
|
|
|
struct Scene *scene,
|
|
|
|
struct Object *ob,
|
|
|
|
struct bGPDlayer *gpl,
|
2022-01-07 01:38:08 +01:00
|
|
|
int cfra,
|
|
|
|
bool is_render);
|
2020-03-09 16:27:24 +01:00
|
|
|
|
2020-11-06 17:22:20 +01:00
|
|
|
void BKE_gpencil_modifier_blend_write(struct BlendWriter *writer, struct ListBase *modbase);
|
2023-08-14 16:45:18 +02:00
|
|
|
void BKE_gpencil_modifier_blend_read_data(struct BlendDataReader *reader,
|
|
|
|
struct ListBase *lb,
|
|
|
|
struct Object *ob);
|
2020-11-06 17:22:20 +01:00
|
|
|
|
2020-03-02 15:07:49 +01:00
|
|
|
#ifdef __cplusplus
|
|
|
|
}
|
|
|
|
#endif
|