Changeset View
Changeset View
Standalone View
Standalone View
source/blender/makesrna/intern/rna_brush.c
| Show First 20 Lines • Show All 73 Lines • ▼ Show 20 Lines | static const EnumPropertyItem sculpt_stroke_method_items[] = { | ||||
| {BRUSH_CURVE, | {BRUSH_CURVE, | ||||
| "CURVE", | "CURVE", | ||||
| 0, | 0, | ||||
| "Curve", | "Curve", | ||||
| "Define the stroke curve with a bezier curve (dabs are separated according to spacing)"}, | "Define the stroke curve with a bezier curve (dabs are separated according to spacing)"}, | ||||
| {0, NULL, 0, NULL, NULL}, | {0, NULL, 0, NULL, NULL}, | ||||
| }; | }; | ||||
| /* clang-format off */ | /* clang-format off */ | ||||
jbakker: Should start with `rna_enum_` but the rest of the patch seems fine. | |||||
| const EnumPropertyItem rna_enum_brush_sculpt_tool_items[] = { | const EnumPropertyItem rna_enum_brush_sculpt_tool_items[] = { | ||||
| {SCULPT_TOOL_DRAW, "DRAW", ICON_BRUSH_SCULPT_DRAW, "Draw", ""}, | {SCULPT_TOOL_DRAW, "DRAW", ICON_BRUSH_SCULPT_DRAW, "Draw", ""}, | ||||
| {SCULPT_TOOL_DRAW_SHARP, "DRAW_SHARP", ICON_BRUSH_SCULPT_DRAW, "Draw Sharp", ""}, | {SCULPT_TOOL_DRAW_SHARP, "DRAW_SHARP", ICON_BRUSH_SCULPT_DRAW, "Draw Sharp", ""}, | ||||
| {SCULPT_TOOL_CLAY, "CLAY", ICON_BRUSH_CLAY, "Clay", ""}, | {SCULPT_TOOL_CLAY, "CLAY", ICON_BRUSH_CLAY, "Clay", ""}, | ||||
| {SCULPT_TOOL_CLAY_STRIPS, "CLAY_STRIPS", ICON_BRUSH_CLAY_STRIPS, "Clay Strips", ""}, | {SCULPT_TOOL_CLAY_STRIPS, "CLAY_STRIPS", ICON_BRUSH_CLAY_STRIPS, "Clay Strips", ""}, | ||||
| {SCULPT_TOOL_CLAY_THUMB, "CLAY_THUMB", ICON_BRUSH_CLAY_STRIPS, "Clay Thumb", ""}, | {SCULPT_TOOL_CLAY_THUMB, "CLAY_THUMB", ICON_BRUSH_CLAY_STRIPS, "Clay Thumb", ""}, | ||||
| {SCULPT_TOOL_LAYER, "LAYER", ICON_BRUSH_LAYER, "Layer", ""}, | {SCULPT_TOOL_LAYER, "LAYER", ICON_BRUSH_LAYER, "Layer", ""}, | ||||
| {SCULPT_TOOL_INFLATE, "INFLATE", ICON_BRUSH_INFLATE, "Inflate", ""}, | {SCULPT_TOOL_INFLATE, "INFLATE", ICON_BRUSH_INFLATE, "Inflate", ""}, | ||||
| ▲ Show 20 Lines • Show All 919 Lines • ▼ Show 20 Lines | else { | ||||
| ToolSettings *ts = CTX_data_tool_settings(C); | ToolSettings *ts = CTX_data_tool_settings(C); | ||||
| brush->gpencil_settings->brush_draw_mode = GPENCIL_USE_VERTEX_COLOR(ts) ? | brush->gpencil_settings->brush_draw_mode = GPENCIL_USE_VERTEX_COLOR(ts) ? | ||||
| GP_BRUSH_MODE_VERTEXCOLOR : | GP_BRUSH_MODE_VERTEXCOLOR : | ||||
| GP_BRUSH_MODE_MATERIAL; | GP_BRUSH_MODE_MATERIAL; | ||||
| } | } | ||||
| } | } | ||||
| } | } | ||||
| #else | static const EnumPropertyItem *rna_BrushTextureSlot_map_mode_itemf(bContext *C, | ||||
| PointerRNA *UNUSED(ptr), | |||||
| static void rna_def_brush_texture_slot(BlenderRNA *brna) | PropertyRNA *UNUSED(prop), | ||||
| bool *UNUSED(r_free)) | |||||
| { | { | ||||
| StructRNA *srna; | static const EnumPropertyItem prop_default_items[] = { | ||||
| PropertyRNA *prop; | {0, NULL, 0, NULL, NULL}, | ||||
| }; | |||||
| static const EnumPropertyItem prop_map_mode_items[] = { | static const EnumPropertyItem prop_map_mode_items[] = { | ||||
| {MTEX_MAP_MODE_VIEW, "VIEW_PLANE", 0, "View Plane", ""}, | {MTEX_MAP_MODE_VIEW, "VIEW_PLANE", 0, "View Plane", ""}, | ||||
| {MTEX_MAP_MODE_AREA, "AREA_PLANE", 0, "Area Plane", ""}, | {MTEX_MAP_MODE_AREA, "AREA_PLANE", 0, "Area Plane", ""}, | ||||
Done Inline ActionsThis item is only valid for sculpt mode. you could add a itemf function based on the context but that might not be trival to add. Current solution to show it also when texture painting gives a false impression to the user. jbakker: This item is only valid for sculpt mode. you could add a `itemf` function based on the context… | |||||
| {MTEX_MAP_MODE_TILED, "TILED", 0, "Tiled", ""}, | {MTEX_MAP_MODE_TILED, "TILED", 0, "Tiled", ""}, | ||||
| {MTEX_MAP_MODE_3D, "3D", 0, "3D", ""}, | {MTEX_MAP_MODE_3D, "3D", 0, "3D", ""}, | ||||
| {MTEX_MAP_MODE_RANDOM, "RANDOM", 0, "Random", ""}, | {MTEX_MAP_MODE_RANDOM, "RANDOM", 0, "Random", ""}, | ||||
| {MTEX_MAP_MODE_STENCIL, "STENCIL", 0, "Stencil", ""}, | {MTEX_MAP_MODE_STENCIL, "STENCIL", 0, "Stencil", ""}, | ||||
| {0, NULL, 0, NULL, NULL}, | {0, NULL, 0, NULL, NULL}, | ||||
| }; | }; | ||||
| static const EnumPropertyItem prop_tex_paint_map_mode_items[] = { | static const EnumPropertyItem prop_tex_paint_map_mode_items[] = { | ||||
| {MTEX_MAP_MODE_VIEW, "VIEW_PLANE", 0, "View Plane", ""}, | {MTEX_MAP_MODE_VIEW, "VIEW_PLANE", 0, "View Plane", ""}, | ||||
| {MTEX_MAP_MODE_TILED, "TILED", 0, "Tiled", ""}, | {MTEX_MAP_MODE_TILED, "TILED", 0, "Tiled", ""}, | ||||
| {MTEX_MAP_MODE_3D, "3D", 0, "3D", ""}, | {MTEX_MAP_MODE_3D, "3D", 0, "3D", ""}, | ||||
| {MTEX_MAP_MODE_RANDOM, "RANDOM", 0, "Random", ""}, | {MTEX_MAP_MODE_RANDOM, "RANDOM", 0, "Random", ""}, | ||||
| {MTEX_MAP_MODE_STENCIL, "STENCIL", 0, "Stencil", ""}, | {MTEX_MAP_MODE_STENCIL, "STENCIL", 0, "Stencil", ""}, | ||||
| {0, NULL, 0, NULL, NULL}, | {0, NULL, 0, NULL, NULL}, | ||||
| }; | }; | ||||
| ePaintMode mode = BKE_paintmode_get_active_from_context(C); | |||||
| switch (mode) { | |||||
| case PAINT_MODE_SCULPT: | |||||
| return prop_map_mode_items; | |||||
| case PAINT_MODE_TEXTURE_2D: | |||||
| case PAINT_MODE_TEXTURE_3D: | |||||
| return prop_tex_paint_map_mode_items; | |||||
| default: | |||||
| return prop_default_items; | |||||
| } | |||||
| } | |||||
| #else | |||||
| static void rna_def_brush_texture_slot(BlenderRNA *brna) | |||||
| { | |||||
| StructRNA *srna; | |||||
| PropertyRNA *prop; | |||||
| static const EnumPropertyItem prop_map_mode_items[] = { | |||||
| {MTEX_MAP_MODE_VIEW, "VIEW_PLANE", 0, "View Plane", ""}, | |||||
Done Inline ActionsI am not sure about this ivpe: I am not sure about this | |||||
Done Inline ActionsYou're right. Only one needs to be available. You can always check how other itemf functions solve this. Eg render pass in the viewport popover. jbakker: You're right. Only one needs to be available. You can always check how other itemf functions… | |||||
| {MTEX_MAP_MODE_AREA, "AREA_PLANE", 0, "Area Plane", ""}, | |||||
| {MTEX_MAP_MODE_TILED, "TILED", 0, "Tiled", ""}, | |||||
| {MTEX_MAP_MODE_3D, "3D", 0, "3D", ""}, | |||||
| {MTEX_MAP_MODE_RANDOM, "RANDOM", 0, "Random", ""}, | |||||
| {MTEX_MAP_MODE_STENCIL, "STENCIL", 0, "Stencil", ""}, | |||||
| {0, NULL, 0, NULL, NULL}, | |||||
| }; | |||||
| static const EnumPropertyItem prop_mask_paint_map_mode_items[] = { | static const EnumPropertyItem prop_mask_paint_map_mode_items[] = { | ||||
| {MTEX_MAP_MODE_VIEW, "VIEW_PLANE", 0, "View Plane", ""}, | {MTEX_MAP_MODE_VIEW, "VIEW_PLANE", 0, "View Plane", ""}, | ||||
| {MTEX_MAP_MODE_TILED, "TILED", 0, "Tiled", ""}, | {MTEX_MAP_MODE_TILED, "TILED", 0, "Tiled", ""}, | ||||
| {MTEX_MAP_MODE_RANDOM, "RANDOM", 0, "Random", ""}, | {MTEX_MAP_MODE_RANDOM, "RANDOM", 0, "Random", ""}, | ||||
| {MTEX_MAP_MODE_STENCIL, "STENCIL", 0, "Stencil", ""}, | {MTEX_MAP_MODE_STENCIL, "STENCIL", 0, "Stencil", ""}, | ||||
| {0, NULL, 0, NULL, NULL}, | {0, NULL, 0, NULL, NULL}, | ||||
| }; | }; | ||||
| Show All 13 Lines | # define TEXTURE_CAPABILITY(prop_name_, ui_name_) \ | ||||
| RNA_def_property_range(prop, 0, M_PI * 2); | RNA_def_property_range(prop, 0, M_PI * 2); | ||||
| RNA_def_property_ui_text(prop, "Angle", "Brush texture rotation"); | RNA_def_property_ui_text(prop, "Angle", "Brush texture rotation"); | ||||
| RNA_def_property_flag(prop, PROP_CONTEXT_UPDATE); | RNA_def_property_flag(prop, PROP_CONTEXT_UPDATE); | ||||
| RNA_def_property_update(prop, 0, "rna_TextureSlot_brush_angle_update"); | RNA_def_property_update(prop, 0, "rna_TextureSlot_brush_angle_update"); | ||||
| prop = RNA_def_property(srna, "map_mode", PROP_ENUM, PROP_NONE); | prop = RNA_def_property(srna, "map_mode", PROP_ENUM, PROP_NONE); | ||||
| RNA_def_property_enum_sdna(prop, NULL, "brush_map_mode"); | RNA_def_property_enum_sdna(prop, NULL, "brush_map_mode"); | ||||
| RNA_def_property_enum_items(prop, prop_map_mode_items); | RNA_def_property_enum_items(prop, prop_map_mode_items); | ||||
| RNA_def_property_ui_text(prop, "Mode", ""); | RNA_def_property_enum_funcs(prop, NULL, NULL, "rna_BrushTextureSlot_map_mode_itemf"); | ||||
| RNA_def_property_flag(prop, PROP_CONTEXT_UPDATE); | |||||
| RNA_def_property_update(prop, 0, "rna_TextureSlot_update"); | |||||
| prop = RNA_def_property(srna, "tex_paint_map_mode", PROP_ENUM, PROP_NONE); | |||||
| RNA_def_property_enum_sdna(prop, NULL, "brush_map_mode"); | |||||
| RNA_def_property_enum_items(prop, prop_tex_paint_map_mode_items); | |||||
| RNA_def_property_ui_text(prop, "Mode", ""); | RNA_def_property_ui_text(prop, "Mode", ""); | ||||
| RNA_def_property_flag(prop, PROP_CONTEXT_UPDATE); | RNA_def_property_flag(prop, PROP_CONTEXT_UPDATE); | ||||
| RNA_def_property_update(prop, 0, "rna_TextureSlot_update"); | RNA_def_property_update(prop, 0, "rna_TextureSlot_update"); | ||||
| prop = RNA_def_property(srna, "mask_map_mode", PROP_ENUM, PROP_NONE); | prop = RNA_def_property(srna, "mask_map_mode", PROP_ENUM, PROP_NONE); | ||||
| RNA_def_property_enum_sdna(prop, NULL, "brush_map_mode"); | RNA_def_property_enum_sdna(prop, NULL, "brush_map_mode"); | ||||
| RNA_def_property_enum_items(prop, prop_mask_paint_map_mode_items); | RNA_def_property_enum_items(prop, prop_mask_paint_map_mode_items); | ||||
| RNA_def_property_ui_text(prop, "Mode", ""); | RNA_def_property_ui_text(prop, "Mode", "rna_BrushTextureSlot_map_mode_itemf"); | ||||
| RNA_def_property_flag(prop, PROP_CONTEXT_UPDATE); | RNA_def_property_flag(prop, PROP_CONTEXT_UPDATE); | ||||
| RNA_def_property_update(prop, 0, "rna_TextureSlot_update"); | RNA_def_property_update(prop, 0, "rna_TextureSlot_update"); | ||||
| prop = RNA_def_property(srna, "use_rake", PROP_BOOLEAN, PROP_NONE); | prop = RNA_def_property(srna, "use_rake", PROP_BOOLEAN, PROP_NONE); | ||||
| RNA_def_property_boolean_sdna(prop, NULL, "brush_angle_mode", MTEX_ANGLE_RAKE); | RNA_def_property_boolean_sdna(prop, NULL, "brush_angle_mode", MTEX_ANGLE_RAKE); | ||||
| RNA_def_property_ui_text(prop, "Rake", ""); | RNA_def_property_ui_text(prop, "Rake", ""); | ||||
| RNA_def_property_flag(prop, PROP_CONTEXT_UPDATE); | RNA_def_property_flag(prop, PROP_CONTEXT_UPDATE); | ||||
| RNA_def_property_update(prop, 0, "rna_TextureSlot_update"); | RNA_def_property_update(prop, 0, "rna_TextureSlot_update"); | ||||
| ▲ Show 20 Lines • Show All 2,394 Lines • Show Last 20 Lines | |||||
Should start with rna_enum_ but the rest of the patch seems fine.