Changeset View
Changeset View
Standalone View
Standalone View
source/blender/gpencil_modifiers/intern/MOD_gpencillineart.c
| Show All 27 Lines | |||||
| #include "BLI_math_vector.h" | #include "BLI_math_vector.h" | ||||
| #include "BLT_translation.h" | #include "BLT_translation.h" | ||||
| #include "DNA_collection_types.h" | #include "DNA_collection_types.h" | ||||
| #include "DNA_defaults.h" | #include "DNA_defaults.h" | ||||
| #include "DNA_gpencil_modifier_types.h" | #include "DNA_gpencil_modifier_types.h" | ||||
| #include "DNA_gpencil_types.h" | #include "DNA_gpencil_types.h" | ||||
| #include "DNA_material_types.h" | |||||
| #include "DNA_object_types.h" | #include "DNA_object_types.h" | ||||
| #include "DNA_scene_types.h" | #include "DNA_scene_types.h" | ||||
| #include "DNA_screen_types.h" | #include "DNA_screen_types.h" | ||||
| #include "lineart/MOD_lineart.h" | #include "lineart/MOD_lineart.h" | ||||
| #include "BKE_collection.h" | #include "BKE_collection.h" | ||||
| #include "BKE_context.h" | #include "BKE_context.h" | ||||
| ▲ Show 20 Lines • Show All 226 Lines • ▼ Show 20 Lines | static void panel_draw(const bContext *UNUSED(C), Panel *panel) | ||||
| uiItemR(col, ptr, "use_crease", 0, IFACE_("Crease"), ICON_NONE); | uiItemR(col, ptr, "use_crease", 0, IFACE_("Crease"), ICON_NONE); | ||||
| uiLayout *sub = uiLayoutRow(col, true); | uiLayout *sub = uiLayoutRow(col, true); | ||||
| uiLayoutSetActive(sub, RNA_boolean_get(ptr, "use_crease")); | uiLayoutSetActive(sub, RNA_boolean_get(ptr, "use_crease")); | ||||
| uiLayoutSetPropSep(sub, true); | uiLayoutSetPropSep(sub, true); | ||||
| uiItemR(sub, ptr, "crease_threshold", UI_ITEM_R_SLIDER, " ", ICON_NONE); | uiItemR(sub, ptr, "crease_threshold", UI_ITEM_R_SLIDER, " ", ICON_NONE); | ||||
| uiItemPointerR(layout, ptr, "target_layer", &obj_data_ptr, "layers", NULL, ICON_GREASEPENCIL); | uiItemPointerR(layout, ptr, "target_layer", &obj_data_ptr, "layers", NULL, ICON_GREASEPENCIL); | ||||
| uiItemPointerR( | |||||
| layout, ptr, "target_material", &obj_data_ptr, "materials", NULL, ICON_SHADING_TEXTURE); | /* Material has to be used by grease pencil object already, it was possible to assign materials | ||||
| * without this requirement in earlier versions of blender. */ | |||||
| bool material_valid = false; | |||||
| PointerRNA material_ptr = RNA_pointer_get(ptr, "target_material"); | |||||
| if (!RNA_pointer_is_null(&material_ptr)) { | |||||
| Material *current_material = material_ptr.data; | |||||
zeddb: Shouldn't this be false?
So the check should actually be:
```
if (!RNA_pointer_is_null) {… | |||||
| Object *ob = ob_ptr.data; | |||||
| material_valid = BKE_gpencil_object_material_index_get(ob, current_material) != -1; | |||||
| } | |||||
| uiLayout *row = uiLayoutRow(layout, true); | |||||
| uiLayoutSetRedAlert(row, !material_valid); | |||||
| uiItemPointerR(row, | |||||
| ptr, | |||||
| "target_material", | |||||
| &obj_data_ptr, | |||||
| "materials", | |||||
| NULL, | |||||
| material_valid ? ICON_SHADING_TEXTURE : ICON_ERROR); | |||||
| uiItemR(layout, ptr, "use_remove_doubles", 0, NULL, ICON_NONE); | uiItemR(layout, ptr, "use_remove_doubles", 0, NULL, ICON_NONE); | ||||
| uiItemR(layout, ptr, "use_edge_overlap", 0, IFACE_("Overlapping Edges As Contour"), ICON_NONE); | uiItemR(layout, ptr, "use_edge_overlap", 0, IFACE_("Overlapping Edges As Contour"), ICON_NONE); | ||||
| uiItemR(layout, ptr, "use_object_instances", 0, NULL, ICON_NONE); | uiItemR(layout, ptr, "use_object_instances", 0, NULL, ICON_NONE); | ||||
| uiItemR(layout, ptr, "use_clip_plane_boundaries", 0, NULL, ICON_NONE); | uiItemR(layout, ptr, "use_clip_plane_boundaries", 0, NULL, ICON_NONE); | ||||
| gpencil_modifier_panel_end(layout, ptr); | gpencil_modifier_panel_end(layout, ptr); | ||||
| } | } | ||||
| ▲ Show 20 Lines • Show All 199 Lines • Show Last 20 Lines | |||||
Shouldn't this be false?
So the check should actually be:
if (!RNA_pointer_is_null) { Material *current_material = material_ptr.data; ...Right?
Because if the pointer is null, it is not a valid material?
(The lineart modifier is disabled in this case)
You have to select line style and material for the modifier to evaluate and generate lines currently.