14#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]) {
454 for (
int a = 0; a <
MAX_MTEX; a++) {
455 if (linestyle->
mtex[a]) {
464 writer,
reinterpret_cast<bNodeTree *
>(temp_embedded_id_buffer.
get()));
471 switch (modifier->
type) {
520 switch (modifier->
type) {
577 switch (modifier->
type) {
653 for (
int a = 0; a <
MAX_MTEX; a++) {
659 FreestyleLineStyle::id_type,
664 "FreestyleLineStyle",
690 nullptr,
"Along Stroke",
"Distance from Camera",
"Distance from Object",
691 "Material",
"Sampling",
"Bézier Curve",
"Sinus Displacement",
692 "Spatial Noise",
"Perlin Noise 1D",
"Perlin Noise 2D",
"Backbone Stretcher",
693 "Tip Remover",
"Calligraphy",
"Polygonalization",
"Guiding Lines",
694 "Blueprint",
"2D Offset",
"2D Transform",
"Tangent",
695 "Noise",
"Crease Angle",
"Simplification",
"Curvature 3D",
718 return (lineset) ? lineset->
linestyle :
nullptr;
1858 link->
data = color_ramp;
1913 char name_esc[
sizeof(m->name) * 2];
1915 return fmt::format(
"color_modifiers[\"{}\"].color_ramp", name_esc);
1918 printf(
"BKE_linestyle_path_to_color_ramp: No color ramps correspond to the given pointer.\n");
1919 return std::nullopt;
1924 if (use_shading_nodes) {
1935 return (linestyle->
mtex[0] !=
nullptr);
1943 bNode *uv_along_stroke, *input_texture, *output_linestyle;
1950 nullptr, &linestyle->
id,
"stroke_shader",
"ShaderNodeTree");
1953 uv_along_stroke->
location[0] = -200.0f;
1954 uv_along_stroke->
location[1] = 100.0f;
1959 input_texture->
location[1] = 100.0f;
1962 output_linestyle->
location[0] = 300.0f;
1963 output_linestyle->
location[1] = 100.0f;
1965 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.
#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()
size_t BLI_str_escape(char *__restrict dst, const char *__restrict src, size_t dst_maxncpy) ATTR_NONNULL(1
#define STRNCPY_UTF8(dst, src)
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)
#define BLO_read_struct_list(reader, struct_name, list)
#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_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_MATERIAL_LINE
@ LS_MODIFIER_MATERIAL_LINE_A
@ LS_MODIFIER_BLUEPRINT_CIRCLES
@ LS_MODIFIER_2D_TRANSFORM_PIVOT_CENTER
@ LS_THICKNESS_ASYMMETRIC
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)
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_foreach_working_space_color(ID *id, const IDTypeForeachColorFunctionCallback &fn)
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_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
const blender::FunctionRef< void(float rgb[3])> single
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