Changeset View
Changeset View
Standalone View
Standalone View
source/blender/makesrna/intern/rna_dynamicpaint.c
| Show First 20 Lines • Show All 111 Lines • ▼ Show 20 Lines | |||||
| { | { | ||||
| DynamicPaintSurface *surface = (DynamicPaintSurface *)ptr->data; | DynamicPaintSurface *surface = (DynamicPaintSurface *)ptr->data; | ||||
| surface->init_layername[0] = '\0'; | surface->init_layername[0] = '\0'; | ||||
| dynamicPaint_clearSurface(scene, surface); | dynamicPaint_clearSurface(scene, surface); | ||||
| rna_DynamicPaint_redoModifier(bmain, scene, ptr); | rna_DynamicPaint_redoModifier(bmain, scene, ptr); | ||||
| } | } | ||||
| static void rna_DynamicPaintSurface_changePreview(Main *bmain, Scene *scene, PointerRNA *ptr) | |||||
| { | |||||
| DynamicPaintSurface *act_surface = (DynamicPaintSurface *)ptr->data; | |||||
| DynamicPaintSurface *surface = act_surface->canvas->surfaces.first; | |||||
| /* since only one color surface can show preview at time | |||||
| * disable preview on other surfaces. */ | |||||
| for (; surface; surface = surface->next) { | |||||
| if (surface != act_surface) | |||||
| surface->flags &= ~MOD_DPAINT_PREVIEW; | |||||
| } | |||||
| rna_DynamicPaint_redoModifier(bmain, scene, ptr); | |||||
| } | |||||
| static void rna_DynamicPaintSurface_uniqueName(Main *UNUSED(bmain), | static void rna_DynamicPaintSurface_uniqueName(Main *UNUSED(bmain), | ||||
| Scene *UNUSED(scene), | Scene *UNUSED(scene), | ||||
| PointerRNA *ptr) | PointerRNA *ptr) | ||||
| { | { | ||||
| dynamicPaintSurface_setUniqueName((DynamicPaintSurface *)ptr->data, | dynamicPaintSurface_setUniqueName((DynamicPaintSurface *)ptr->data, | ||||
| ((DynamicPaintSurface *)ptr->data)->name); | ((DynamicPaintSurface *)ptr->data)->name); | ||||
| } | } | ||||
| ▲ Show 20 Lines • Show All 92 Lines • ▼ Show 20 Lines | |||||
| /* is point cache used */ | /* is point cache used */ | ||||
| static bool rna_DynamicPaint_is_cache_user_get(PointerRNA *ptr) | static bool rna_DynamicPaint_is_cache_user_get(PointerRNA *ptr) | ||||
| { | { | ||||
| DynamicPaintSurface *surface = (DynamicPaintSurface *)ptr->data; | DynamicPaintSurface *surface = (DynamicPaintSurface *)ptr->data; | ||||
| return (surface->format != MOD_DPAINT_SURFACE_F_IMAGESEQ) ? 1 : 0; | return (surface->format != MOD_DPAINT_SURFACE_F_IMAGESEQ) ? 1 : 0; | ||||
| } | } | ||||
| /* is some 3D view preview available */ | |||||
| static bool rna_DynamicPaint_use_color_preview_get(PointerRNA *ptr) | |||||
| { | |||||
| DynamicPaintSurface *surface = (DynamicPaintSurface *)ptr->data; | |||||
| return dynamicPaint_surfaceHasColorPreview(surface); | |||||
| } | |||||
| /* does output layer exist*/ | /* does output layer exist*/ | ||||
| static bool rna_DynamicPaint_is_output_exists(DynamicPaintSurface *surface, Object *ob, int index) | static bool rna_DynamicPaint_is_output_exists(DynamicPaintSurface *surface, Object *ob, int index) | ||||
| { | { | ||||
| return dynamicPaint_outputLayerExists(surface, ob, index); | return dynamicPaint_outputLayerExists(surface, ob, index); | ||||
| } | } | ||||
| static const EnumPropertyItem *rna_DynamicPaint_surface_type_itemf(bContext *UNUSED(C), | static const EnumPropertyItem *rna_DynamicPaint_surface_type_itemf(bContext *UNUSED(C), | ||||
| PointerRNA *ptr, | PointerRNA *ptr, | ||||
| ▲ Show 20 Lines • Show All 91 Lines • ▼ Show 20 Lines | static void rna_def_canvas_surface(BlenderRNA *brna) | ||||
| }; | }; | ||||
| /* Surface type - generated dynamically based on surface format */ | /* Surface type - generated dynamically based on surface format */ | ||||
| static const EnumPropertyItem prop_dynamicpaint_surface_type[] = { | static const EnumPropertyItem prop_dynamicpaint_surface_type[] = { | ||||
| {MOD_DPAINT_SURFACE_T_PAINT, "PAINT", 0, "Paint", ""}, | {MOD_DPAINT_SURFACE_T_PAINT, "PAINT", 0, "Paint", ""}, | ||||
| {0, NULL, 0, NULL, NULL}, | {0, NULL, 0, NULL, NULL}, | ||||
| }; | }; | ||||
| /* Surface output preview. currently only paint has multiple outputs */ | |||||
| static const EnumPropertyItem prop_dynamicpaint_surface_preview[] = { | |||||
| {MOD_DPAINT_SURFACE_PREV_PAINT, "PAINT", 0, "Paint", ""}, | |||||
| {MOD_DPAINT_SURFACE_PREV_WETMAP, "WETMAP", 0, "Wetmap", ""}, | |||||
| {0, NULL, 0, NULL, NULL}, | |||||
| }; | |||||
| /* Initial color setting */ | /* Initial color setting */ | ||||
| static const EnumPropertyItem prop_dynamicpaint_init_color_type[] = { | static const EnumPropertyItem prop_dynamicpaint_init_color_type[] = { | ||||
| {MOD_DPAINT_INITIAL_NONE, "NONE", 0, "None", ""}, | {MOD_DPAINT_INITIAL_NONE, "NONE", 0, "None", ""}, | ||||
| {MOD_DPAINT_INITIAL_COLOR, "COLOR", ICON_COLOR, "Color", ""}, | {MOD_DPAINT_INITIAL_COLOR, "COLOR", ICON_COLOR, "Color", ""}, | ||||
| {MOD_DPAINT_INITIAL_TEXTURE, "TEXTURE", ICON_TEXTURE, "UV Texture", ""}, | {MOD_DPAINT_INITIAL_TEXTURE, "TEXTURE", ICON_TEXTURE, "UV Texture", ""}, | ||||
| {MOD_DPAINT_INITIAL_VERTEXCOLOR, "VERTEX_COLOR", ICON_GROUP_VCOL, "Vertex Color", ""}, | {MOD_DPAINT_INITIAL_VERTEXCOLOR, "VERTEX_COLOR", ICON_GROUP_VCOL, "Vertex Color", ""}, | ||||
| {0, NULL, 0, NULL, NULL}, | {0, NULL, 0, NULL, NULL}, | ||||
| }; | }; | ||||
| ▲ Show 20 Lines • Show All 44 Lines • ▼ Show 20 Lines | # endif | ||||
| RNA_def_property_ui_text(prop, "Surface Type", "Surface Type"); | RNA_def_property_ui_text(prop, "Surface Type", "Surface Type"); | ||||
| RNA_def_property_update(prop, NC_OBJECT | ND_MODIFIER, "rna_DynamicPaintSurface_changeType"); | RNA_def_property_update(prop, NC_OBJECT | ND_MODIFIER, "rna_DynamicPaintSurface_changeType"); | ||||
| prop = RNA_def_property(srna, "is_active", PROP_BOOLEAN, PROP_NONE); | prop = RNA_def_property(srna, "is_active", PROP_BOOLEAN, PROP_NONE); | ||||
| RNA_def_property_boolean_sdna(prop, NULL, "flags", MOD_DPAINT_ACTIVE); | RNA_def_property_boolean_sdna(prop, NULL, "flags", MOD_DPAINT_ACTIVE); | ||||
| RNA_def_property_ui_text(prop, "Is Active", "Toggle whether surface is processed or ignored"); | RNA_def_property_ui_text(prop, "Is Active", "Toggle whether surface is processed or ignored"); | ||||
| RNA_def_property_update(prop, NC_OBJECT | ND_MODIFIER, "rna_DynamicPaint_redoModifier"); | RNA_def_property_update(prop, NC_OBJECT | ND_MODIFIER, "rna_DynamicPaint_redoModifier"); | ||||
| prop = RNA_def_property(srna, "show_preview", PROP_BOOLEAN, PROP_NONE); | |||||
| RNA_def_property_boolean_sdna(prop, NULL, "flags", MOD_DPAINT_PREVIEW); | |||||
| RNA_def_property_ui_text(prop, "Show Preview", "Display surface preview in 3D-views"); | |||||
| RNA_def_property_update(prop, NC_OBJECT | ND_MODIFIER, "rna_DynamicPaintSurface_changePreview"); | |||||
| prop = RNA_def_property(srna, "name", PROP_STRING, PROP_NONE); | prop = RNA_def_property(srna, "name", PROP_STRING, PROP_NONE); | ||||
| RNA_def_property_ui_text(prop, "Name", "Surface name"); | RNA_def_property_ui_text(prop, "Name", "Surface name"); | ||||
| RNA_def_property_update(prop, NC_OBJECT, "rna_DynamicPaintSurface_uniqueName"); | RNA_def_property_update(prop, NC_OBJECT, "rna_DynamicPaintSurface_uniqueName"); | ||||
| RNA_def_struct_name_property(srna, prop); | RNA_def_struct_name_property(srna, prop); | ||||
| prop = RNA_def_property(srna, "brush_collection", PROP_POINTER, PROP_NONE); | prop = RNA_def_property(srna, "brush_collection", PROP_POINTER, PROP_NONE); | ||||
| RNA_def_property_struct_type(prop, "Collection"); | RNA_def_property_struct_type(prop, "Collection"); | ||||
| RNA_def_property_pointer_sdna(prop, NULL, "brush_group"); | RNA_def_property_pointer_sdna(prop, NULL, "brush_group"); | ||||
| ▲ Show 20 Lines • Show All 225 Lines • ▼ Show 20 Lines | # endif | ||||
| prop = RNA_def_property(srna, "output_name_b", PROP_STRING, PROP_NONE); | prop = RNA_def_property(srna, "output_name_b", PROP_STRING, PROP_NONE); | ||||
| RNA_def_property_string_sdna(prop, NULL, "output_name2"); | RNA_def_property_string_sdna(prop, NULL, "output_name2"); | ||||
| RNA_def_property_ui_text(prop, "Output Name", "Name used to save output from this surface"); | RNA_def_property_ui_text(prop, "Output Name", "Name used to save output from this surface"); | ||||
| prop = RNA_def_property(srna, "use_output_b", PROP_BOOLEAN, PROP_NONE); | prop = RNA_def_property(srna, "use_output_b", PROP_BOOLEAN, PROP_NONE); | ||||
| RNA_def_property_boolean_sdna(prop, NULL, "flags", MOD_DPAINT_OUT2); | RNA_def_property_boolean_sdna(prop, NULL, "flags", MOD_DPAINT_OUT2); | ||||
| RNA_def_property_ui_text(prop, "Use Output", "Save this output layer"); | RNA_def_property_ui_text(prop, "Use Output", "Save this output layer"); | ||||
| prop = RNA_def_property(srna, "preview_id", PROP_ENUM, PROP_NONE); | |||||
| RNA_def_property_clear_flag(prop, PROP_ANIMATABLE); | |||||
| RNA_def_property_enum_sdna(prop, NULL, "preview_id"); | |||||
| RNA_def_property_enum_items(prop, prop_dynamicpaint_surface_preview); | |||||
| RNA_def_property_ui_text(prop, "Preview", ""); | |||||
| RNA_def_property_update(prop, NC_OBJECT | ND_MODIFIER, "rna_DynamicPaint_redoModifier"); | |||||
| /* to check if output name exists */ | /* to check if output name exists */ | ||||
| func = RNA_def_function(srna, "output_exists", "rna_DynamicPaint_is_output_exists"); | func = RNA_def_function(srna, "output_exists", "rna_DynamicPaint_is_output_exists"); | ||||
| RNA_def_function_ui_description(func, "Checks if surface output layer of given name exists"); | RNA_def_function_ui_description(func, "Checks if surface output layer of given name exists"); | ||||
| parm = RNA_def_pointer(func, "object", "Object", "", ""); | parm = RNA_def_pointer(func, "object", "Object", "", ""); | ||||
| RNA_def_parameter_flags(parm, PROP_NEVER_NULL, PARM_REQUIRED); | RNA_def_parameter_flags(parm, PROP_NEVER_NULL, PARM_REQUIRED); | ||||
| parm = RNA_def_int(func, "index", 0, 0, 1, "Index", "", 0, 1); | parm = RNA_def_int(func, "index", 0, 0, 1, "Index", "", 0, 1); | ||||
| RNA_def_parameter_flags(parm, 0, PARM_REQUIRED); | RNA_def_parameter_flags(parm, 0, PARM_REQUIRED); | ||||
| /* return type */ | /* return type */ | ||||
| ▲ Show 20 Lines • Show All 77 Lines • ▼ Show 20 Lines | # endif | ||||
| RNA_def_property_struct_type(prop, "PointCache"); | RNA_def_property_struct_type(prop, "PointCache"); | ||||
| RNA_def_property_ui_text(prop, "Point Cache", ""); | RNA_def_property_ui_text(prop, "Point Cache", ""); | ||||
| /* is cache used */ | /* is cache used */ | ||||
| prop = RNA_def_property(srna, "is_cache_user", PROP_BOOLEAN, PROP_NONE); | prop = RNA_def_property(srna, "is_cache_user", PROP_BOOLEAN, PROP_NONE); | ||||
| RNA_def_property_boolean_funcs(prop, "rna_DynamicPaint_is_cache_user_get", NULL); | RNA_def_property_boolean_funcs(prop, "rna_DynamicPaint_is_cache_user_get", NULL); | ||||
| RNA_def_property_ui_text(prop, "Use Cache", ""); | RNA_def_property_ui_text(prop, "Use Cache", ""); | ||||
| RNA_def_property_clear_flag(prop, PROP_ANIMATABLE | PROP_EDITABLE); | RNA_def_property_clear_flag(prop, PROP_ANIMATABLE | PROP_EDITABLE); | ||||
| /* whether this surface has preview data for 3D view */ | |||||
| RNA_define_verify_sdna(false); | |||||
| prop = RNA_def_property(srna, "use_color_preview", PROP_BOOLEAN, PROP_NONE); | |||||
| RNA_def_property_boolean_funcs(prop, "rna_DynamicPaint_use_color_preview_get", NULL); | |||||
| RNA_def_property_ui_text( | |||||
| prop, "Use Color Preview", "Whether this surface has some color preview for 3D view"); | |||||
| RNA_def_property_clear_flag(prop, PROP_ANIMATABLE | PROP_EDITABLE); | |||||
| RNA_define_verify_sdna(true); | |||||
| } | } | ||||
| static void rna_def_dynamic_paint_canvas_settings(BlenderRNA *brna) | static void rna_def_dynamic_paint_canvas_settings(BlenderRNA *brna) | ||||
| { | { | ||||
| StructRNA *srna; | StructRNA *srna; | ||||
| PropertyRNA *prop; | PropertyRNA *prop; | ||||
| srna = RNA_def_struct(brna, "DynamicPaintCanvasSettings", NULL); | srna = RNA_def_struct(brna, "DynamicPaintCanvasSettings", NULL); | ||||
| ▲ Show 20 Lines • Show All 268 Lines • Show Last 20 Lines | |||||