35#include "RNA_prototypes.hh"
49 while (imd !=
nullptr) {
64 while (imd !=
nullptr) {
99 target_lmd->
runtime = MEM_new<LineartModifierRuntime>(__func__);
104 if (object_dependencies) {
149 bool default_add =
true;
164 object_dependencies.
add(ob);
168 if (!ob->instance_collection) {
172 object_dependencies.
add(ob);
191 runtime = MEM_new<LineartModifierRuntime>(__func__);
196 if (!object_dependencies) {
201 object_dependencies->
clear();
273 col,
ptr,
"target_layer", &obj_data_ptr,
"layers",
nullptr, ICON_OUTLINER_DATA_GP_LAYER);
274 uiItemPointerR(
col,
ptr,
"target_material", &obj_data_ptr,
"materials",
nullptr, ICON_MATERIAL);
303 "shadow_region_filtering",
305 IFACE_(
"Illumination Filtering"),
317 const int silhouette_filtering =
RNA_enum_get(
ptr,
"silhouette_filtering");
323 if (use_cache && !is_first) {
357 if (use_cache && !is_first) {
363 "use_overlap_edge_type_support",
365 IFACE_(
"Allow Overlapping Types"),
385 if (use_cache && !is_first) {
386 uiItemL(layout,
RPT_(
"Cached from the first line art modifier."), ICON_INFO);
416 if (use_cache && !is_first) {
417 uiItemL(layout,
TIP_(
"Cached from the first Line Art modifier"), ICON_INFO);
434 IFACE_(
"Overlapping Edges As Contour"),
442 "use_back_face_culling",
444 IFACE_(
"Force Backface Culling"),
462 if (!show_in_front) {
463 uiItemL(layout,
TIP_(
"Object is not in front"), ICON_INFO);
471 if (use_multiple_levels) {
486 if (use_multiple_levels) {
487 return std::max(level_start, level_end) > 0;
489 return level_start > 0;
524 for (
int i = 0; i < 8; i++) {
550 for (
int i = 0; i < 8; i++) {
571 if (!use_cache || is_first) {
594 if (use_cache && !is_first) {
595 uiItemL(layout,
TIP_(
"Cached from the first Line Art modifier"), ICON_INFO);
624 if (use_cache && !is_first) {
625 uiItemL(layout,
TIP_(
"Cached from the first Line Art modifier"), ICON_INFO);
640 "chaining_image_threshold",
642 is_geom ?
IFACE_(
"Geometry Threshold") :
nullptr,
664 if (use_cache && !is_first) {
665 uiItemL(layout,
TIP_(
"Cached from the first Line Art modifier"), ICON_INFO);
702 uiItemO(
col,
nullptr, ICON_NONE,
"OBJECT_OT_lineart_bake_strokes");
704 col,
IFACE_(
"Bake All"), ICON_NONE,
"OBJECT_OT_lineart_bake_strokes",
"bake_all",
true);
707 uiItemO(
col,
nullptr, ICON_NONE,
"OBJECT_OT_lineart_clear");
709 col,
IFACE_(
"Clear All"), ICON_NONE,
"OBJECT_OT_lineart_clear",
"clear_all",
true);
727 uiItemL(layout,
TIP_(
"Object is shown in front"), ICON_ERROR);
736 "use_offset_towards_custom_camera",
738 IFACE_(
"Towards Custom Camera"),
756 region_type,
"geometry",
"Geometry Processing",
nullptr,
options_panel_draw, panel_type);
772 region_type,
"vgroup",
"Vertex Weight Transfer",
nullptr,
vgroup_panel_draw, panel_type);
782 const bool force_compute)
787 TreeNode *node = grease_pencil.find_node_by_name(lmd.target_layer);
807 lmd.cache = local_lc;
809 const int current_frame = grease_pencil.
runtime->eval_frame;
820 if (
Drawing *drawing = grease_pencil.get_drawing_at(layer, current_frame)) {
823 return grease_pencil.insert_frame(layer, current_frame);
834 lmd.source_collection,
836 lmd.use_multiple_levels ? lmd.level_end : lmd.level_start,
840 lmd.material_mask_bits,
841 lmd.intersection_mask,
842 float(lmd.thickness) / 1000.0f,
844 lmd.shadow_selection,
845 lmd.silhouette_selection,
846 lmd.source_vertex_group,
849 lmd.calculation_flags);
879 const bool cache_ready = (first_lineart->
shared_cache !=
nullptr);
908 lmd->
runtime = MEM_new<LineartModifierRuntime>(__func__);
916 "GreasePencilLineartModifierData",
918 &RNA_GreasePencilLineartModifier,
#define FOREACH_COLLECTION_VISIBLE_OBJECT_RECURSIVE_BEGIN(_collection, _object, _mode)
#define FOREACH_COLLECTION_VISIBLE_OBJECT_RECURSIVE_END
Low-level operations for grease pencil.
General operations, lookup, etc. for materials.
int BKE_object_material_index_get(Object *ob, const Material *ma)
void BKE_modifier_copydata_generic(const ModifierData *md, ModifierData *md_dst, int flag)
@ eModifierTypeFlag_AcceptsGreasePencil
void(*)(void *user_data, Object *ob, ID **idpoin, int cb_flag) IDWalkFunc
#define MEMCMP_STRUCT_AFTER_IS_ZERO(struct_var, member)
#define MEMCPY_STRUCT_AFTER(struct_dst, struct_src, member)
#define BLO_write_struct(writer, struct_name, data_ptr)
#define BLT_I18NCONTEXT_ID_GPENCIL
#define CTX_IFACE_(context, msgid)
void DEG_id_tag_update(ID *id, unsigned int flags)
@ DEG_SCENE_COMP_PARAMETERS
void DEG_add_scene_relation(DepsNodeHandle *node_handle, Scene *scene, eDepsSceneComponentType component, const char *description)
void DEG_add_object_relation(DepsNodeHandle *node_handle, Object *object, eDepsObjectComponentType component, const char *description)
Object groups, one object can be in many groups at once.
#define DNA_struct_default_get(struct_name)
@ MOD_LINEART_USE_CUSTOM_CAMERA
@ LINEART_SILHOUETTE_FILTER_NONE
@ LINEART_SOURCE_COLLECTION
@ eModifierType_GreasePencilLineart
ModifierTypeInfo modifierType_GreasePencilLineart
PanelType * modifier_subpanel_register(ARegionType *region_type, const char *name, const char *label, PanelDrawFn draw_header, PanelDrawFn draw, PanelType *parent)
void modifier_panel_end(uiLayout *layout, PointerRNA *ptr)
PanelType * modifier_panel_register(ARegionType *region_type, ModifierType type, PanelDrawFn draw)
PointerRNA * modifier_panel_get_property_pointers(Panel *panel, PointerRNA *r_ob_ptr)
void uiItemBooleanO(uiLayout *layout, const char *name, int icon, const char *opname, const char *propname, int value)
void uiLayoutSetActive(uiLayout *layout, bool active)
void uiLayoutSetEnabled(uiLayout *layout, bool enabled)
void uiItemL(uiLayout *layout, const char *name, int icon)
uiLayout * uiLayoutRow(uiLayout *layout, bool align)
void uiItemFullR(uiLayout *layout, PointerRNA *ptr, PropertyRNA *prop, int index, int value, eUI_Item_Flag flag, const char *name, int icon, const char *placeholder=nullptr)
void uiLayoutSetPropSep(uiLayout *layout, bool is_sep)
uiLayout * uiLayoutRowWithHeading(uiLayout *layout, bool align, const char *heading)
void uiItemPointerR(uiLayout *layout, PointerRNA *ptr, const char *propname, PointerRNA *searchptr, const char *searchpropname, const char *name, int icon)
void uiItemO(uiLayout *layout, const char *name, int icon, const char *opname)
uiLayout * uiLayoutColumnWithHeading(uiLayout *layout, bool align, const char *heading)
uiLayout * uiLayoutColumn(uiLayout *layout, bool align)
void uiItemR(uiLayout *layout, PointerRNA *ptr, const char *propname, eUI_Item_Flag flag, const char *name, int icon)
@ UI_ITEM_R_FORCE_BLANK_DECORATE
const Layer & as_layer() const
void MOD_lineart_chain_clear_picked_flag(LineartCache *lc)
LineartCache * MOD_lineart_init_cache()
void MOD_lineart_clear_cache(LineartCache **lc)
void MOD_lineart_destroy_render_data_v3(GreasePencilLineartModifierData *lmd)
void MOD_lineart_gpencil_generate_v3(const LineartCache *cache, const blender::float4x4 &inverse_mat, Depsgraph *depsgraph, blender::bke::greasepencil::Drawing &drawing, const int8_t source_type, Object *source_object, Collection *source_collection, const int level_start, const int level_end, const int mat_nr, const int16_t edge_types, const uchar mask_switches, const uchar material_mask_bits, const uchar intersection_mask, const float thickness, const float opacity, const uchar shadow_selection, const uchar silhouette_mode, const char *source_vgname, const char *vgname, const int modifier_flags, const int modifier_calculation_flags)
bool MOD_lineart_compute_feature_lines_v3(Depsgraph *depsgraph, GreasePencilLineartModifierData &lmd, LineartCache **cached_result, bool enable_stroke_depth_offset)
void get_lineart_modifier_limits(const Object &ob, blender::ed::greasepencil::LineartLimitInfo &info)
void set_lineart_modifier_limits(GreasePencilLineartModifierData &lmd, const blender::ed::greasepencil::LineartLimitInfo &info, const bool cache_is_ready)
GreasePencilLineartModifierData * get_first_lineart_modifier(const Object &ob)
static void material_mask_panel_draw_header(const bContext *, Panel *panel)
static void copy_data(const ModifierData *md, ModifierData *target, const int flag)
static void blend_write(BlendWriter *writer, const ID *, const ModifierData *md)
static void material_mask_panel_draw(const bContext *, Panel *panel)
static void chaining_panel_draw(const bContext *, Panel *panel)
static void init_data(ModifierData *md)
static void foreach_ID_link(ModifierData *md, Object *ob, IDWalkFunc walk, void *user_data)
static void occlusion_panel_draw(const bContext *, Panel *panel)
static void panel_draw(const bContext *C, Panel *panel)
MatBase< float, 4, 4 > float4x4
static void add_this_collection(Collection &collection, const ModifierUpdateDepsgraphContext *ctx, const int mode, Set< const Object * > &object_dependencies)
static void modify_geometry_set(ModifierData *md, const ModifierEvalContext *ctx, bke::GeometrySet *geometry_set)
static bool anything_showing_through(PointerRNA *ptr)
static void generate_strokes(ModifierData &md, const ModifierEvalContext &ctx, GreasePencil &grease_pencil, GreasePencilLineartModifierData &first_lineart, const bool force_compute)
static void free_data(ModifierData *md)
static void bake_panel_draw(const bContext *, Panel *panel)
static void options_panel_draw(const bContext *, Panel *panel)
static void panel_register(ARegionType *region_type)
static bool is_last_line_art(const GreasePencilLineartModifierData &md, const bool use_render)
static void edge_types_panel_draw(const bContext *, Panel *panel)
static void face_mark_panel_draw_header(const bContext *, Panel *panel)
static void intersection_panel_draw(const bContext *, Panel *panel)
static void composition_panel_draw(const bContext *, Panel *panel)
static void vgroup_panel_draw(const bContext *, Panel *panel)
static void update_depsgraph(ModifierData *md, const ModifierUpdateDepsgraphContext *ctx)
static bool is_disabled(const Scene *, ModifierData *md, bool)
static void face_mark_panel_draw(const bContext *, Panel *panel)
static void blend_read(BlendDataReader *reader, ModifierData *md)
static bool is_first_lineart(const GreasePencilLineartModifierData &md)
static void options_light_reference_draw(const bContext *, Panel *panel)
PointerRNA RNA_pointer_get(PointerRNA *ptr, const char *name)
PropertyRNA * RNA_struct_find_property(PointerRNA *ptr, const char *identifier)
int RNA_int_get(PointerRNA *ptr, const char *name)
bool RNA_boolean_get(PointerRNA *ptr, const char *name)
int RNA_enum_get(PointerRNA *ptr, const char *name)
struct Object * source_object
struct Material * target_material
struct LineartCache * shared_cache
struct Collection * source_collection
struct Object * source_camera
struct Object * light_contour_object
GreasePencilRuntimeHandle * runtime
blender::ed::greasepencil::LineartLimitInfo LimitInfo
std::unique_ptr< blender::Set< const Object * > > object_dependencies
struct ModifierData * next
struct ModifierData * prev
struct Collection * master_collection
bool has_grease_pencil() const
GreasePencil * get_grease_pencil_for_write()