14#include <fmt/format.h>
56 std::optional<Library *> owner_library,
70 if (linestyle_src->
mtex[a]) {
72 *linestyle_dst->
mtex[a] = blender::dna::shallow_copy(*linestyle_src->
mtex[a]);
81 reinterpret_cast<ID **
>(&linestyle_dst->
nodetree),
82 flag_embedded_id_data);
111 for (
int material_slot_index = 0; material_slot_index <
MAX_MTEX; material_slot_index++) {
140 for (
int i = 0; i <
MAX_MTEX; i++) {
141 if (linestyle->
mtex[i]) {
440 for (
int a = 0; a <
MAX_MTEX; a++) {
441 if (linestyle->
mtex[a]) {
463 switch (modifier->
type) {
512 switch (modifier->
type) {
569 switch (modifier->
type) {
645 for (
int a = 0; a <
MAX_MTEX; a++) {
656 "FreestyleLineStyle",
681 nullptr,
"Along Stroke",
"Distance from Camera",
"Distance from Object",
682 "Material",
"Sampling",
"Bézier Curve",
"Sinus Displacement",
683 "Spatial Noise",
"Perlin Noise 1D",
"Perlin Noise 2D",
"Backbone Stretcher",
684 "Tip Remover",
"Calligraphy",
"Polygonalization",
"Guiding Lines",
685 "Blueprint",
"2D Offset",
"2D Transform",
"Tangent",
686 "Noise",
"Crease Angle",
"Simplification",
"Curvature 3D",
709 return (lineset) ? lineset->
linestyle :
nullptr;
1849 link->
data = color_ramp;
1904 char name_esc[
sizeof(m->name) * 2];
1906 return fmt::format(
"color_modifiers[\"{}\"].color_ramp", name_esc);
1909 printf(
"BKE_linestyle_path_to_color_ramp: No color ramps correspond to the given pointer.\n");
1910 return std::nullopt;
1915 if (use_shading_nodes) {
1926 return (linestyle->
mtex[0] !=
nullptr);
1934 bNode *uv_along_stroke, *input_texture, *output_linestyle;
1941 nullptr, &linestyle->
id,
"stroke_shader",
"ShaderNodeTree");
1944 uv_along_stroke->
locx = 0.0f;
1945 uv_along_stroke->
locy = 300.0f;
1949 input_texture->
locx = 200.0f;
1950 input_texture->
locy = 300.0f;
1953 output_linestyle->
locx = 400.0f;
1954 output_linestyle->
locy = 300.0f;
1956 output_linestyle->
custom2 = 0;
ColorBand * BKE_colorband_add(bool rangetype)
Main * CTX_data_main(const bContext *C)
struct FreestyleLineSet * BKE_freestyle_lineset_get_active(struct FreestyleConfig *config)
@ IDTYPE_FLAGS_APPEND_IS_REUSABLE
void * BKE_libblock_alloc(Main *bmain, short type, const char *name, int flag) ATTR_WARN_UNUSED_RESULT
struct ID * BKE_id_copy_in_lib(Main *bmain, std::optional< Library * > owner_library, const ID *id, const ID *new_owner_id, ID **new_id_p, int flag)
@ LIB_ID_CREATE_NO_ALLOCATE
@ LIB_ID_CREATE_NO_USER_REFCOUNT
void BKE_id_blend_write(BlendWriter *writer, ID *id)
#define BKE_LIB_FOREACHID_PROCESS_FUNCTION_CALL(data_, func_call_)
#define BKE_LIB_FOREACHID_PROCESS_IDSUPER(data_, id_super_, cb_flag_)
void BKE_library_foreach_ID_embedded(LibraryForeachIDData *data, ID **id_pp)
Blender kernel freestyle line style functionality.
#define SH_NODE_TEX_IMAGE
#define SH_NODE_UVALONGSTROKE
#define NODE_CLASS_TEXTURE
#define SH_NODE_OUTPUT_LINESTYLE
void BKE_ntree_update_main_tree(Main *bmain, bNodeTree *ntree, NodeTreeUpdateExtraParams *params)
void BKE_texture_mtex_foreach_id(struct LibraryForeachIDData *data, struct MTex *mtex)
#define LISTBASE_FOREACH(type, var, list)
void BLI_freelinkN(struct ListBase *listbase, void *vlink) ATTR_NONNULL(1)
BLI_INLINE void BLI_listbase_clear(struct ListBase *lb)
void * BLI_findlink(const struct ListBase *listbase, int number) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL(1)
void BLI_addtail(struct ListBase *listbase, void *vlink) ATTR_NONNULL(1)
void void void bool BLI_listbase_link_move(ListBase *listbase, void *vlink, int step) ATTR_NONNULL()
int BLI_findindex(const struct ListBase *listbase, const void *vlink) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL(1)
#define STRNCPY(dst, src)
size_t BLI_str_escape(char *__restrict dst, const char *__restrict src, size_t dst_maxncpy) ATTR_NONNULL(1
void BLI_uniquename(const struct ListBase *list, void *vlink, const char *defname, char delim, int name_offset, size_t name_maxncpy) ATTR_NONNULL(1
#define MEMCMP_STRUCT_AFTER_IS_ZERO(struct_var, member)
#define MEMCPY_STRUCT_AFTER(struct_dst, struct_src, member)
BLO_Write_IDBuffer * BLO_write_allocate_id_buffer()
#define BLO_write_id_struct(writer, struct_name, id_address, id)
#define BLO_write_struct(writer, struct_name, data_ptr)
void BLO_write_init_id_buffer_from_id(BLO_Write_IDBuffer *id_buffer, ID *id, const bool is_undo)
void BLO_write_destroy_id_buffer(BLO_Write_IDBuffer **id_buffer)
ID * BLO_write_get_id_buffer_temp_id(BLO_Write_IDBuffer *id_buffer)
#define BLO_read_struct_list(reader, struct_name, list)
#define BLO_read_struct(reader, struct_name, ptr_p)
bool BLO_write_is_undo(BlendWriter *writer)
void BLO_write_struct_by_id(BlendWriter *writer, int struct_id, const void *data_ptr)
#define BLO_write_struct_at_address(writer, struct_name, address, data_ptr)
#define BLT_I18NCONTEXT_ID_FREESTYLELINESTYLE
#define DNA_struct_default_get(struct_name)
@ LS_MODIFIER_BLUEPRINT_CIRCLES
@ LS_MODIFIER_SPATIAL_NOISE_PURERANDOM
@ LS_MODIFIER_SPATIAL_NOISE_SMOOTH
@ LS_MODIFIER_BEZIER_CURVE
@ LS_MODIFIER_BACKBONE_STRETCHER
@ LS_MODIFIER_SPATIAL_NOISE
@ LS_MODIFIER_PERLIN_NOISE_2D
@ LS_MODIFIER_POLYGONIZATION
@ LS_MODIFIER_GUIDING_LINES
@ LS_MODIFIER_SIMPLIFICATION
@ LS_MODIFIER_CREASE_ANGLE
@ LS_MODIFIER_2D_TRANSFORM
@ LS_MODIFIER_DISTANCE_FROM_OBJECT
@ LS_MODIFIER_CALLIGRAPHY
@ LS_MODIFIER_CURVATURE_3D
@ LS_MODIFIER_SINUS_DISPLACEMENT
@ LS_MODIFIER_ALONG_STROKE
@ LS_MODIFIER_DISTANCE_FROM_CAMERA
@ LS_MODIFIER_PERLIN_NOISE_1D
@ LS_MODIFIER_TIP_REMOVER
@ LS_THICKNESS_ASYMMETRIC
@ LS_MODIFIER_2D_TRANSFORM_PIVOT_CENTER
@ LS_MODIFIER_MATERIAL_LINE
@ LS_MODIFIER_MATERIAL_LINE_A
Object is a sort of wrapper for general info.
Read Guarded memory(de)allocation.
static DBVT_INLINE btScalar size(const btDbvtVolume &a)
static void direct_link_linestyle_alpha_modifier(BlendDataReader *reader, LineStyleModifier *modifier)
static void linestyle_free_data(ID *id)
void BKE_linestyle_default_shader(const bContext *C, FreestyleLineStyle *linestyle)
bool BKE_linestyle_use_textures(FreestyleLineStyle *linestyle, const bool use_shading_nodes)
FreestyleLineStyle * BKE_linestyle_new(Main *bmain, const char *name)
static void linestyle_init_data(ID *id)
void BKE_linestyle_modifier_list_color_ramps(FreestyleLineStyle *linestyle, ListBase *listbase)
bool BKE_linestyle_thickness_modifier_move(FreestyleLineStyle *linestyle, LineStyleModifier *modifier, int direction)
static void direct_link_linestyle_color_modifier(BlendDataReader *reader, LineStyleModifier *modifier)
LineStyleModifier * BKE_linestyle_geometry_modifier_add(FreestyleLineStyle *linestyle, const char *name, int type)
void BKE_linestyle_init(FreestyleLineStyle *linestyle)
static void write_linestyle_geometry_modifiers(BlendWriter *writer, ListBase *modifiers)
int BKE_linestyle_thickness_modifier_remove(FreestyleLineStyle *linestyle, LineStyleModifier *m)
bool BKE_linestyle_color_modifier_move(FreestyleLineStyle *linestyle, LineStyleModifier *modifier, int direction)
static void write_linestyle_alpha_modifiers(BlendWriter *writer, ListBase *modifiers)
LineStyleModifier * BKE_linestyle_color_modifier_copy(FreestyleLineStyle *linestyle, const LineStyleModifier *m, const int flag)
static void direct_link_linestyle_thickness_modifier(BlendDataReader *reader, LineStyleModifier *modifier)
LineStyleModifier * BKE_linestyle_alpha_modifier_add(FreestyleLineStyle *linestyle, const char *name, int type)
static LineStyleModifier * alloc_geometry_modifier(const char *name, int type)
FreestyleLineStyle * BKE_linestyle_active_from_view_layer(ViewLayer *view_layer)
LineStyleModifier * BKE_linestyle_color_modifier_add(FreestyleLineStyle *linestyle, const char *name, int type)
static void write_linestyle_thickness_modifiers(BlendWriter *writer, ListBase *modifiers)
static void write_linestyle_color_modifiers(BlendWriter *writer, ListBase *modifiers)
int BKE_linestyle_color_modifier_remove(FreestyleLineStyle *linestyle, LineStyleModifier *m)
static void linestyle_blend_read_data(BlendDataReader *reader, ID *id)
static LineStyleModifier * new_modifier(const char *name, int type, size_t size)
static void linestyle_blend_write(BlendWriter *writer, ID *id, const void *id_address)
bool BKE_linestyle_alpha_modifier_move(FreestyleLineStyle *linestyle, LineStyleModifier *modifier, int direction)
bool BKE_linestyle_geometry_modifier_move(FreestyleLineStyle *linestyle, LineStyleModifier *modifier, int direction)
LineStyleModifier * BKE_linestyle_geometry_modifier_copy(FreestyleLineStyle *linestyle, const LineStyleModifier *m, const int)
static LineStyleModifier * alloc_alpha_modifier(const char *name, int type)
int BKE_linestyle_alpha_modifier_remove(FreestyleLineStyle *linestyle, LineStyleModifier *m)
static LineStyleModifier * alloc_color_modifier(const char *name, int type)
LineStyleModifier * BKE_linestyle_thickness_modifier_add(FreestyleLineStyle *linestyle, const char *name, int type)
std::optional< std::string > BKE_linestyle_path_to_color_ramp(FreestyleLineStyle *linestyle, const ColorBand *color_ramp)
LineStyleModifier * BKE_linestyle_thickness_modifier_copy(FreestyleLineStyle *linestyle, const LineStyleModifier *m, const int flag)
static void linestyle_foreach_id(ID *id, LibraryForeachIDData *data)
static const char * modifier_name[LS_MODIFIER_NUM]
static LineStyleModifier * alloc_thickness_modifier(const char *name, int type)
static void linestyle_copy_data(Main *bmain, std::optional< Library * > owner_library, ID *id_dst, const ID *id_src, const int flag)
int BKE_linestyle_geometry_modifier_remove(FreestyleLineStyle *linestyle, LineStyleModifier *m)
static void add_to_modifier_list(ListBase *lb, LineStyleModifier *m)
LineStyleModifier * BKE_linestyle_alpha_modifier_copy(FreestyleLineStyle *linestyle, const LineStyleModifier *m, const int)
static void direct_link_linestyle_geometry_modifier(BlendDataReader *, LineStyleModifier *)
void MEM_freeN(void *vmemh)
void *(* MEM_callocN)(size_t len, const char *str)
void *(* MEM_dupallocN)(const void *vmemh)
void node_set_active(bNodeTree *ntree, bNode *node)
void node_tree_blend_write(BlendWriter *writer, bNodeTree *ntree)
bNode * node_add_static_node(const bContext *C, bNodeTree *ntree, int type)
bNodeLink * node_add_link(bNodeTree *ntree, bNode *fromnode, bNodeSocket *fromsock, bNode *tonode, bNodeSocket *tosock)
bNodeTree * node_tree_add_tree_embedded(Main *bmain, ID *owner_id, const char *name, const char *idname)
void node_tree_free_embedded_tree(bNodeTree *ntree)
struct FreestyleLineStyle * linestyle
ListBase geometry_modifiers
struct bNodeTree * nodetree
ListBase thickness_modifiers
struct CurveMapping * curve
struct CurveMapping * curve
struct CurveMapping * curve
struct CurveMapping * curve
struct CurveMapping * curve
struct CurveMapping * curve
struct CurveMapping * curve
struct CurveMapping * curve
struct ColorBand * color_ramp
struct ColorBand * color_ramp
struct ColorBand * color_ramp
struct ColorBand * color_ramp
struct ColorBand * color_ramp
struct ColorBand * color_ramp
struct ColorBand * color_ramp
struct ColorBand * color_ramp
unsigned int random_backbone
unsigned int random_center
unsigned int random_radius
struct CurveMapping * curve
struct CurveMapping * curve
struct CurveMapping * curve
struct CurveMapping * curve
struct CurveMapping * curve
struct CurveMapping * curve
struct CurveMapping * curve
struct FreestyleConfig freestyle_config