diff options
Diffstat (limited to 'source/blender/makesrna/intern')
-rw-r--r-- | source/blender/makesrna/intern/CMakeLists.txt | 3 | ||||
-rw-r--r-- | source/blender/makesrna/intern/makesrna.c | 3 | ||||
-rw-r--r-- | source/blender/makesrna/intern/rna_ID.c | 1 | ||||
-rw-r--r-- | source/blender/makesrna/intern/rna_groom.c | 231 | ||||
-rw-r--r-- | source/blender/makesrna/intern/rna_hair.c | 231 | ||||
-rw-r--r-- | source/blender/makesrna/intern/rna_internal.h | 3 | ||||
-rw-r--r-- | source/blender/makesrna/intern/rna_main_api.c | 3 | ||||
-rw-r--r-- | source/blender/makesrna/intern/rna_mesh_sample.c | 73 | ||||
-rw-r--r-- | source/blender/makesrna/intern/rna_modifier.c | 39 | ||||
-rw-r--r-- | source/blender/makesrna/intern/rna_object.c | 2 | ||||
-rw-r--r-- | source/blender/makesrna/intern/rna_scene.c | 4 | ||||
-rw-r--r-- | source/blender/makesrna/intern/rna_sculpt_paint.c | 41 |
12 files changed, 634 insertions, 0 deletions
diff --git a/source/blender/makesrna/intern/CMakeLists.txt b/source/blender/makesrna/intern/CMakeLists.txt index 74c36c456b0..bac0ecd1e4d 100644 --- a/source/blender/makesrna/intern/CMakeLists.txt +++ b/source/blender/makesrna/intern/CMakeLists.txt @@ -51,7 +51,9 @@ set(DEFSRC rna_fcurve.c rna_fluidsim.c rna_gpencil.c + rna_groom.c rna_group.c + rna_hair.c rna_image.c rna_key.c rna_lamp.c @@ -62,6 +64,7 @@ set(DEFSRC rna_mask.c rna_material.c rna_mesh.c + rna_mesh_sample.c rna_meta.c rna_modifier.c rna_movieclip.c diff --git a/source/blender/makesrna/intern/makesrna.c b/source/blender/makesrna/intern/makesrna.c index 9745ca39872..ab1eaca52e4 100644 --- a/source/blender/makesrna/intern/makesrna.c +++ b/source/blender/makesrna/intern/makesrna.c @@ -3366,7 +3366,9 @@ static RNAProcessItem PROCESS_ITEMS[] = { {"rna_fcurve.c", "rna_fcurve_api.c", RNA_def_fcurve}, {"rna_fluidsim.c", NULL, RNA_def_fluidsim}, {"rna_gpencil.c", NULL, RNA_def_gpencil}, + {"rna_groom.c", NULL, RNA_def_groom}, {"rna_group.c", NULL, RNA_def_group}, + {"rna_hair.c", NULL, RNA_def_hair}, {"rna_image.c", "rna_image_api.c", RNA_def_image}, {"rna_key.c", NULL, RNA_def_key}, {"rna_lamp.c", NULL, RNA_def_lamp}, @@ -3376,6 +3378,7 @@ static RNAProcessItem PROCESS_ITEMS[] = { {"rna_main.c", "rna_main_api.c", RNA_def_main}, {"rna_material.c", "rna_material_api.c", RNA_def_material}, {"rna_mesh.c", "rna_mesh_api.c", RNA_def_mesh}, + {"rna_mesh_sample.c", NULL, RNA_def_mesh_sample}, {"rna_meta.c", "rna_meta_api.c", RNA_def_meta}, {"rna_modifier.c", NULL, RNA_def_modifier}, {"rna_nla.c", NULL, RNA_def_nla}, diff --git a/source/blender/makesrna/intern/rna_ID.c b/source/blender/makesrna/intern/rna_ID.c index 088b2b67af5..dd062ac5ace 100644 --- a/source/blender/makesrna/intern/rna_ID.c +++ b/source/blender/makesrna/intern/rna_ID.c @@ -198,6 +198,7 @@ StructRNA *ID_code_to_RNA_type(short idcode) case ID_CF: return &RNA_CacheFile; case ID_CU: return &RNA_Curve; case ID_GD: return &RNA_GreasePencil; + case ID_GM: return &RNA_Groom; case ID_GR: return &RNA_Group; case ID_IM: return &RNA_Image; case ID_KE: return &RNA_Key; diff --git a/source/blender/makesrna/intern/rna_groom.c b/source/blender/makesrna/intern/rna_groom.c new file mode 100644 index 00000000000..67c0b3a02dd --- /dev/null +++ b/source/blender/makesrna/intern/rna_groom.c @@ -0,0 +1,231 @@ +/* + * ***** BEGIN GPL LICENSE BLOCK ***** + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software Foundation, + * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + * The Original Code is Copyright (C) Blender Foundation + * All rights reserved. + * + * The Original Code is: all of this file. + * + * Contributor(s): Lukas Toenne + * + * ***** END GPL LICENSE BLOCK ***** + */ + +/** \file blender/makesrna/intern/rna_groom.c + * \ingroup RNA + */ + +#include <stdlib.h> + +#include "DNA_groom_types.h" +#include "DNA_scene_types.h" + +#include "MEM_guardedalloc.h" + +#include "BLI_string_utils.h" +#include "BLI_utildefines.h" + +#include "BLT_translation.h" + +#include "RNA_access.h" +#include "RNA_define.h" + +#include "rna_internal.h" + +#include "WM_types.h" +#include "DNA_object_types.h" + + +#ifdef RNA_RUNTIME + +#include "BLI_listbase.h" +#include "BLI_math.h" + +#include "WM_api.h" + +#include "BKE_groom.h" +#include "BKE_object_facemap.h" + +#include "DEG_depsgraph.h" + +static void UNUSED_FUNCTION(rna_Groom_update)(Main *UNUSED(bmain), Scene *UNUSED(scene), PointerRNA *UNUSED(ptr)) +{ + WM_main_add_notifier(NC_GROOM | NA_EDITED, NULL); +} + +static void rna_Groom_update_data(Main *UNUSED(bmain), Scene *UNUSED(scene), PointerRNA *ptr) +{ + DEG_id_tag_update(ptr->id.data, 0); + WM_main_add_notifier(NC_GROOM | ND_DATA, ptr->id.data); +} + +static int rna_GroomBundle_is_bound_get(PointerRNA *ptr) +{ + GroomBundle *bundle = (GroomBundle *)ptr->data; + return (bundle->scalp_region != NULL); +} + +static void rna_GroomBundle_scalp_facemap_name_set(PointerRNA *ptr, const char *value) +{ + Groom *groom = (Groom *)ptr->id.data; + GroomBundle *bundle = (GroomBundle *)ptr->data; + + if (groom->scalp_object) + { + bFaceMap *fm = BKE_object_facemap_find_name(groom->scalp_object, value); + if (fm) { + /* no need for BLI_strncpy_utf8, since this matches an existing facemap */ + BLI_strncpy(bundle->scalp_facemap_name, value, sizeof(bundle->scalp_facemap_name)); + return; + } + } + + bundle->scalp_facemap_name[0] = '\0'; +} + +static PointerRNA rna_Groom_active_bundle_get(PointerRNA *ptr) +{ + Groom *groom = (Groom *)ptr->id.data; + PointerRNA r_ptr; + RNA_pointer_create(&groom->id, &RNA_GroomBundle, BLI_findlink(&groom->bundles, groom->active_bundle), &r_ptr); + return r_ptr; +} + +static int rna_Groom_active_bundle_index_get(PointerRNA *ptr) +{ + Groom *groom = (Groom *)ptr->id.data; + return groom->active_bundle; +} + +static void rna_Groom_active_bundle_index_set(PointerRNA *ptr, int value) +{ + Groom *groom = (Groom *)ptr->id.data; + groom->active_bundle = value; +} + +static void rna_Groom_active_bundle_index_range( + PointerRNA *ptr, + int *min, + int *max, + int *UNUSED(softmin), + int *UNUSED(softmax)) +{ + Groom *groom = (Groom *)ptr->id.data; + *min = 0; + *max = max_ii(0, BLI_listbase_count(&groom->bundles) - 1); +} + +#else + +static void rna_def_groom_bundle(BlenderRNA *brna) +{ + StructRNA *srna; + PropertyRNA *prop; + + srna = RNA_def_struct(brna, "GroomBundle", NULL); + RNA_def_struct_sdna(srna, "GroomBundle"); + RNA_def_struct_ui_text(srna, "Groom Bundle", "Bundle of hair originating from a scalp region"); + + prop = RNA_def_property(srna, "is_bound", PROP_BOOLEAN, PROP_NONE); + RNA_def_property_boolean_funcs(prop, "rna_GroomBundle_is_bound_get", NULL); + RNA_def_property_clear_flag(prop, PROP_EDITABLE); + RNA_def_property_ui_text(prop, "Bound", "Bundle was successfully bound to a scalp region"); + RNA_def_property_update(prop, NC_GROOM | ND_DRAW, NULL); + + prop = RNA_def_property(srna, "scalp_facemap", PROP_STRING, PROP_NONE); + RNA_def_property_string_sdna(prop, NULL, "scalp_facemap_name"); + RNA_def_property_ui_text(prop, "Scalp Vertex Group", "Face map name of the scalp region"); + RNA_def_property_string_funcs(prop, NULL, NULL, "rna_GroomBundle_scalp_facemap_name_set"); + RNA_def_property_update(prop, 0, "rna_Groom_update_data"); +} + +/* groom.bundles */ +static void rna_def_groom_bundles(BlenderRNA *brna, PropertyRNA *cprop) +{ + StructRNA *srna; + PropertyRNA *prop; + + RNA_def_property_srna(cprop, "GroomBundles"); + srna = RNA_def_struct(brna, "GroomBundles", NULL); + RNA_def_struct_sdna(srna, "Groom"); + RNA_def_struct_ui_text(srna, "Groom Bundles", "Collection of groom bundles"); + + prop = RNA_def_property(srna, "active", PROP_POINTER, PROP_NONE); + RNA_def_property_struct_type(prop, "GroomBundle"); + RNA_def_property_pointer_funcs(prop, "rna_Groom_active_bundle_get", NULL, NULL, NULL); + RNA_def_property_ui_text(prop, "Active Groom Bundle", "Active groom bundle being displayed"); + RNA_def_property_update(prop, NC_GROOM | ND_DRAW, NULL); + + prop = RNA_def_property(srna, "active_index", PROP_INT, PROP_UNSIGNED); + RNA_def_property_clear_flag(prop, PROP_ANIMATABLE); + RNA_def_property_int_funcs(prop, "rna_Groom_active_bundle_index_get", + "rna_Groom_active_bundle_index_set", + "rna_Groom_active_bundle_index_range"); + RNA_def_property_ui_text(prop, "Active Groom Bundle Index", "Index of active groom bundle"); + RNA_def_property_update(prop, NC_GROOM | ND_DRAW, NULL); +} + +static void rna_def_groom(BlenderRNA *brna) +{ + StructRNA *srna; + PropertyRNA *prop; + + srna = RNA_def_struct(brna, "Groom", "ID"); + RNA_def_struct_sdna(srna, "Groom"); + RNA_def_struct_ui_text(srna, "Groom", "Guide curve geometry for hair"); + RNA_def_struct_ui_icon(srna, ICON_NONE); + + /* Animation Data */ + rna_def_animdata_common(srna); + + prop = RNA_def_property(srna, "bundles", PROP_COLLECTION, PROP_NONE); + RNA_def_property_collection_sdna(prop, NULL, "bundles", NULL); + RNA_def_property_struct_type(prop, "GroomBundle"); + RNA_def_property_ui_text(prop, "Bundles", "Bundles of hair"); + rna_def_groom_bundles(brna, prop); + + prop = RNA_def_property(srna, "curve_resolution", PROP_INT, PROP_NONE); + RNA_def_property_int_sdna(prop, NULL, "curve_res"); + RNA_def_property_range(prop, 1, 1024); + RNA_def_property_ui_range(prop, 1, 64, 1, -1); + RNA_def_property_ui_text(prop, "Curve Resolution", "Curve subdivisions per segment"); + RNA_def_property_update(prop, 0, "rna_Groom_update_data"); + + prop = RNA_def_property(srna, "hair_system", PROP_POINTER, PROP_NONE); + RNA_def_property_ui_text(prop, "Hair", "Hair data"); + RNA_def_property_clear_flag(prop, PROP_EDITABLE); + + prop = RNA_def_property(srna, "hair_draw_settings", PROP_POINTER, PROP_NONE); + RNA_def_property_ui_text(prop, "Hair Draw Settings", "Hair draw settings"); + RNA_def_property_clear_flag(prop, PROP_EDITABLE); + + prop = RNA_def_property(srna, "scalp_object", PROP_POINTER, PROP_NONE); + RNA_def_property_pointer_sdna(prop, NULL, "scalp_object"); + RNA_def_property_ui_text(prop, "Scalp Object", "Surface for attaching hairs"); + RNA_def_property_flag(prop, PROP_EDITABLE); + RNA_def_property_update(prop, 0, "rna_Groom_update_data"); + + UNUSED_VARS(prop); +} + +void RNA_def_groom(BlenderRNA *brna) +{ + rna_def_groom(brna); + rna_def_groom_bundle(brna); +} + +#endif diff --git a/source/blender/makesrna/intern/rna_hair.c b/source/blender/makesrna/intern/rna_hair.c new file mode 100644 index 00000000000..079ce5c6a07 --- /dev/null +++ b/source/blender/makesrna/intern/rna_hair.c @@ -0,0 +1,231 @@ +/* + * ***** BEGIN GPL LICENSE BLOCK ***** + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software Foundation, + * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + * Contributor(s): Blender Foundation. + * + * ***** END GPL LICENSE BLOCK ***** + */ + +/** \file blender/makesrna/intern/rna_hair.c + * \ingroup RNA + */ + +#include <stdlib.h> + +#include "RNA_define.h" +#include "RNA_enum_types.h" + +#include "rna_internal.h" + +#include "DNA_hair_types.h" + +#include "WM_types.h" + +#ifdef RNA_RUNTIME + +#include "MEM_guardedalloc.h" + +#include "BLI_listbase.h" + +#include "DNA_object_types.h" + +#include "BKE_context.h" +#include "BKE_DerivedMesh.h" +#include "BKE_hair.h" +#include "BKE_main.h" +#include "BKE_material.h" + +#include "DEG_depsgraph.h" + +#include "RNA_access.h" + +#include "WM_api.h" +#include "WM_types.h" + +static void rna_HairSystem_update(Main *UNUSED(bmain), Scene *UNUSED(scene), PointerRNA *ptr) +{ + DEG_id_tag_update(ptr->id.data, OB_RECALC_DATA); +} + +static void rna_HairSystem_generate_follicles( + HairSystem *hsys, + struct bContext *C, + Object *scalp, + int seed, + int count) +{ + if (!scalp) + { + return; + } + + struct Scene *scene = CTX_data_scene(C); + EvaluationContext eval_ctx; + CTX_data_eval_ctx(C, &eval_ctx); + + CustomDataMask datamask = CD_MASK_BAREMESH; + DerivedMesh *dm = mesh_get_derived_final(&eval_ctx, scene, scalp, datamask); + + BKE_hair_generate_follicles(hsys, dm, (unsigned int)seed, count); +} + +static const EnumPropertyItem *rna_HairSystem_material_slot_itemf( + bContext *C, + PointerRNA *UNUSED(ptr), + PropertyRNA *UNUSED(prop), + bool *r_free) +{ + Object *ob = CTX_data_pointer_get(C, "object").data; + Material *ma; + EnumPropertyItem *item = NULL; + EnumPropertyItem tmp = {0, "", 0, "", ""}; + int totitem = 0; + int i; + + if (ob && ob->totcol > 0) { + for (i = 1; i <= ob->totcol; i++) { + ma = give_current_material(ob, i); + tmp.value = i; + tmp.icon = ICON_MATERIAL_DATA; + if (ma) { + tmp.name = ma->id.name + 2; + tmp.identifier = tmp.name; + } + else { + tmp.name = "Default Material"; + tmp.identifier = tmp.name; + } + RNA_enum_item_add(&item, &totitem, &tmp); + } + } + else { + tmp.value = 1; + tmp.icon = ICON_MATERIAL_DATA; + tmp.name = "Default Material"; + tmp.identifier = tmp.name; + RNA_enum_item_add(&item, &totitem, &tmp); + } + + RNA_enum_item_end(&item, &totitem); + *r_free = true; + + return item; +} + +#else + +static void rna_def_hair_follicle(BlenderRNA *brna) +{ + StructRNA *srna; + PropertyRNA *prop; + + srna = RNA_def_struct(brna, "HairFollicle", NULL); + RNA_def_struct_ui_text(srna, "Hair Follicle", "Single follicle on a surface"); + RNA_def_struct_sdna(srna, "HairFollicle"); + + prop = RNA_def_property(srna, "mesh_sample", PROP_POINTER, PROP_NONE); + RNA_def_property_struct_type(prop, "MeshSample"); +} + +static void rna_def_hair_pattern(BlenderRNA *brna) +{ + StructRNA *srna; + PropertyRNA *prop; + + srna = RNA_def_struct(brna, "HairPattern", NULL); + RNA_def_struct_ui_text(srna, "Hair Pattern", "Set of hair follicles distributed on a surface"); + RNA_def_struct_sdna(srna, "HairPattern"); + RNA_def_struct_ui_icon(srna, ICON_STRANDS); + + prop = RNA_def_property(srna, "follicles", PROP_COLLECTION, PROP_NONE); + RNA_def_property_collection_sdna(prop, NULL, "follicles", "num_follicles"); + RNA_def_property_struct_type(prop, "HairFollicle"); + RNA_def_property_ui_text(prop, "Follicles", "Hair fiber follicles"); +} + +static void rna_def_hair_system(BlenderRNA *brna) +{ + StructRNA *srna; + FunctionRNA *func; + PropertyRNA *prop, *parm; + + static const EnumPropertyItem material_slot_items[] = { + {0, "DUMMY", 0, "Dummy", ""}, + {0, NULL, 0, NULL, NULL} + }; + + srna = RNA_def_struct(brna, "HairSystem", NULL); + RNA_def_struct_ui_text(srna, "Hair System", "Hair rendering and deformation data"); + RNA_def_struct_sdna(srna, "HairSystem"); + RNA_def_struct_ui_icon(srna, ICON_STRANDS); + + prop = RNA_def_property(srna, "pattern", PROP_POINTER, PROP_NONE); + RNA_def_property_struct_type(prop, "HairPattern"); + RNA_def_property_ui_text(prop, "Pattern", "Hair pattern"); + + prop = RNA_def_property(srna, "material_index", PROP_INT, PROP_NONE); + RNA_def_property_int_sdna(prop, NULL, "material_index"); + RNA_def_property_range(prop, 1, 32767); + RNA_def_property_ui_text(prop, "Material Index", "Index of material slot used for rendering hair fibers"); + RNA_def_property_update(prop, 0, "rna_HairSystem_update"); + + prop = RNA_def_property(srna, "material_slot", PROP_ENUM, PROP_NONE); + RNA_def_property_enum_sdna(prop, NULL, "material_index"); + RNA_def_property_enum_items(prop, material_slot_items); + RNA_def_property_enum_funcs(prop, NULL, NULL, "rna_HairSystem_material_slot_itemf"); + RNA_def_property_ui_text(prop, "Material Slot", "Material slot used for rendering particles"); + RNA_def_property_update(prop, 0, "rna_HairSystem_update"); + + func = RNA_def_function(srna, "generate_follicles", "rna_HairSystem_generate_follicles"); + RNA_def_function_flag(func, FUNC_USE_CONTEXT); + parm = RNA_def_pointer(func, "scalp", "Object", "Scalp", "Scalp object on which to place hair follicles"); + RNA_def_parameter_flags(parm, 0, PARM_REQUIRED); + parm = RNA_def_int(func, "seed", 0, 0, INT_MAX, "Seed", "Seed value for random numbers", 0, INT_MAX); + parm = RNA_def_int(func, "count", 0, 0, INT_MAX, "Count", "Maximum number of follicles to generate", 1, 1e5); + RNA_def_parameter_flags(parm, 0, PARM_REQUIRED); +} + +static void rna_def_hair_draw_settings(BlenderRNA *brna) +{ + StructRNA *srna; + PropertyRNA *prop; + + static const EnumPropertyItem follicle_mode_items[] = { + {HAIR_DRAW_FOLLICLE_NONE, "NONE", 0, "None", ""}, + {HAIR_DRAW_FOLLICLE_POINTS, "POINTS", 0, "Points", "Draw a point for each follicle"}, + {HAIR_DRAW_FOLLICLE_AXES, "AXES", 0, "Axes", "Draw direction of hair for each follicle"}, + {0, NULL, 0, NULL, NULL} + }; + + srna = RNA_def_struct(brna, "HairDrawSettings", NULL); + RNA_def_struct_ui_text(srna, "Hair Draw Settings", "Settings for drawing hair systems"); + RNA_def_struct_sdna(srna, "HairDrawSettings"); + + prop = RNA_def_property(srna, "follicle_mode", PROP_ENUM, PROP_NONE); + RNA_def_property_enum_items(prop, follicle_mode_items); + RNA_def_property_ui_text(prop, "Follicle Mode", "Draw follicles on the scalp surface"); +} + +void RNA_def_hair(BlenderRNA *brna) +{ + rna_def_hair_follicle(brna); + rna_def_hair_pattern(brna); + rna_def_hair_system(brna); + rna_def_hair_draw_settings(brna); +} + +#endif diff --git a/source/blender/makesrna/intern/rna_internal.h b/source/blender/makesrna/intern/rna_internal.h index c1f82bab300..8bc82e90999 100644 --- a/source/blender/makesrna/intern/rna_internal.h +++ b/source/blender/makesrna/intern/rna_internal.h @@ -153,6 +153,7 @@ void RNA_def_fluidsim(struct BlenderRNA *brna); void RNA_def_fcurve(struct BlenderRNA *brna); void RNA_def_gameproperty(struct BlenderRNA *brna); void RNA_def_gpencil(struct BlenderRNA *brna); +void RNA_def_groom(struct BlenderRNA *brna); void RNA_def_group(struct BlenderRNA *brna); void RNA_def_image(struct BlenderRNA *brna); void RNA_def_key(struct BlenderRNA *brna); @@ -162,6 +163,7 @@ void RNA_def_linestyle(struct BlenderRNA *brna); void RNA_def_main(struct BlenderRNA *brna); void RNA_def_material(struct BlenderRNA *brna); void RNA_def_mesh(struct BlenderRNA *brna); +void RNA_def_mesh_sample(struct BlenderRNA *brna); void RNA_def_meta(struct BlenderRNA *brna); void RNA_def_modifier(struct BlenderRNA *brna); void RNA_def_nla(struct BlenderRNA *brna); @@ -200,6 +202,7 @@ void RNA_def_world(struct BlenderRNA *brna); void RNA_def_movieclip(struct BlenderRNA *brna); void RNA_def_tracking(struct BlenderRNA *brna); void RNA_def_mask(struct BlenderRNA *brna); +void RNA_def_hair(struct BlenderRNA *brna); /* Common Define functions */ diff --git a/source/blender/makesrna/intern/rna_main_api.c b/source/blender/makesrna/intern/rna_main_api.c index 077dac262b6..42c8eceeb16 100644 --- a/source/blender/makesrna/intern/rna_main_api.c +++ b/source/blender/makesrna/intern/rna_main_api.c @@ -234,6 +234,9 @@ static Object *rna_Main_objects_new(Main *bmain, ReportList *reports, const char case ID_AR: type = OB_ARMATURE; break; + case ID_GM: + type = OB_GROOM; + break; default: { const char *idname; diff --git a/source/blender/makesrna/intern/rna_mesh_sample.c b/source/blender/makesrna/intern/rna_mesh_sample.c new file mode 100644 index 00000000000..05e22fc48a2 --- /dev/null +++ b/source/blender/makesrna/intern/rna_mesh_sample.c @@ -0,0 +1,73 @@ +/* + * ***** BEGIN GPL LICENSE BLOCK ***** + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software Foundation, + * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + * ***** END GPL LICENSE BLOCK ***** + */ + +/** \file blender/makesrna/intern/rna_mesh_sample.c + * \ingroup RNA + */ + +#include <stdlib.h> + +#include "MEM_guardedalloc.h" + +#include "DNA_meshdata_types.h" + +#include "BLI_utildefines.h" + +#include "BKE_mesh_sample.h" + +#include "RNA_access.h" +#include "RNA_define.h" +#include "RNA_types.h" + +#include "rna_internal.h" + +#include "WM_types.h" + + +#ifdef RNA_RUNTIME + +#include "WM_api.h" +#include "WM_types.h" + + + +#else + +static void rna_def_mesh_sample(BlenderRNA *brna) +{ + StructRNA *srna; + PropertyRNA *prop; + + srna = RNA_def_struct(brna, "MeshSample", NULL); + RNA_def_struct_sdna(srna, "MeshSample"); + RNA_def_struct_ui_text(srna, "Mesh Sample", "Point on a mesh that follows deformation"); + + prop = RNA_def_property(srna, "vertex_indices", PROP_INT, PROP_UNSIGNED); + RNA_def_property_int_sdna(prop, NULL, "orig_verts"); + RNA_def_property_clear_flag(prop, PROP_EDITABLE); + RNA_def_property_ui_text(prop, "Vertex Indices", "Index of the mesh vertices used for interpolation"); +} + +void RNA_def_mesh_sample(BlenderRNA *brna) +{ + rna_def_mesh_sample(brna); +} + +#endif diff --git a/source/blender/makesrna/intern/rna_modifier.c b/source/blender/makesrna/intern/rna_modifier.c index 99417ee7b1b..579c865e679 100644 --- a/source/blender/makesrna/intern/rna_modifier.c +++ b/source/blender/makesrna/intern/rna_modifier.c @@ -114,6 +114,7 @@ const EnumPropertyItem rna_enum_object_modifier_type_items[] = { {eModifierType_DynamicPaint, "DYNAMIC_PAINT", ICON_MOD_DYNAMICPAINT, "Dynamic Paint", ""}, {eModifierType_Explode, "EXPLODE", ICON_MOD_EXPLODE, "Explode", ""}, {eModifierType_Fluidsim, "FLUID_SIMULATION", ICON_MOD_FLUIDSIM, "Fluid Simulation", ""}, + {eModifierType_Fur, "FUR", ICON_STRANDS, "Fur", ""}, {eModifierType_Ocean, "OCEAN", ICON_MOD_OCEAN, "Ocean", ""}, {eModifierType_ParticleInstance, "PARTICLE_INSTANCE", ICON_MOD_PARTICLES, "Particle Instance", ""}, {eModifierType_ParticleSystem, "PARTICLE_SYSTEM", ICON_MOD_PARTICLES, "Particle System", ""}, @@ -413,6 +414,8 @@ static StructRNA *rna_Modifier_refine(struct PointerRNA *ptr) return &RNA_MeshSequenceCacheModifier; case eModifierType_SurfaceDeform: return &RNA_SurfaceDeformModifier; + case eModifierType_Fur: + return &RNA_FurModifier; /* Default */ case eModifierType_None: case eModifierType_ShapeKey: @@ -4806,6 +4809,41 @@ static void rna_def_modifier_surfacedeform(BlenderRNA *brna) RNA_def_property_clear_flag(prop, PROP_EDITABLE); } +static void rna_def_modifier_fur(BlenderRNA *brna) +{ + StructRNA *srna; + PropertyRNA *prop; + + srna = RNA_def_struct(brna, "FurModifier", "Modifier"); + RNA_def_struct_ui_text(srna, "Fur Modifier", ""); + RNA_def_struct_sdna(srna, "FurModifierData"); + RNA_def_struct_ui_icon(srna, ICON_STRANDS); + + prop = RNA_def_property(srna, "hair_system", PROP_POINTER, PROP_NONE); + RNA_def_property_ui_text(prop, "Hair", "Hair data"); + RNA_def_property_clear_flag(prop, PROP_EDITABLE); + + prop = RNA_def_property(srna, "follicle_seed", PROP_INT, PROP_NONE); + RNA_def_property_range(prop, 0, INT_MAX); + RNA_def_property_ui_text(prop, "Seed", "Follicle distribution random seed value"); + + prop = RNA_def_property(srna, "follicle_count", PROP_INT, PROP_NONE); + RNA_def_property_int_default(prop, 100000); + RNA_def_property_range(prop, 0, INT_MAX); + RNA_def_property_ui_range(prop, 1, 1e5, 1, 1); + RNA_def_property_ui_text(prop, "Follicle Count", "Maximum number of follicles"); + + prop = RNA_def_property(srna, "guides_count", PROP_INT, PROP_NONE); + RNA_def_property_int_default(prop, 1000); + RNA_def_property_range(prop, 0, INT_MAX); + RNA_def_property_ui_range(prop, 1, 1e3, 1, 1); + RNA_def_property_ui_text(prop, "Guides Count", "Maximum number of guide curves"); + + prop = RNA_def_property(srna, "draw_settings", PROP_POINTER, PROP_NONE); + RNA_def_property_ui_text(prop, "Draw Settings", "Hair draw settings"); + RNA_def_property_clear_flag(prop, PROP_EDITABLE); +} + void RNA_def_modifier(BlenderRNA *brna) { StructRNA *srna; @@ -4924,6 +4962,7 @@ void RNA_def_modifier(BlenderRNA *brna) rna_def_modifier_normaledit(brna); rna_def_modifier_meshseqcache(brna); rna_def_modifier_surfacedeform(brna); + rna_def_modifier_fur(brna); } #endif diff --git a/source/blender/makesrna/intern/rna_object.c b/source/blender/makesrna/intern/rna_object.c index 1932390d0fd..43001d6bd66 100644 --- a/source/blender/makesrna/intern/rna_object.c +++ b/source/blender/makesrna/intern/rna_object.c @@ -162,6 +162,7 @@ const EnumPropertyItem rna_enum_object_type_items[] = { {OB_LAMP, "LAMP", 0, "Lamp", ""}, {OB_SPEAKER, "SPEAKER", 0, "Speaker", ""}, {OB_LIGHTPROBE, "LIGHT_PROBE", 0, "Probe", ""}, + {OB_GROOM, "GROOM", 0, "Groom", ""}, {0, NULL, 0, NULL, NULL} }; @@ -407,6 +408,7 @@ static StructRNA *rna_Object_data_typef(PointerRNA *ptr) case OB_ARMATURE: return &RNA_Armature; case OB_SPEAKER: return &RNA_Speaker; case OB_LIGHTPROBE: return &RNA_LightProbe; + case OB_GROOM: return &RNA_Groom; default: return &RNA_ID; } } diff --git a/source/blender/makesrna/intern/rna_scene.c b/source/blender/makesrna/intern/rna_scene.c index 3c600f6e367..3782e694d73 100644 --- a/source/blender/makesrna/intern/rna_scene.c +++ b/source/blender/makesrna/intern/rna_scene.c @@ -2441,6 +2441,10 @@ static void rna_def_tool_settings(BlenderRNA *brna) RNA_def_property_pointer_sdna(prop, NULL, "particle"); RNA_def_property_ui_text(prop, "Particle Edit", ""); + prop = RNA_def_property(srna, "groom_edit_settings", PROP_POINTER, PROP_NONE); + RNA_def_property_struct_type(prop, "GroomEditSettings"); + RNA_def_property_ui_text(prop, "Groom Edit Settings", ""); + prop = RNA_def_property(srna, "use_uv_sculpt", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "use_uv_sculpt", 1); RNA_def_property_ui_text(prop, "UV Sculpt", "Enable brush for UV sculpting"); diff --git a/source/blender/makesrna/intern/rna_sculpt_paint.c b/source/blender/makesrna/intern/rna_sculpt_paint.c index 49edc742a4b..13833c86d9a 100644 --- a/source/blender/makesrna/intern/rna_sculpt_paint.c +++ b/source/blender/makesrna/intern/rna_sculpt_paint.c @@ -242,6 +242,23 @@ static char *rna_ParticleEdit_path(PointerRNA *UNUSED(ptr)) return BLI_strdup("tool_settings.particle_edit"); } +static char *rna_GroomEditSettings_path(PointerRNA *UNUSED(ptr)) +{ + return BLI_strdup("tool_settings.groom_edit_settings"); +} + +static void rna_GroomEditSettings_update(bContext *C, PointerRNA *UNUSED(ptr)) +{ + ViewLayer *view_layer = CTX_data_view_layer(C); + Object *ob = OBACT(view_layer); + + if (ob) + { + DEG_id_tag_update(&ob->id, OB_RECALC_DATA); + WM_event_add_notifier(C, NC_OBJECT | ND_DRAW, ob); + } +} + static int rna_Brush_mode_poll(PointerRNA *ptr, PointerRNA value) { Scene *scene = (Scene *)ptr->id.data; @@ -1052,6 +1069,29 @@ static void rna_def_particle_edit(BlenderRNA *brna) RNA_def_property_ui_text(prop, "Curve", ""); } +static void rna_def_groom_edit_settings(BlenderRNA *brna) +{ + StructRNA *srna; + PropertyRNA *prop; + + static const EnumPropertyItem mode_items[] = { + {GM_EDIT_MODE_REGIONS, "REGIONS", ICON_NONE, "Regions", "Region edit mode"}, + {GM_EDIT_MODE_CURVES, "CURVES", ICON_NONE, "Curves", "Curve edit mode"}, + {GM_EDIT_MODE_SECTIONS, "SECTIONS", ICON_NONE, "Sections", "Section edit mode"}, + {0, NULL, 0, NULL, NULL} + }; + + srna = RNA_def_struct(brna, "GroomEditSettings", NULL); + RNA_def_struct_path_func(srna, "rna_GroomEditSettings_path"); + RNA_def_struct_ui_text(srna, "Groom Edit", "Properties of groom editing mode"); + + prop = RNA_def_property(srna, "mode", PROP_ENUM, PROP_NONE); + RNA_def_property_enum_items(prop, mode_items); + RNA_def_property_ui_text(prop, "Mode", "Select mode"); + RNA_def_property_flag(prop, PROP_CONTEXT_UPDATE); + RNA_def_property_update(prop, NC_OBJECT | ND_DRAW, "rna_GroomEditSettings_update"); +} + static void rna_def_gpencil_sculpt(BlenderRNA *brna) { static const EnumPropertyItem prop_direction_items[] = { @@ -1165,6 +1205,7 @@ void RNA_def_sculpt_paint(BlenderRNA *brna) rna_def_vertex_paint(brna); rna_def_image_paint(brna); rna_def_particle_edit(brna); + rna_def_groom_edit_settings(brna); rna_def_gpencil_sculpt(brna); RNA_define_animate_sdna(true); } |