Changeset View
Changeset View
Standalone View
Standalone View
source/blender/makesrna/intern/rna_sculpt_paint.c
| /* SPDX-License-Identifier: GPL-2.0-or-later */ | /* SPDX-License-Identifier: GPL-2.0-or-later */ | ||||
| /** \file | /** \file | ||||
| * \ingroup RNA | * \ingroup RNA | ||||
| */ | */ | ||||
| #include <stdlib.h> | #include <stdlib.h> | ||||
| #include "BLI_math.h" | #include "BLI_math.h" | ||||
| #include "BLI_utildefines.h" | #include "BLI_utildefines.h" | ||||
| #include "RNA_access.h" | |||||
| #include "RNA_define.h" | #include "RNA_define.h" | ||||
| #include "RNA_enum_types.h" | #include "RNA_enum_types.h" | ||||
| #include "rna_internal.h" | #include "rna_internal.h" | ||||
| #include "DNA_ID.h" | #include "DNA_ID.h" | ||||
| #include "DNA_brush_types.h" | #include "DNA_brush_types.h" | ||||
| #include "DNA_gpencil_types.h" | #include "DNA_gpencil_types.h" | ||||
| #include "DNA_scene_types.h" | #include "DNA_scene_types.h" | ||||
| #include "DNA_screen_types.h" | #include "DNA_screen_types.h" | ||||
| #include "DNA_space_types.h" | #include "DNA_space_types.h" | ||||
| #include "BKE_brush.h" | #include "BKE_brush.h" | ||||
| #include "BKE_layer.h" | #include "BKE_layer.h" | ||||
| #include "BKE_material.h" | #include "BKE_material.h" | ||||
| #include "BKE_paint.h" | #include "BKE_paint.h" | ||||
| #include "ED_image.h" | #include "ED_image.h" | ||||
| #include "WM_api.h" | #include "WM_api.h" | ||||
| #include "WM_types.h" | #include "WM_types.h" | ||||
| #include "bmesh.h" | #include "bmesh.h" | ||||
| extern const EnumPropertyItem RNA_automasking_flags[]; | |||||
| const EnumPropertyItem rna_enum_particle_edit_hair_brush_items[] = { | const EnumPropertyItem rna_enum_particle_edit_hair_brush_items[] = { | ||||
| {PE_BRUSH_COMB, "COMB", 0, "Comb", "Comb hairs"}, | {PE_BRUSH_COMB, "COMB", 0, "Comb", "Comb hairs"}, | ||||
| {PE_BRUSH_SMOOTH, "SMOOTH", 0, "Smooth", "Smooth hairs"}, | {PE_BRUSH_SMOOTH, "SMOOTH", 0, "Smooth", "Smooth hairs"}, | ||||
| {PE_BRUSH_ADD, "ADD", 0, "Add", "Add hairs"}, | {PE_BRUSH_ADD, "ADD", 0, "Add", "Add hairs"}, | ||||
| {PE_BRUSH_LENGTH, "LENGTH", 0, "Length", "Make hairs longer or shorter"}, | {PE_BRUSH_LENGTH, "LENGTH", 0, "Length", "Make hairs longer or shorter"}, | ||||
| {PE_BRUSH_PUFF, "PUFF", 0, "Puff", "Make hairs stand up"}, | {PE_BRUSH_PUFF, "PUFF", 0, "Puff", "Make hairs stand up"}, | ||||
| {PE_BRUSH_CUT, "CUT", 0, "Cut", "Cut hairs"}, | {PE_BRUSH_CUT, "CUT", 0, "Cut", "Cut hairs"}, | ||||
| {PE_BRUSH_WEIGHT, "WEIGHT", 0, "Weight", "Weight hair particles"}, | {PE_BRUSH_WEIGHT, "WEIGHT", 0, "Weight", "Weight hair particles"}, | ||||
| ▲ Show 20 Lines • Show All 549 Lines • ▼ Show 20 Lines | static char *rna_GPencilSculptSettings_path(const PointerRNA *UNUSED(ptr)) | ||||
| return BLI_strdup("tool_settings.gpencil_sculpt"); | return BLI_strdup("tool_settings.gpencil_sculpt"); | ||||
| } | } | ||||
| static char *rna_GPencilSculptGuide_path(const PointerRNA *UNUSED(ptr)) | static char *rna_GPencilSculptGuide_path(const PointerRNA *UNUSED(ptr)) | ||||
| { | { | ||||
| return BLI_strdup("tool_settings.gpencil_sculpt.guide"); | return BLI_strdup("tool_settings.gpencil_sculpt.guide"); | ||||
| } | } | ||||
| static void rna_Sculpt_automasking_invert_cavity_set(PointerRNA *ptr, bool val) | |||||
| { | |||||
| Sculpt *sd = (Sculpt *)ptr->data; | |||||
| if (val) { | |||||
| sd->automasking_flags &= ~BRUSH_AUTOMASKING_CAVITY_NORMAL; | |||||
| sd->automasking_flags |= BRUSH_AUTOMASKING_CAVITY_INVERTED; | |||||
| } | |||||
| else { | |||||
| sd->automasking_flags &= ~BRUSH_AUTOMASKING_CAVITY_INVERTED; | |||||
| } | |||||
| } | |||||
| static void rna_Sculpt_automasking_cavity_set(PointerRNA *ptr, bool val) | |||||
| { | |||||
| Sculpt *sd = (Sculpt *)ptr->data; | |||||
| if (val) { | |||||
| sd->automasking_flags &= ~BRUSH_AUTOMASKING_CAVITY_INVERTED; | |||||
| sd->automasking_flags |= BRUSH_AUTOMASKING_CAVITY_NORMAL; | |||||
| } | |||||
| else { | |||||
| sd->automasking_flags &= ~BRUSH_AUTOMASKING_CAVITY_NORMAL; | |||||
| } | |||||
| } | |||||
| #else | #else | ||||
| static void rna_def_paint_curve(BlenderRNA *brna) | static void rna_def_paint_curve(BlenderRNA *brna) | ||||
| { | { | ||||
| StructRNA *srna; | StructRNA *srna; | ||||
| srna = RNA_def_struct(brna, "PaintCurve", "ID"); | srna = RNA_def_struct(brna, "PaintCurve", "ID"); | ||||
| RNA_def_struct_ui_text(srna, "Paint Curve", ""); | RNA_def_struct_ui_text(srna, "Paint Curve", ""); | ||||
| ▲ Show 20 Lines • Show All 269 Lines • ▼ Show 20 Lines | static void rna_def_sculpt(BlenderRNA *brna) | ||||
| RNA_def_property_boolean_sdna(prop, NULL, "flags", SCULPT_DYNTOPO_SMOOTH_SHADING); | RNA_def_property_boolean_sdna(prop, NULL, "flags", SCULPT_DYNTOPO_SMOOTH_SHADING); | ||||
| RNA_def_property_ui_text(prop, | RNA_def_property_ui_text(prop, | ||||
| "Smooth Shading", | "Smooth Shading", | ||||
| "Show faces in dynamic-topology mode with smooth " | "Show faces in dynamic-topology mode with smooth " | ||||
| "shading rather than flat shaded"); | "shading rather than flat shaded"); | ||||
| RNA_def_property_flag(prop, PROP_CONTEXT_UPDATE); | RNA_def_property_flag(prop, PROP_CONTEXT_UPDATE); | ||||
| RNA_def_property_update(prop, NC_OBJECT | ND_DRAW, "rna_Sculpt_update"); | RNA_def_property_update(prop, NC_OBJECT | ND_DRAW, "rna_Sculpt_update"); | ||||
| prop = RNA_def_property(srna, "use_automasking_topology", PROP_BOOLEAN, PROP_NONE); | const EnumPropertyItem *entry = RNA_automasking_flags; | ||||
| RNA_def_property_boolean_sdna(prop, NULL, "automasking_flags", BRUSH_AUTOMASKING_TOPOLOGY); | do { | ||||
| RNA_def_property_ui_text(prop, | prop = RNA_def_property(srna, entry->identifier, PROP_BOOLEAN, PROP_NONE); | ||||
| "Topology Auto-Masking", | RNA_def_property_boolean_sdna(prop, NULL, "automasking_flags", entry->value); | ||||
| "Affect only vertices connected to the active vertex under the brush"); | RNA_def_property_ui_text(prop, entry->name, entry->description); | ||||
| if (entry->value == BRUSH_AUTOMASKING_CAVITY_NORMAL) { | |||||
| RNA_def_property_boolean_funcs(prop, NULL, "rna_Sculpt_automasking_cavity_set"); | |||||
| } | |||||
| else if (entry->value == BRUSH_AUTOMASKING_CAVITY_INVERTED) { | |||||
| RNA_def_property_boolean_funcs(prop, NULL, "rna_Sculpt_automasking_invert_cavity_set"); | |||||
| } | |||||
| RNA_def_property_update(prop, NC_SCENE | ND_TOOLSETTINGS, NULL); | RNA_def_property_update(prop, NC_SCENE | ND_TOOLSETTINGS, NULL); | ||||
| } while ((++entry)->identifier); | |||||
| prop = RNA_def_property(srna, "use_automasking_face_sets", PROP_BOOLEAN, PROP_NONE); | prop = RNA_def_property(srna, "automasking_cavity_factor", PROP_FLOAT, PROP_NONE); | ||||
| RNA_def_property_boolean_sdna(prop, NULL, "automasking_flags", BRUSH_AUTOMASKING_FACE_SETS); | RNA_def_property_float_sdna(prop, NULL, "automasking_cavity_factor"); | ||||
| RNA_def_property_ui_text(prop, | RNA_def_property_ui_text(prop, "Cavity Factor", "The contrast of the cavity mask"); | ||||
| "Face Sets Auto-Masking", | RNA_def_property_ui_range(prop, 0.0f, 1.0f, 0.1, 3); | ||||
| "Affect only vertices that share Face Sets with the active vertex"); | RNA_def_property_range(prop, 0.0f, 5.0f); | ||||
| RNA_def_property_update(prop, NC_SCENE | ND_TOOLSETTINGS, NULL); | |||||
| prop = RNA_def_property(srna, "automasking_cavity_blur_steps", PROP_INT, PROP_NONE); | |||||
| RNA_def_property_int_sdna(prop, NULL, "automasking_cavity_blur_steps"); | |||||
| RNA_def_property_ui_text(prop, "Blur Steps", "The number of times the cavity mask is blurred"); | |||||
| RNA_def_property_range(prop, 0.0f, 25.0f); | |||||
| RNA_def_property_update(prop, NC_SCENE | ND_TOOLSETTINGS, NULL); | |||||
| prop = RNA_def_property(srna, "automasking_cavity_curve", PROP_POINTER, PROP_NONE); | |||||
| RNA_def_property_pointer_sdna(prop, NULL, "automasking_cavity_curve"); | |||||
| RNA_def_property_struct_type(prop, "CurveMapping"); | |||||
| RNA_def_property_ui_text(prop, "Cavity Curve", "Curve used for the sensitivity"); | |||||
| RNA_def_property_clear_flag(prop, PROP_ANIMATABLE); | |||||
| RNA_def_property_update(prop, NC_SCENE | ND_TOOLSETTINGS, NULL); | |||||
| prop = RNA_def_property(srna, "automasking_cavity_curve_op", PROP_POINTER, PROP_NONE); | |||||
| RNA_def_property_pointer_sdna(prop, NULL, "automasking_cavity_curve_op"); | |||||
| RNA_def_property_struct_type(prop, "CurveMapping"); | |||||
| RNA_def_property_ui_text(prop, "Cavity Curve", "Curve used for the sensitivity"); | |||||
| RNA_def_property_clear_flag(prop, PROP_ANIMATABLE); | |||||
| RNA_def_property_update(prop, NC_SCENE | ND_TOOLSETTINGS, NULL); | RNA_def_property_update(prop, NC_SCENE | ND_TOOLSETTINGS, NULL); | ||||
| prop = RNA_def_property(srna, "use_automasking_boundary_edges", PROP_BOOLEAN, PROP_NONE); | prop = RNA_def_property(srna, "use_automasking_start_normal", PROP_BOOLEAN, PROP_NONE); | ||||
| RNA_def_property_boolean_sdna(prop, NULL, "automasking_flags", BRUSH_AUTOMASKING_BOUNDARY_EDGES); | RNA_def_property_boolean_sdna(prop, NULL, "automasking_flags", BRUSH_AUTOMASKING_BRUSH_NORMAL); | ||||
| RNA_def_property_ui_text( | RNA_def_property_ui_text( | ||||
| prop, "Mesh Boundary Auto-Masking", "Do not affect non manifold boundary edges"); | prop, | ||||
| "Area Normal", | |||||
| "Affect only vertices with a similar normal to where the stroke starts"); | |||||
| RNA_def_property_update(prop, NC_SCENE | ND_TOOLSETTINGS, NULL); | RNA_def_property_update(prop, NC_SCENE | ND_TOOLSETTINGS, NULL); | ||||
| prop = RNA_def_property(srna, "use_automasking_boundary_face_sets", PROP_BOOLEAN, PROP_NONE); | prop = RNA_def_property(srna, "use_automasking_view_normal", PROP_BOOLEAN, PROP_NONE); | ||||
| RNA_def_property_boolean_sdna( | RNA_def_property_boolean_sdna(prop, NULL, "automasking_flags", BRUSH_AUTOMASKING_VIEW_NORMAL); | ||||
| prop, NULL, "automasking_flags", BRUSH_AUTOMASKING_BOUNDARY_FACE_SETS); | RNA_def_property_ui_text( | ||||
| RNA_def_property_ui_text(prop, | prop, "View Normal", "Affect only vertices with a normal that faces the viewer"); | ||||
| "Face Sets Boundary Auto-Masking", | RNA_def_property_update(prop, NC_SCENE | ND_TOOLSETTINGS, NULL); | ||||
| "Do not affect vertices that belong to a Face Set boundary"); | |||||
| prop = RNA_def_property(srna, "use_automasking_view_occlusion", PROP_BOOLEAN, PROP_NONE); | |||||
| RNA_def_property_boolean_sdna(prop, NULL, "automasking_flags", BRUSH_AUTOMASKING_VIEW_OCCLUSION); | |||||
| RNA_def_property_ui_text( | |||||
| prop, | |||||
| "Occlusion", | |||||
| "Only affect vertices that are not occluded by other faces. (Slower performance)"); | |||||
| RNA_def_property_update(prop, NC_SCENE | ND_TOOLSETTINGS, NULL); | |||||
| prop = RNA_def_property(srna, "automasking_start_normal_limit", PROP_FLOAT, PROP_ANGLE); | |||||
| RNA_def_property_float_sdna(prop, NULL, "automasking_start_normal_limit"); | |||||
| RNA_def_property_range(prop, 0.0001f, M_PI); | |||||
| RNA_def_property_ui_text(prop, "Area Normal Limit", "The range of angles that will be affected"); | |||||
| RNA_def_property_update(prop, NC_SCENE | ND_TOOLSETTINGS, NULL); | |||||
| prop = RNA_def_property(srna, "automasking_start_normal_falloff", PROP_FLOAT, PROP_FACTOR); | |||||
| RNA_def_property_float_sdna(prop, NULL, "automasking_start_normal_falloff"); | |||||
| RNA_def_property_range(prop, 0.0001f, 1.0f); | |||||
| RNA_def_property_ui_text( | |||||
| prop, "Area Normal Falloff", "Extend the angular range with a falloff gradient"); | |||||
| RNA_def_property_update(prop, NC_SCENE | ND_TOOLSETTINGS, NULL); | |||||
| prop = RNA_def_property(srna, "automasking_view_normal_limit", PROP_FLOAT, PROP_ANGLE); | |||||
| RNA_def_property_float_sdna(prop, NULL, "automasking_view_normal_limit"); | |||||
| RNA_def_property_range(prop, 0.0001f, M_PI); | |||||
| RNA_def_property_ui_text(prop, "View Normal Limit", "The range of angles that will be affected"); | |||||
| RNA_def_property_update(prop, NC_SCENE | ND_TOOLSETTINGS, NULL); | |||||
| prop = RNA_def_property(srna, "automasking_view_normal_falloff", PROP_FLOAT, PROP_FACTOR); | |||||
| RNA_def_property_float_sdna(prop, NULL, "automasking_view_normal_falloff"); | |||||
| RNA_def_property_range(prop, 0.0001f, 1.0f); | |||||
| RNA_def_property_ui_text( | |||||
| prop, "View Normal Falloff", "Extend the angular range with a falloff gradient"); | |||||
| RNA_def_property_update(prop, NC_SCENE | ND_TOOLSETTINGS, NULL); | RNA_def_property_update(prop, NC_SCENE | ND_TOOLSETTINGS, NULL); | ||||
| prop = RNA_def_property(srna, "symmetrize_direction", PROP_ENUM, PROP_NONE); | prop = RNA_def_property(srna, "symmetrize_direction", PROP_ENUM, PROP_NONE); | ||||
| RNA_def_property_enum_items(prop, rna_enum_symmetrize_direction_items); | RNA_def_property_enum_items(prop, rna_enum_symmetrize_direction_items); | ||||
| RNA_def_property_ui_text(prop, "Direction", "Source and destination for symmetrize operator"); | RNA_def_property_ui_text(prop, "Direction", "Source and destination for symmetrize operator"); | ||||
| prop = RNA_def_property(srna, "detail_refine_method", PROP_ENUM, PROP_NONE); | prop = RNA_def_property(srna, "detail_refine_method", PROP_ENUM, PROP_NONE); | ||||
| RNA_def_property_enum_bitflag_sdna(prop, NULL, "flags"); | RNA_def_property_enum_bitflag_sdna(prop, NULL, "flags"); | ||||
| ▲ Show 20 Lines • Show All 709 Lines • Show Last 20 Lines | |||||