35#include "RNA_prototypes.hh"
49 while (imd !=
nullptr) {
64 while (imd !=
nullptr) {
99 target_lmd->
runtime = MEM_new<LineartModifierRuntime>(__func__);
144 bool default_add =
true;
159 object_dependencies.
add(ob);
163 if (!ob->instance_collection) {
167 object_dependencies.
add(ob);
186 runtime = MEM_new<LineartModifierRuntime>(__func__);
191 if (!object_dependencies) {
196 object_dependencies->
clear();
267 col,
ptr,
"target_layer", &obj_data_ptr,
"layers",
nullptr, ICON_OUTLINER_DATA_GP_LAYER);
268 uiItemPointerR(
col,
ptr,
"target_material", &obj_data_ptr,
"materials",
nullptr, ICON_MATERIAL);
297 "shadow_region_filtering",
299 IFACE_(
"Illumination Filtering"),
311 const int silhouette_filtering =
RNA_enum_get(
ptr,
"silhouette_filtering");
317 if (use_cache && !is_first) {
351 if (use_cache && !is_first) {
357 "use_overlap_edge_type_support",
359 IFACE_(
"Allow Overlapping Types"),
379 if (use_cache && !is_first) {
380 uiItemL(layout,
RPT_(
"Cached from the first line art modifier."), ICON_INFO);
410 if (use_cache && !is_first) {
411 uiItemL(layout,
TIP_(
"Cached from the first Line Art modifier"), ICON_INFO);
428 IFACE_(
"Overlapping Edges As Contour"),
436 "use_back_face_culling",
438 IFACE_(
"Force Backface Culling"),
456 if (!show_in_front) {
457 uiItemL(layout,
TIP_(
"Object is not in front"), ICON_INFO);
465 if (use_multiple_levels) {
480 if (use_multiple_levels) {
481 return std::max(level_start, level_end) > 0;
483 return level_start > 0;
518 for (
int i = 0; i < 8; i++) {
544 for (
int i = 0; i < 8; i++) {
565 if (!use_cache || is_first) {
588 if (use_cache && !is_first) {
589 uiItemL(layout,
TIP_(
"Cached from the first Line Art modifier"), ICON_INFO);
618 if (use_cache && !is_first) {
619 uiItemL(layout,
TIP_(
"Cached from the first Line Art modifier"), ICON_INFO);
634 "chaining_image_threshold",
636 is_geom ?
IFACE_(
"Geometry Threshold") :
nullptr,
658 if (use_cache && !is_first) {
659 uiItemL(layout,
TIP_(
"Cached from the first Line Art modifier"), ICON_INFO);
696 uiItemO(
col,
nullptr, ICON_NONE,
"OBJECT_OT_lineart_bake_strokes");
698 col,
IFACE_(
"Bake All"), ICON_NONE,
"OBJECT_OT_lineart_bake_strokes",
"bake_all",
true);
701 uiItemO(
col,
nullptr, ICON_NONE,
"OBJECT_OT_lineart_clear");
703 col,
IFACE_(
"Clear All"), ICON_NONE,
"OBJECT_OT_lineart_clear",
"clear_all",
true);
721 uiItemL(layout,
TIP_(
"Object is shown in front"), ICON_ERROR);
730 "use_offset_towards_custom_camera",
732 IFACE_(
"Towards Custom Camera"),
750 region_type,
"geometry",
"Geometry Processing",
nullptr,
options_panel_draw, panel_type);
766 region_type,
"vgroup",
"Vertex Weight Transfer",
nullptr,
vgroup_panel_draw, panel_type);
776 const bool force_compute)
778 using namespace bke::greasepencil;
781 TreeNode *node = grease_pencil.find_node_by_name(lmd.target_layer);
782 if (!node || !node->is_layer()) {
801 lmd.cache = local_lc;
803 const int current_frame = grease_pencil.
runtime->eval_frame;
806 Layer &layer = node->as_layer();
809 if (
Drawing *drawing = grease_pencil.get_editable_drawing_at(layer, current_frame)) {
812 return *grease_pencil.insert_frame(layer, current_frame);
824 lmd.source_collection,
826 lmd.use_multiple_levels ? lmd.level_end : lmd.level_start,
830 lmd.material_mask_bits,
831 lmd.intersection_mask,
832 float(lmd.thickness) / 1000.0f,
834 lmd.shadow_selection,
835 lmd.silhouette_selection,
836 lmd.source_vertex_group,
839 lmd.calculation_flags);
868 const bool cache_ready = (first_lineart->
shared_cache !=
nullptr);
897 lmd->
runtime = MEM_new<LineartModifierRuntime>(__func__);
905 "GreasePencilLineartModifierData",
907 &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)
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
struct GreasePencilLineartModifierData GreasePencilLineartModifierData
@ 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
draw_view in_light_buf[] float
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)
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()