15#include <fmt/format.h>
62 std::optional<Library *> owner_library,
76 if (linestyle_src->
mtex[a]) {
78 *linestyle_dst->
mtex[a] = blender::dna::shallow_copy(*linestyle_src->
mtex[a]);
87 reinterpret_cast<ID **
>(&linestyle_dst->
nodetree),
88 flag_embedded_id_data);
117 for (
int material_slot_index = 0; material_slot_index <
MAX_MTEX; material_slot_index++) {
147 if (linestyle->
mtex[
i]) {
446 for (
int a = 0; a <
MAX_MTEX; a++) {
447 if (linestyle->
mtex[a]) {
456 writer,
reinterpret_cast<bNodeTree *
>(temp_embedded_id_buffer.
get()));
463 switch (modifier->
type) {
512 switch (modifier->
type) {
569 switch (modifier->
type) {
632 size_t (*struct_size)(
int))
661 for (
int a = 0; a <
MAX_MTEX; a++) {
667 FreestyleLineStyle::id_type,
672 "FreestyleLineStyle",
697 nullptr,
"Along Stroke",
"Distance from Camera",
"Distance from Object",
698 "Material",
"Sampling",
"Bézier Curve",
"Sinus Displacement",
699 "Spatial Noise",
"Perlin Noise 1D",
"Perlin Noise 2D",
"Backbone Stretcher",
700 "Tip Remover",
"Calligraphy",
"Polygonalization",
"Guiding Lines",
701 "Blueprint",
"2D Offset",
"2D Transform",
"Tangent",
702 "Noise",
"Crease Angle",
"Simplification",
"Curvature 3D",
725 return (lineset) ? lineset->
linestyle :
nullptr;
1082 if (new_m ==
nullptr) [[unlikely]] {
1660 if (new_m ==
nullptr) [[unlikely]] {
1853 link->
data = color_ramp;
1908 char name_esc[
sizeof(m->name) * 2];
1910 return fmt::format(
"color_modifiers[\"{}\"].color_ramp", name_esc);
1913 printf(
"BKE_linestyle_path_to_color_ramp: No color ramps correspond to the given pointer.\n");
1914 return std::nullopt;
1919 if (use_shading_nodes) {
1930 return (linestyle->
mtex[0] !=
nullptr);
1938 bNode *uv_along_stroke, *input_texture, *output_linestyle;
1945 nullptr, &linestyle->
id,
"stroke_shader",
"ShaderNodeTree");
1948 uv_along_stroke->
location[0] = -200.0f;
1949 uv_along_stroke->
location[1] = 100.0f;
1954 input_texture->
location[1] = 100.0f;
1957 output_linestyle->
location[0] = 300.0f;
1958 output_linestyle->
location[1] = 100.0f;
1960 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
struct ID * BKE_id_copy_in_lib(Main *bmain, std::optional< Library * > owner_library, const ID *id, std::optional< const ID * > new_owner_id, ID **new_id_p, int flag)
void * BKE_libblock_alloc(Main *bmain, short type, const char *name, int flag) ATTR_WARN_UNUSED_RESULT
@ 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.
FreestyleLineStyle * BKE_linestyle_new(struct Main *bmain, const char *name)
int BKE_linestyle_alpha_modifier_remove(FreestyleLineStyle *linestyle, LineStyleModifier *modifier)
int BKE_linestyle_color_modifier_remove(FreestyleLineStyle *linestyle, LineStyleModifier *modifier)
void BKE_linestyle_modifier_list_color_ramps(FreestyleLineStyle *linestyle, ListBase *listbase)
LineStyleModifier * BKE_linestyle_geometry_modifier_copy(FreestyleLineStyle *linestyle, const LineStyleModifier *m, int flag)
LineStyleModifier * BKE_linestyle_thickness_modifier_copy(FreestyleLineStyle *linestyle, const LineStyleModifier *m, int flag)
bool BKE_linestyle_thickness_modifier_move(FreestyleLineStyle *linestyle, LineStyleModifier *modifier, int direction)
LineStyleModifier * BKE_linestyle_geometry_modifier_add(FreestyleLineStyle *linestyle, const char *name, int type)
bool BKE_linestyle_color_modifier_move(FreestyleLineStyle *linestyle, LineStyleModifier *modifier, int direction)
void BKE_linestyle_default_shader(const struct bContext *C, FreestyleLineStyle *linestyle)
LineStyleModifier * BKE_linestyle_alpha_modifier_add(FreestyleLineStyle *linestyle, const char *name, int type)
FreestyleLineStyle * BKE_linestyle_active_from_view_layer(struct ViewLayer *view_layer)
LineStyleModifier * BKE_linestyle_color_modifier_add(FreestyleLineStyle *linestyle, const char *name, int type)
std::optional< std::string > BKE_linestyle_path_to_color_ramp(FreestyleLineStyle *linestyle, const struct ColorBand *color_ramp)
int BKE_linestyle_thickness_modifier_remove(FreestyleLineStyle *linestyle, LineStyleModifier *modifier)
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_color_modifier_copy(FreestyleLineStyle *linestyle, const LineStyleModifier *m, int flag)
bool BKE_linestyle_use_textures(FreestyleLineStyle *linestyle, bool use_shading_nodes)
void BKE_linestyle_init(struct FreestyleLineStyle *linestyle)
LineStyleModifier * BKE_linestyle_thickness_modifier_add(FreestyleLineStyle *linestyle, const char *name, int type)
LineStyleModifier * BKE_linestyle_alpha_modifier_copy(FreestyleLineStyle *linestyle, const LineStyleModifier *m, int flag)
int BKE_linestyle_geometry_modifier_remove(FreestyleLineStyle *linestyle, LineStyleModifier *modifier)
#define NODE_CLASS_TEXTURE
#define SH_NODE_TEX_IMAGE
#define SH_NODE_UVALONGSTROKE
#define SH_NODE_OUTPUT_LINESTYLE
void BKE_ntree_update_after_single_tree_change(Main &bmain, bNodeTree &modified_tree, const NodeTreeUpdateExtraParams ¶ms={})
void BKE_texture_mtex_foreach_id(struct LibraryForeachIDData *data, struct MTex *mtex)
int BLI_findindex(const ListBase *listbase, const void *vlink) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL(1)
void * BLI_findlink(const ListBase *listbase, int number) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL(1)
#define LISTBASE_FOREACH(type, var, list)
BLI_INLINE void BLI_listbase_clear(ListBase *lb)
void BLI_freelinkN(ListBase *listbase, void *vlink) ATTR_NONNULL(1)
void BLI_addtail(ListBase *listbase, void *vlink) ATTR_NONNULL(1)
void void void bool BLI_listbase_link_move(ListBase *listbase, void *vlink, int step) ATTR_NONNULL()
char * STRNCPY(char(&dst)[N], const char *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)
#define BLO_write_id_struct(writer, struct_name, id_address, id)
#define BLO_write_struct(writer, struct_name, data_ptr)
void BLO_read_struct_list_with_type_size(BlendDataReader *reader, size_t base_size, ListBase *list, blender::FunctionRef< size_t(const void *data)> type_size_fn)
#define BLO_read_struct(reader, struct_name, ptr_p)
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_MODIFIER_2D_TRANSFORM_PIVOT_CENTER
@ LS_THICKNESS_ASYMMETRIC
@ LS_MODIFIER_MATERIAL_LINE
@ LS_MODIFIER_MATERIAL_LINE_A
Object is a sort of wrapper for general info.
Read Guarded memory(de)allocation.
BMesh const char void * data
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)
static void linestyle_init_data(ID *id)
static void direct_link_linestyle_color_modifier(BlendDataReader *reader, LineStyleModifier *modifier)
static void write_linestyle_geometry_modifiers(BlendWriter *writer, ListBase *modifiers)
static size_t color_modifier_struct_size(int type)
static size_t thickness_modifier_struct_size(int type)
static void write_linestyle_alpha_modifiers(BlendWriter *writer, ListBase *modifiers)
static void direct_link_linestyle_thickness_modifier(BlendDataReader *reader, LineStyleModifier *modifier)
static LineStyleModifier * alloc_geometry_modifier(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)
static size_t geometry_modifier_struct_size(int type)
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)
static size_t alpha_modifier_struct_size(int type)
static LineStyleModifier * alloc_alpha_modifier(const char *name, int type)
static void linestyle_modifiers_read(BlendDataReader *reader, ListBase *modifiers, size_t(*struct_size)(int))
static LineStyleModifier * alloc_color_modifier(const char *name, int type)
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)
static void add_to_modifier_list(ListBase *lb, LineStyleModifier *m)
static void direct_link_linestyle_geometry_modifier(BlendDataReader *, LineStyleModifier *)
void * MEM_callocN(size_t len, const char *str)
void * MEM_dupallocN(const void *vmemh)
void MEM_freeN(void *vmemh)
bNodeTree * node_tree_add_tree_embedded(Main *bmain, ID *owner_id, StringRefNull name, StringRefNull idname)
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)
void node_set_active(bNodeTree &ntree, bNode &node)
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