Changeset View
Changeset View
Standalone View
Standalone View
source/blender/makesrna/intern/rna_sculpt_paint.c
| Show First 20 Lines • Show All 56 Lines • ▼ Show 20 Lines | static const EnumPropertyItem particle_edit_hair_brush_items[] = { | ||||
| {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"}, | ||||
| {0, NULL, 0, NULL, NULL} | {0, NULL, 0, NULL, NULL} | ||||
| }; | }; | ||||
| const EnumPropertyItem rna_enum_gpencil_sculpt_brush_items[] = { | const EnumPropertyItem rna_enum_gpencil_sculpt_brush_items[] = { | ||||
| {GP_EDITBRUSH_TYPE_SMOOTH, "SMOOTH", 0, "Smooth", "Smooth stroke points"}, | {GP_EDITBRUSH_TYPE_SMOOTH, "SMOOTH", ICON_GPBRUSH_SMOOTH, "Smooth", "Smooth stroke points"}, | ||||
| {GP_EDITBRUSH_TYPE_THICKNESS, "THICKNESS", 0, "Thickness", "Adjust thickness of strokes"}, | {GP_EDITBRUSH_TYPE_THICKNESS, "THICKNESS", ICON_GPBRUSH_THICKNESS, "Thickness", "Adjust thickness of strokes"}, | ||||
| { GP_EDITBRUSH_TYPE_STRENGTH, "STRENGTH", 0, "Strength", "Adjust color strength of strokes" }, | {GP_EDITBRUSH_TYPE_STRENGTH, "STRENGTH", ICON_GPBRUSH_STRENGTH, "Strength", "Adjust color strength of strokes" }, | ||||
| { GP_EDITBRUSH_TYPE_GRAB, "GRAB", 0, "Grab", "Translate the set of points initially within the brush circle" }, | {GP_EDITBRUSH_TYPE_GRAB, "GRAB", ICON_GPBRUSH_GRAB, "Grab", "Translate the set of points initially within the brush circle" }, | ||||
| {GP_EDITBRUSH_TYPE_PUSH, "PUSH", 0, "Push", "Move points out of the way, as if combing them"}, | {GP_EDITBRUSH_TYPE_PUSH, "PUSH", ICON_GPBRUSH_PUSH, "Push", "Move points out of the way, as if combing them"}, | ||||
| {GP_EDITBRUSH_TYPE_TWIST, "TWIST", 0, "Twist", "Rotate points around the midpoint of the brush"}, | {GP_EDITBRUSH_TYPE_TWIST, "TWIST", ICON_GPBRUSH_TWIST, "Twist", "Rotate points around the midpoint of the brush"}, | ||||
| {GP_EDITBRUSH_TYPE_PINCH, "PINCH", 0, "Pinch", "Pull points towards the midpoint of the brush"}, | {GP_EDITBRUSH_TYPE_PINCH, "PINCH", ICON_GPBRUSH_PINCH, "Pinch", "Pull points towards the midpoint of the brush"}, | ||||
| {GP_EDITBRUSH_TYPE_RANDOMIZE, "RANDOMIZE", 0, "Randomize", "Introduce jitter/randomness into strokes"}, | {GP_EDITBRUSH_TYPE_RANDOMIZE, "RANDOMIZE", ICON_GPBRUSH_RANDOMIZE, "Randomize", "Introduce jitter/randomness into strokes"}, | ||||
| //{GP_EDITBRUSH_TYPE_SUBDIVIDE, "SUBDIVIDE", 0, "Subdivide", "Increase point density for higher resolution strokes when zoomed in"}, | {GP_EDITBRUSH_TYPE_CLONE, "CLONE", ICON_GPBRUSH_CLONE, "Clone", "Paste copies of the strokes stored on the clipboard"}, | ||||
| //{GP_EDITBRUSH_TYPE_SIMPLIFY, "SIMPLIFY", 0, "Simplify", "Reduce density of stroke points"}, | { 0, NULL, 0, NULL, NULL } | ||||
| {GP_EDITBRUSH_TYPE_CLONE, "CLONE", 0, "Clone", "Paste copies of the strokes stored on the clipboard"}, | }; | ||||
| EnumPropertyItem rna_enum_gpencil_weight_brush_items[] = { | |||||
| { GP_EDITBRUSH_TYPE_WEIGHT, "WEIGHT", ICON_GPBRUSH_WEIGHT, "Weight", "Weight Paint for Vertex Groups" }, | |||||
| { 0, NULL, 0, NULL, NULL } | { 0, NULL, 0, NULL, NULL } | ||||
| }; | }; | ||||
| #ifndef RNA_RUNTIME | #ifndef RNA_RUNTIME | ||||
| static const EnumPropertyItem rna_enum_gpencil_lockaxis_items[] = { | static const EnumPropertyItem rna_enum_gpencil_lockaxis_items[] = { | ||||
| { GP_LOCKAXIS_NONE, "GP_LOCKAXIS_NONE", 0, "None", "" }, | { GP_LOCKAXIS_NONE, "GP_LOCKAXIS_NONE", ICON_UNLOCKED, "None", "" }, | ||||
| { GP_LOCKAXIS_X, "GP_LOCKAXIS_X", 0, "X", "Project strokes to plane locked to X" }, | { GP_LOCKAXIS_X, "GP_LOCKAXIS_X", ICON_NDOF_DOM, "X", "Project strokes to plane locked to X" }, | ||||
| { GP_LOCKAXIS_Y, "GP_LOCKAXIS_Y", 0, "Y", "Project strokes to plane locked to Y" }, | { GP_LOCKAXIS_Y, "GP_LOCKAXIS_Y", ICON_NDOF_DOM, "Y", "Project strokes to plane locked to Y" }, | ||||
| { GP_LOCKAXIS_Z, "GP_LOCKAXIS_Z", 0, "Z", "Project strokes to plane locked to Z" }, | { GP_LOCKAXIS_Z, "GP_LOCKAXIS_Z", ICON_NDOF_DOM, "Z", "Project strokes to plane locked to Z" }, | ||||
| { 0, NULL, 0, NULL, NULL } | { 0, NULL, 0, NULL, NULL } | ||||
| }; | }; | ||||
| #endif | #endif | ||||
| const EnumPropertyItem rna_enum_symmetrize_direction_items[] = { | const EnumPropertyItem rna_enum_symmetrize_direction_items[] = { | ||||
| {BMO_SYMMETRIZE_NEGATIVE_X, "NEGATIVE_X", 0, "-X to +X", ""}, | {BMO_SYMMETRIZE_NEGATIVE_X, "NEGATIVE_X", 0, "-X to +X", ""}, | ||||
| {BMO_SYMMETRIZE_POSITIVE_X, "POSITIVE_X", 0, "+X to -X", ""}, | {BMO_SYMMETRIZE_POSITIVE_X, "POSITIVE_X", 0, "+X to -X", ""}, | ||||
| {BMO_SYMMETRIZE_NEGATIVE_Y, "NEGATIVE_Y", 0, "-Y to +Y", ""}, | {BMO_SYMMETRIZE_NEGATIVE_Y, "NEGATIVE_Y", 0, "-Y to +Y", ""}, | ||||
| {BMO_SYMMETRIZE_POSITIVE_Y, "POSITIVE_Y", 0, "+Y to -Y", ""}, | {BMO_SYMMETRIZE_POSITIVE_Y, "POSITIVE_Y", 0, "+Y to -Y", ""}, | ||||
| {BMO_SYMMETRIZE_NEGATIVE_Z, "NEGATIVE_Z", 0, "-Z to +Z", ""}, | {BMO_SYMMETRIZE_NEGATIVE_Z, "NEGATIVE_Z", 0, "-Z to +Z", ""}, | ||||
| {BMO_SYMMETRIZE_POSITIVE_Z, "POSITIVE_Z", 0, "+Z to -Z", ""}, | {BMO_SYMMETRIZE_POSITIVE_Z, "POSITIVE_Z", 0, "+Z to -Z", ""}, | ||||
| {0, NULL, 0, NULL, NULL}, | {0, NULL, 0, NULL, NULL}, | ||||
| }; | }; | ||||
| #ifdef RNA_RUNTIME | #ifdef RNA_RUNTIME | ||||
| #include "MEM_guardedalloc.h" | #include "MEM_guardedalloc.h" | ||||
| #include "BKE_context.h" | #include "BKE_context.h" | ||||
| #include "BKE_DerivedMesh.h" | #include "BKE_DerivedMesh.h" | ||||
| #include "BKE_pointcache.h" | #include "BKE_pointcache.h" | ||||
| #include "BKE_particle.h" | #include "BKE_particle.h" | ||||
| #include "BKE_pbvh.h" | #include "BKE_pbvh.h" | ||||
| #include "BKE_gpencil.h" | |||||
| #include "DEG_depsgraph.h" | #include "DEG_depsgraph.h" | ||||
| #include "GPU_buffers.h" | #include "GPU_buffers.h" | ||||
| #include "ED_particle.h" | #include "ED_particle.h" | ||||
| static void rna_GPencil_update(Main *UNUSED(bmain), Scene *UNUSED(scene), PointerRNA *UNUSED(ptr)) | static void rna_GPencil_update(Main *UNUSED(bmain), Scene *UNUSED(scene), PointerRNA *UNUSED(ptr)) | ||||
| { | { | ||||
| BKE_gpencil_batch_cache_alldirty(); | |||||
| WM_main_add_notifier(NC_GPENCIL | NA_EDITED, NULL); | WM_main_add_notifier(NC_GPENCIL | NA_EDITED, NULL); | ||||
| } | } | ||||
| static const EnumPropertyItem particle_edit_disconnected_hair_brush_items[] = { | static const EnumPropertyItem particle_edit_disconnected_hair_brush_items[] = { | ||||
| {PE_BRUSH_NONE, "NONE", 0, "None", "Don't use any brush"}, | {PE_BRUSH_NONE, "NONE", 0, "None", "Don't use any brush"}, | ||||
| {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_LENGTH, "LENGTH", 0, "Length", "Make hairs longer or shorter"}, | {PE_BRUSH_LENGTH, "LENGTH", 0, "Length", "Make hairs longer or shorter"}, | ||||
| ▲ Show 20 Lines • Show All 281 Lines • ▼ Show 20 Lines | static int rna_ImaPaint_detect_data(ImagePaintSettings *imapaint) | ||||
| return imapaint->missing_data == 0; | return imapaint->missing_data == 0; | ||||
| } | } | ||||
| static PointerRNA rna_GPencilSculptSettings_brush_get(PointerRNA *ptr) | static PointerRNA rna_GPencilSculptSettings_brush_get(PointerRNA *ptr) | ||||
| { | { | ||||
| GP_BrushEdit_Settings *gset = (GP_BrushEdit_Settings *)ptr->data; | GP_BrushEdit_Settings *gset = (GP_BrushEdit_Settings *)ptr->data; | ||||
| GP_EditBrush_Data *brush = NULL; | GP_EditBrush_Data *brush = NULL; | ||||
| if ((gset->brushtype >= 0) && (gset->brushtype < TOT_GP_EDITBRUSH_TYPES)) | if ((gset) && (gset->flag & GP_BRUSHEDIT_FLAG_WEIGHT_MODE)) { | ||||
| if ((gset->weighttype >= GP_EDITBRUSH_TYPE_WEIGHT) && (gset->weighttype < TOT_GP_EDITBRUSH_TYPES)) | |||||
| brush = &gset->brush[gset->weighttype]; | |||||
| } | |||||
| else { | |||||
| if ((gset->brushtype >= 0) && (gset->brushtype < GP_EDITBRUSH_TYPE_WEIGHT)) | |||||
| brush = &gset->brush[gset->brushtype]; | brush = &gset->brush[gset->brushtype]; | ||||
| } | |||||
| return rna_pointer_inherit_refine(ptr, &RNA_GPencilSculptBrush, brush); | return rna_pointer_inherit_refine(ptr, &RNA_GPencilSculptBrush, brush); | ||||
| } | } | ||||
| static char *rna_GPencilSculptSettings_path(PointerRNA *UNUSED(ptr)) | static char *rna_GPencilSculptSettings_path(PointerRNA *UNUSED(ptr)) | ||||
| { | { | ||||
| return BLI_strdup("tool_settings.gpencil_sculpt"); | return BLI_strdup("tool_settings.gpencil_sculpt"); | ||||
| } | } | ||||
| ▲ Show 20 Lines • Show All 614 Lines • ▼ Show 20 Lines | static void rna_def_gpencil_sculpt(BlenderRNA *brna) | ||||
| RNA_def_struct_sdna(srna, "GP_BrushEdit_Settings"); | RNA_def_struct_sdna(srna, "GP_BrushEdit_Settings"); | ||||
| RNA_def_struct_path_func(srna, "rna_GPencilSculptSettings_path"); | RNA_def_struct_path_func(srna, "rna_GPencilSculptSettings_path"); | ||||
| RNA_def_struct_ui_text(srna, "GPencil Sculpt Settings", "Properties for Grease Pencil stroke sculpting tool"); | RNA_def_struct_ui_text(srna, "GPencil Sculpt Settings", "Properties for Grease Pencil stroke sculpting tool"); | ||||
| prop = RNA_def_property(srna, "tool", PROP_ENUM, PROP_NONE); | prop = RNA_def_property(srna, "tool", PROP_ENUM, PROP_NONE); | ||||
| RNA_def_property_enum_sdna(prop, NULL, "brushtype"); | RNA_def_property_enum_sdna(prop, NULL, "brushtype"); | ||||
| RNA_def_property_enum_items(prop, rna_enum_gpencil_sculpt_brush_items); | RNA_def_property_enum_items(prop, rna_enum_gpencil_sculpt_brush_items); | ||||
| RNA_def_property_ui_text(prop, "Tool", ""); | RNA_def_property_ui_text(prop, "Tool", ""); | ||||
| RNA_def_property_update(prop, NC_SCENE | ND_TOOLSETTINGS, NULL); | RNA_def_property_update(prop, NC_SCENE | ND_TOOLSETTINGS, "rna_GPencil_update"); | ||||
| prop = RNA_def_property(srna, "weight_tool", PROP_ENUM, PROP_NONE); | |||||
| RNA_def_property_enum_sdna(prop, NULL, "weighttype"); | |||||
| RNA_def_property_enum_items(prop, rna_enum_gpencil_weight_brush_items); | |||||
| RNA_def_property_ui_text(prop, "Tool", "Tool for weight painting"); | |||||
| RNA_def_property_update(prop, NC_SCENE | ND_TOOLSETTINGS, "rna_GPencil_update"); | |||||
| prop = RNA_def_property(srna, "brush", PROP_POINTER, PROP_NONE); | prop = RNA_def_property(srna, "brush", PROP_POINTER, PROP_NONE); | ||||
| RNA_def_property_struct_type(prop, "GPencilSculptBrush"); | RNA_def_property_struct_type(prop, "GPencilSculptBrush"); | ||||
| RNA_def_property_pointer_funcs(prop, "rna_GPencilSculptSettings_brush_get", NULL, NULL, NULL); | RNA_def_property_pointer_funcs(prop, "rna_GPencilSculptSettings_brush_get", NULL, NULL, NULL); | ||||
| RNA_def_property_ui_text(prop, "Brush", ""); | RNA_def_property_ui_text(prop, "Brush", ""); | ||||
| prop = RNA_def_property(srna, "use_select_mask", PROP_BOOLEAN, PROP_NONE); | prop = RNA_def_property(srna, "use_select_mask", PROP_BOOLEAN, PROP_NONE); | ||||
| RNA_def_property_boolean_sdna(prop, NULL, "flag", GP_BRUSHEDIT_FLAG_SELECT_MASK); | RNA_def_property_boolean_sdna(prop, NULL, "flag", GP_BRUSHEDIT_FLAG_SELECT_MASK); | ||||
| RNA_def_property_ui_text(prop, "Selection Mask", "Only sculpt selected stroke points"); | RNA_def_property_ui_text(prop, "Selection Mask", "Only sculpt selected stroke points"); | ||||
| ▲ Show 20 Lines • Show All 62 Lines • ▼ Show 20 Lines | static void rna_def_gpencil_sculpt(BlenderRNA *brna) | ||||
| RNA_def_property_ui_text(prop, "Affect Pressure", "Affect pressure values as well when smoothing strokes"); | RNA_def_property_ui_text(prop, "Affect Pressure", "Affect pressure values as well when smoothing strokes"); | ||||
| 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, "direction", PROP_ENUM, PROP_NONE); | prop = RNA_def_property(srna, "direction", PROP_ENUM, PROP_NONE); | ||||
| RNA_def_property_enum_bitflag_sdna(prop, NULL, "flag"); | RNA_def_property_enum_bitflag_sdna(prop, NULL, "flag"); | ||||
| RNA_def_property_enum_items(prop, prop_direction_items); | RNA_def_property_enum_items(prop, prop_direction_items); | ||||
| RNA_def_property_ui_text(prop, "Direction", ""); | RNA_def_property_ui_text(prop, "Direction", ""); | ||||
| RNA_def_property_update(prop, NC_SCENE | ND_TOOLSETTINGS, NULL); | RNA_def_property_update(prop, NC_SCENE | ND_TOOLSETTINGS, NULL); | ||||
| /* Cursor Color */ | |||||
| static float default_1[3] = { 1.0f, 0.6f, 0.6f }; | |||||
| static float default_2[3] = { 0.6f, 0.6f, 1.0f }; | |||||
| prop = RNA_def_property(srna, "cursor_color_add", PROP_FLOAT, PROP_COLOR_GAMMA); | |||||
| RNA_def_property_float_sdna(prop, NULL, "curcolor_add"); | |||||
| RNA_def_property_array(prop, 3); | |||||
| RNA_def_property_range(prop, 0.0f, 1.0f); | |||||
| RNA_def_property_float_array_default(prop, default_1); | |||||
| RNA_def_property_ui_text(prop, "Cursor Add", "Color for the cursor for addition"); | |||||
| prop = RNA_def_property(srna, "cursor_color_sub", PROP_FLOAT, PROP_COLOR_GAMMA); | |||||
| RNA_def_property_float_sdna(prop, NULL, "curcolor_sub"); | |||||
| RNA_def_property_array(prop, 3); | |||||
| RNA_def_property_range(prop, 0.0f, 1.0f); | |||||
| RNA_def_property_float_array_default(prop, default_2); | |||||
| RNA_def_property_ui_text(prop, "Cursor Sub", "Color for the cursor for substration"); | |||||
| prop = RNA_def_property(srna, "use_cursor", PROP_BOOLEAN, PROP_NONE); | |||||
| RNA_def_property_boolean_sdna(prop, NULL, "flag", GP_EDITBRUSH_FLAG_ENABLE_CURSOR); | |||||
| RNA_def_property_boolean_default(prop, true); | |||||
| RNA_def_property_ui_text(prop, "Enable Cursor", "Enable cursor on screen"); | |||||
| } | } | ||||
| void RNA_def_sculpt_paint(BlenderRNA *brna) | void RNA_def_sculpt_paint(BlenderRNA *brna) | ||||
| { | { | ||||
| /* *** Non-Animated *** */ | /* *** Non-Animated *** */ | ||||
| RNA_define_animate_sdna(false); | RNA_define_animate_sdna(false); | ||||
| rna_def_paint_curve(brna); | rna_def_paint_curve(brna); | ||||
| rna_def_paint(brna); | rna_def_paint(brna); | ||||
| Show All 10 Lines | |||||