38#include "RNA_prototypes.hh"
52 while (imd !=
nullptr) {
67 while (imd !=
nullptr) {
101 target_lmd->
runtime = MEM_new<LineartModifierRuntime>(__func__, *source_runtime);
158 bool default_add =
true;
169 if (ob->visibility_flag & object_visibility_flag) {
184 object_dependencies.
add(ob);
188 if (!ob->instance_collection) {
192 *ob->instance_collection, ctx, mode, object_dependencies, visibility_props);
193 object_dependencies.
add(ob);
212 runtime = MEM_new<LineartModifierRuntime>(__func__);
216 object_dependencies.
clear();
271 const int source_type =
RNA_enum_get(ptr,
"source_type");
284 layout.
prop(ptr,
"source_object",
UI_ITEM_NONE, std::nullopt, ICON_OBJECT_DATA);
288 sub.
prop(ptr,
"source_collection",
UI_ITEM_NONE, std::nullopt, ICON_OUTLINER_COLLECTION);
289 sub.
prop(ptr,
"use_invert_collection",
UI_ITEM_NONE,
"", ICON_ARROW_LEFTRIGHT);
297 ptr,
"target_layer", &obj_data_ptr,
"layers", std::nullopt, ICON_OUTLINER_DATA_GP_LAYER);
299 ptr,
"target_material", &obj_data_ptr,
"materials", std::nullopt, ICON_MATERIAL);
301 col = &layout.
column(
false);
328 ptr,
"shadow_region_filtering",
UI_ITEM_NONE,
IFACE_(
"Illumination Filtering"), ICON_NONE);
332 sub = &col->
row(
false,
IFACE_(
"Create"));
339 const int silhouette_filtering =
RNA_enum_get(ptr,
"silhouette_filtering");
341 entry->
prop(ptr,
"use_invert_silhouette",
UI_ITEM_NONE,
"", ICON_ARROW_LEFTRIGHT);
344 sub = &col->
row(
false);
345 if (use_cache && !is_first) {
362 entry = &col->
column(
false);
365 sub = &entry->
row(
false);
376 sub = &layout.
column(
false);
377 if (use_cache && !is_first) {
378 sub->
label(
IFACE_(
"Type overlapping cached"), ICON_STATUS_INFO);
382 "use_overlap_edge_type_support",
384 IFACE_(
"Allow Overlapping Types"),
404 if (use_cache && !is_first) {
405 layout.
label(
RPT_(
"Cached from the first Line Art modifier."), ICON_STATUS_INFO);
409 layout.
prop(ptr,
"light_contour_object",
UI_ITEM_NONE, std::nullopt, ICON_NONE);
414 remaining.
prop(ptr,
"shadow_camera_size",
UI_ITEM_NONE, std::nullopt, ICON_NONE);
435 if (use_cache && !is_first) {
436 layout.
label(
TIP_(
"Cached from the first Line Art modifier"), ICON_STATUS_INFO);
450 ptr,
"use_edge_overlap",
UI_ITEM_NONE,
IFACE_(
"Overlapping Edges As Contour"), ICON_NONE);
451 col.
prop(ptr,
"use_object_instances",
UI_ITEM_NONE, std::nullopt, ICON_NONE);
452 col.
prop(ptr,
"use_clip_plane_boundaries",
UI_ITEM_NONE, std::nullopt, ICON_NONE);
456 ptr,
"use_back_face_culling",
UI_ITEM_NONE,
IFACE_(
"Force Backface Culling"), ICON_NONE);
467 const bool use_multiple_levels =
RNA_boolean_get(ptr,
"use_multiple_levels");
473 if (!show_in_front) {
474 layout.
label(
TIP_(
"Object is not in front"), ICON_STATUS_INFO);
482 if (use_multiple_levels) {
494 const bool use_multiple_levels =
RNA_boolean_get(ptr,
"use_multiple_levels");
495 const int level_start =
RNA_int_get(ptr,
"level_start");
496 const int level_end =
RNA_int_get(ptr,
"level_end");
497 if (use_multiple_levels) {
498 return std::max(level_start, level_end) > 0;
500 return level_start > 0;
535 for (
int i = 0; i < 8; i++) {
538 sub = &col.
row(
true);
561 for (
int i = 0; i < 8; i++) {
564 sub = &col.
row(
true);
582 if (!use_cache || is_first) {
587 layout.
label(
IFACE_(
"Face Mark Filtering"), ICON_NONE);
605 if (use_cache && !is_first) {
606 layout.
label(
TIP_(
"Cached from the first Line Art modifier"), ICON_STATUS_INFO);
614 layout.
prop(ptr,
"use_face_mark_invert",
UI_ITEM_NONE, std::nullopt, ICON_NONE);
615 layout.
prop(ptr,
"use_face_mark_boundaries",
UI_ITEM_NONE, std::nullopt, ICON_NONE);
616 layout.
prop(ptr,
"use_face_mark_keep_contour",
UI_ITEM_NONE, std::nullopt, ICON_NONE);
635 if (use_cache && !is_first) {
636 layout.
label(
TIP_(
"Cached from the first Line Art modifier"), ICON_STATUS_INFO);
641 col.
prop(ptr,
"use_fuzzy_intersections",
UI_ITEM_NONE, std::nullopt, ICON_NONE);
645 col.
prop(ptr,
"use_detail_preserve",
UI_ITEM_NONE, std::nullopt, ICON_NONE);
649 "chaining_image_threshold",
651 is_geom ? std::make_optional<StringRefNull>(
IFACE_(
"Geometry Threshold")) :
674 if (use_cache && !is_first) {
675 layout.
label(
TIP_(
"Cached from the first Line Art modifier"), ICON_STATUS_INFO);
686 col.
prop(ptr,
"use_output_vertex_group_match_by_name",
UI_ITEM_NONE, std::nullopt, ICON_NONE);
688 col.
prop_search(ptr,
"vertex_group", &ob_ptr,
"vertex_groups",
IFACE_(
"Target"), ICON_NONE);
704 col.
label(
TIP_(
"Modifier has baked data"), ICON_NONE);
710 col->
op(
"OBJECT_OT_lineart_bake_strokes", std::nullopt, ICON_NONE);
711 PointerRNA op_ptr = col->
op(
"OBJECT_OT_lineart_bake_strokes",
IFACE_(
"Bake All"), ICON_NONE);
714 col = &layout.
column(
false);
715 col->
op(
"OBJECT_OT_lineart_clear", std::nullopt, ICON_NONE);
716 op_ptr = col->
op(
"OBJECT_OT_lineart_clear",
IFACE_(
"Clear All"), ICON_NONE);
732 layout.
prop(ptr,
"use_image_boundary_trimming",
UI_ITEM_NONE, std::nullopt, ICON_NONE);
735 layout.
label(
TIP_(
"Object is shown in front"), ICON_STATUS_ERROR);
743 "use_offset_towards_custom_camera",
745 IFACE_(
"Towards Custom Camera"),
763 region_type,
"geometry",
"Geometry Processing",
nullptr,
options_panel_draw, panel_type);
779 region_type,
"vgroup",
"Vertex Weight Transfer",
nullptr,
vgroup_panel_draw, panel_type);
789 const bool force_compute)
814 lmd.cache = local_lc;
844 lmd.source_collection,
846 lmd.use_multiple_levels ? lmd.level_end : lmd.level_start,
850 lmd.material_mask_bits,
851 lmd.intersection_mask,
855 lmd.shadow_selection,
856 lmd.silhouette_selection,
857 lmd.source_vertex_group,
860 lmd.calculation_flags);
890 const bool cache_ready = (first_lineart->
shared_cache !=
nullptr);
919 lmd->
runtime = MEM_new<LineartModifierRuntime>(__func__);
925 "GreasePencilLineartModifierData",
927 &RNA_GreasePencilLineartModifier,
#define FOREACH_COLLECTION_OBJECT_RECURSIVE_END
#define FOREACH_COLLECTION_OBJECT_RECURSIVE_BEGIN(_collection, _object)
Low-level operations for grease pencil.
General operations, lookup, etc. for materials.
#define BLT_I18NCONTEXT_ID_GPENCIL
#define CTX_IFACE_(context, msgid)
Object groups, one object can be in many groups at once.
#define INIT_DEFAULT_STRUCT_AFTER(struct_dst, member)
bool prop_is_animated(const AnimData *adt, StringRefNull rna_path, int array_index)
void get_lineart_modifier_limits(const Object &ob, ed::greasepencil::LineartLimitInfo &info)
GreasePencilLineartModifierData * get_first_lineart_modifier(const Object &ob)
void set_lineart_modifier_limits(GreasePencilLineartModifierData &lmd, const ed::greasepencil::LineartLimitInfo &info, const bool cache_is_ready)
@ ITEM_R_FORCE_BLANK_DECORATE
BLI_assert(slot->slot_subtype.map==BMO_OP_SLOT_SUBTYPE_MAP_FLT)
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 add_this_collection(Collection &collection, const ModifierUpdateDepsgraphContext *ctx, const int mode, Set< const Object * > &object_dependencies, LineartVisibilityProps &visibility_props)
int RNA_enum_get(PointerRNA *ptr, const char *name)
static void blend_write(BlendWriter *writer, const ID *, const ModifierData *md)
PointerRNA * modifier_panel_get_property_pointers(Panel *panel, PointerRNA *r_ob_ptr)
PropertyRNA * RNA_struct_find_property(PointerRNA *ptr, const char *identifier)
std::optional< std::string > RNA_path_from_ID_to_property(const PointerRNA *ptr, PropertyRNA *prop)
static void material_mask_panel_draw(const bContext *, Panel *panel)
static void chaining_panel_draw(const bContext *, Panel *panel)
@ eModifierType_GreasePencilLineart
static void init_data(ModifierData *md)
void(*)(void *user_data, Object *ob, ID **idpoin, LibraryForeachIDCallbackFlag cb_flag) IDWalkFunc
static void update_depsgraph(tGraphSliderOp *gso)
void MOD_lineart_clear_cache(LineartCache **lc)
static void foreach_ID_link(ModifierData *md, Object *ob, IDWalkFunc walk, void *user_data)
int RNA_int_get(PointerRNA *ptr, const char *name)
static void occlusion_panel_draw(const bContext *, Panel *panel)
void DEG_add_object_relation(DepsNodeHandle *node_handle, Object *object, eDepsObjectComponentType component, const char *description)
MatBase< float, 4, 4 > float4x4
bool MOD_lineart_compute_feature_lines_v3(Depsgraph *depsgraph, GreasePencilLineartModifierData &lmd, LineartCache **cached_result, bool enable_stroke_depth_offset)
void MOD_lineart_chain_clear_picked_flag(LineartCache *lc)
@ LINEART_SILHOUETTE_FILTER_NONE
static void modify_geometry_set(ModifierData *md, const ModifierEvalContext *ctx, bke::GeometrySet *geometry_set)
void modifier_error_message_draw(ui::Layout &layout, PointerRNA *ptr)
static bool anything_showing_through(PointerRNA *ptr)
void DEG_id_tag_update(ID *id, unsigned int flags)
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)
void MOD_lineart_gpencil_generate_v3(const LineartCache *cache, const float4x4 &inverse_mat, Depsgraph *depsgraph, 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 bool fill_strokes, const uchar shadow_selection, const uchar silhouette_mode, const char *source_vgname, const char *vgname, const int modifier_flags, const int modifier_calculation_flags)
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_visibility_animated(LineartVisibilityProps &visibility_props, Object *ob)
static bool is_last_line_art(const GreasePencilLineartModifierData &md, const bool use_render)
PointerRNA RNA_pointer_create_discrete(ID *id, StructRNA *type, void *data)
PropertyRNA * RNA_struct_type_find_property(StructRNA *srna, const char *identifier)
void MOD_lineart_destroy_render_data_v3(GreasePencilLineartModifierData *lmd)
int BKE_object_material_index_get(Object *ob, const Material *ma)
bool RNA_boolean_get(PointerRNA *ptr, const char *name)
@ eModifierTypeFlag_AcceptsGreasePencil
void RNA_boolean_set(PointerRNA *ptr, const char *name, bool value)
PointerRNA RNA_pointer_get(PointerRNA *ptr, const char *name)
static void edge_types_panel_draw(const bContext *, Panel *panel)
static void blend_read(BlendDataReader *, ModifierData *md)
static void face_mark_panel_draw_header(const bContext *, Panel *panel)
static void intersection_panel_draw(const bContext *, Panel *panel)
PanelType * modifier_panel_register(ARegionType *region_type, ModifierType type, PanelDrawFn draw)
void BKE_defgroup_copy_list(ListBaseT< bDeformGroup > *outbase, const ListBaseT< bDeformGroup > *inbase)
static void composition_panel_draw(const bContext *, Panel *panel)
static void panel_draw(const bContext *, Panel *panel)
static void vgroup_panel_draw(const bContext *, Panel *panel)
ModifierTypeInfo modifierType_GreasePencilLineart
PanelType * modifier_subpanel_register(ARegionType *region_type, const char *name, const char *label, PanelDrawFn draw_header, PanelDrawFn draw, PanelType *parent)
@ DEG_SCENE_COMP_PARAMETERS
void DEG_add_scene_relation(DepsNodeHandle *node_handle, Scene *scene, eDepsSceneComponentType component, const char *description)
static bool is_disabled(const Scene *, ModifierData *md, bool)
@ MOD_LINEART_USE_CUSTOM_CAMERA
static void face_mark_panel_draw(const bContext *, Panel *panel)
static bool is_first_lineart(const GreasePencilLineartModifierData &md)
@ LINEART_SOURCE_COLLECTION
static void options_light_reference_draw(const bContext *, Panel *panel)
void BKE_modifier_copydata_generic(const ModifierData *md, ModifierData *md_dst, int flag)
LineartCache * MOD_lineart_init_cache()
void write_struct(const T *data, BlendStructWriterTypedFn< T > fn=nullptr)
eCollectionLineArt_Usage lineart_usage
ListBaseT< struct bDeformGroup > vertex_group_names
struct LineartModifierRuntime * runtime
eGreasePencilLineartFlags flags
GreasePencilLineartModifierSource source_type
struct Material * target_material
struct LineartCache * shared_cache
struct Object * source_camera
struct Object * source_object
struct Object * light_contour_object
struct Collection * source_collection
ed::greasepencil::LineartLimitInfo LimitInfo
Set< const Object * > object_dependencies
PropertyRNA * prop_hide_render
PropertyRNA * prop_hide_viewport
struct ModifierData * next
struct ModifierData * prev
eObject_DrawExtraFlag dtx
struct Collection * master_collection
bool has_grease_pencil() const
GreasePencil * get_grease_pencil_for_write()
void enabled_set(bool enabled)
void prop_search(PointerRNA *ptr, PropertyRNA *prop, PointerRNA *searchptr, PropertyRNA *searchprop, PropertyRNA *item_searchpropname, std::optional< StringRefNull > name, int icon, bool results_are_suggestions)
void use_property_split_set(bool is_sep)
void label(StringRef name, int icon)
PointerRNA op(wmOperatorType *ot, std::optional< StringRef > name, int icon, wm::OpCallContext context, eUI_Item_Flag flag)
void prop(PointerRNA *ptr, PropertyRNA *prop, int index, int value, eUI_Item_Flag flag, std::optional< StringRef > name_opt, int icon, std::optional< StringRef > placeholder=std::nullopt)
void active_set(bool active)
Layout & column(bool align)