Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'source/blender/gpencil_modifiers/intern/MOD_gpencillineart.c')
-rw-r--r--source/blender/gpencil_modifiers/intern/MOD_gpencillineart.c57
1 files changed, 24 insertions, 33 deletions
diff --git a/source/blender/gpencil_modifiers/intern/MOD_gpencillineart.c b/source/blender/gpencil_modifiers/intern/MOD_gpencillineart.c
index 0e7df2a136d..8d77fb50c71 100644
--- a/source/blender/gpencil_modifiers/intern/MOD_gpencillineart.c
+++ b/source/blender/gpencil_modifiers/intern/MOD_gpencillineart.c
@@ -7,9 +7,8 @@
#include <stdio.h>
-#include "BLI_utildefines.h"
-
#include "BLI_math_vector.h"
+#include "BLI_utildefines.h"
#include "BLT_translation.h"
@@ -22,9 +21,6 @@
#include "DNA_scene_types.h"
#include "DNA_screen_types.h"
-#include "MOD_gpencil_lineart.h"
-#include "lineart/MOD_lineart.h"
-
#include "BKE_collection.h"
#include "BKE_context.h"
#include "BKE_global.h"
@@ -43,8 +39,10 @@
#include "DEG_depsgraph.h"
#include "DEG_depsgraph_query.h"
+#include "MOD_gpencil_lineart.h"
#include "MOD_gpencil_modifiertypes.h"
#include "MOD_gpencil_ui_common.h"
+#include "lineart/MOD_lineart.h"
#include "WM_api.h"
#include "WM_types.h"
@@ -218,9 +216,18 @@ static void add_this_collection(Collection *c,
if (!c) {
return;
}
+ bool default_add = true;
+ /* Do not do nested collection usage check, this is consistent with lineart calculation, because
+ * collection usage doesn't have a INHERIT mode. This might initially be derived from the fact
+ * that an object can be inside multiple collections, but might be irrelevant now with the way
+ * objects are iterated. Keep this logic for now. */
+ if (c->lineart_usage & COLLECTION_LRT_EXCLUDE) {
+ default_add = false;
+ }
FOREACH_COLLECTION_VISIBLE_OBJECT_RECURSIVE_BEGIN (c, ob, mode) {
if (ELEM(ob->type, OB_MESH, OB_MBALL, OB_CURVES_LEGACY, OB_SURF, OB_FONT)) {
- if (ob->lineart.usage != OBJECT_LRT_EXCLUDE) {
+ if ((ob->lineart.usage == OBJECT_LRT_INHERIT && default_add) ||
+ ob->lineart.usage != OBJECT_LRT_EXCLUDE) {
DEG_add_object_relation(ctx->node, ob, DEG_OB_COMP_GEOMETRY, "Line Art Modifier");
DEG_add_object_relation(ctx->node, ob, DEG_OB_COMP_TRANSFORM, "Line Art Modifier");
}
@@ -239,15 +246,11 @@ static void updateDepsgraph(GpencilModifierData *md,
DEG_add_object_relation(ctx->node, ctx->object, DEG_OB_COMP_TRANSFORM, "Line Art Modifier");
LineartGpencilModifierData *lmd = (LineartGpencilModifierData *)md;
- if (lmd->source_type == LRT_SOURCE_OBJECT && lmd->source_object) {
- DEG_add_object_relation(
- ctx->node, lmd->source_object, DEG_OB_COMP_GEOMETRY, "Line Art Modifier");
- DEG_add_object_relation(
- ctx->node, lmd->source_object, DEG_OB_COMP_TRANSFORM, "Line Art Modifier");
- }
- else {
- add_this_collection(ctx->scene->master_collection, ctx, mode);
- }
+
+ /* Always add whole master collection because line art will need the whole scene for
+ * visibility computation. Line art exclusion is handled inside #add_this_collection. */
+ add_this_collection(ctx->scene->master_collection, ctx, mode);
+
if (lmd->calculation_flags & LRT_USE_CUSTOM_CAMERA && lmd->source_camera) {
DEG_add_object_relation(
ctx->node, lmd->source_camera, DEG_OB_COMP_TRANSFORM, "Line Art Modifier");
@@ -321,6 +324,10 @@ static void panel_draw(const bContext *UNUSED(C), Panel *panel)
uiItemPointerR(
row, ptr, "target_material", &obj_data_ptr, "materials", NULL, ICON_SHADING_TEXTURE);
+ uiLayout *col = uiLayoutColumn(layout, false);
+ uiItemR(col, ptr, "thickness", UI_ITEM_R_SLIDER, IFACE_("Line Thickness"), ICON_NONE);
+ uiItemR(col, ptr, "opacity", UI_ITEM_R_SLIDER, NULL, ICON_NONE);
+
gpencil_modifier_panel_end(layout, ptr);
}
@@ -349,7 +356,7 @@ static void edge_types_panel_draw(const bContext *UNUSED(C), Panel *panel)
uiLayout *sub = uiLayoutRowWithHeading(col, false, IFACE_("Crease"));
uiItemR(sub, ptr, "use_crease", 0, "", ICON_NONE);
uiLayout *entry = uiLayoutRow(sub, false);
- uiLayoutSetEnabled(entry, RNA_boolean_get(ptr, "use_crease") || is_first);
+ uiLayoutSetActive(entry, RNA_boolean_get(ptr, "use_crease") || is_first);
if (use_cache && !is_first) {
uiItemL(entry, IFACE_("Angle Cached"), ICON_INFO);
}
@@ -395,21 +402,6 @@ static void options_panel_draw(const bContext *UNUSED(C), Panel *panel)
uiItemR(col, ptr, "use_back_face_culling", 0, IFACE_("Force Backface Culling"), ICON_NONE);
}
-static void style_panel_draw(const bContext *UNUSED(C), Panel *panel)
-{
- uiLayout *layout = panel->layout;
- PointerRNA *ptr = gpencil_modifier_panel_get_property_pointers(panel, NULL);
-
- const bool is_baked = RNA_boolean_get(ptr, "is_baked");
-
- uiLayoutSetPropSep(layout, true);
- uiLayoutSetEnabled(layout, !is_baked);
-
- uiItemR(layout, ptr, "thickness", UI_ITEM_R_SLIDER, NULL, ICON_NONE);
-
- uiItemR(layout, ptr, "opacity", UI_ITEM_R_SLIDER, NULL, ICON_NONE);
-}
-
static void occlusion_panel_draw(const bContext *UNUSED(C), Panel *panel)
{
uiLayout *layout = panel->layout;
@@ -521,6 +513,7 @@ static void intersection_panel_draw(const bContext *UNUSED(C), Panel *panel)
uiItemR(layout, ptr, "use_intersection_match", 0, IFACE_("Exact Match"), ICON_NONE);
}
+
static void face_mark_panel_draw_header(const bContext *UNUSED(C), Panel *panel)
{
uiLayout *layout = panel->layout;
@@ -704,8 +697,6 @@ static void panelRegister(ARegionType *region_type)
region_type, "edge_types", "Edge Types", NULL, edge_types_panel_draw, panel_type);
gpencil_modifier_subpanel_register(
region_type, "geometry", "Geometry Processing", NULL, options_panel_draw, panel_type);
- gpencil_modifier_subpanel_register(
- region_type, "style", "Style", NULL, style_panel_draw, panel_type);
PanelType *occlusion_panel = gpencil_modifier_subpanel_register(
region_type, "occlusion", "Occlusion", NULL, occlusion_panel_draw, panel_type);
gpencil_modifier_subpanel_register(region_type,