2 * ***** BEGIN GPL LICENSE BLOCK *****
4 * This program is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU General Public License
6 * as published by the Free Software Foundation; either version 2
7 * of the License, or (at your option) any later version.
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
14 * You should have received a copy of the GNU General Public License
15 * along with this program; if not, write to the Free Software Foundation,
16 * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
18 * Contributor(s): Blender Foundation (2008), Juho Veps‰l‰inen
20 * ***** END GPL LICENSE BLOCK *****
23 /** \file blender/makesrna/intern/rna_modifier.c
32 #include "RNA_define.h"
33 #include "RNA_enum_types.h"
35 #include "rna_internal.h"
37 #include "DNA_armature_types.h"
38 #include "DNA_mesh_types.h"
39 #include "DNA_modifier_types.h"
40 #include "DNA_object_types.h"
41 #include "DNA_object_force.h"
42 #include "DNA_scene_types.h"
44 #include "MEM_guardedalloc.h"
48 #include "BLF_translation.h"
50 #include "BKE_animsys.h"
51 #include "BKE_bmesh.h" /* For BevelModifierData */
52 #include "BKE_dynamicpaint.h"
53 #include "BKE_multires.h"
54 #include "BKE_smoke.h" /* For smokeModifier_free & smokeModifier_createType */
59 EnumPropertyItem modifier_type_items[] = {
60 {0, "", 0, N_("Modify"), ""},
61 {eModifierType_MeshCache, "MESH_CACHE", ICON_MOD_MESHDEFORM, "Mesh Cache", ""},
62 {eModifierType_UVProject, "UV_PROJECT", ICON_MOD_UVPROJECT, "UV Project", ""},
63 {eModifierType_UVWarp, "UV_WARP", ICON_MOD_UVPROJECT, "UV Warp", ""},
64 {eModifierType_WeightVGEdit, "VERTEX_WEIGHT_EDIT", ICON_MOD_VERTEX_WEIGHT, "Vertex Weight Edit", ""},
65 {eModifierType_WeightVGMix, "VERTEX_WEIGHT_MIX", ICON_MOD_VERTEX_WEIGHT, "Vertex Weight Mix", ""},
66 {eModifierType_WeightVGProximity, "VERTEX_WEIGHT_PROXIMITY", ICON_MOD_VERTEX_WEIGHT,
67 "Vertex Weight Proximity", ""},
68 {0, "", 0, N_("Generate"), ""},
69 {eModifierType_Array, "ARRAY", ICON_MOD_ARRAY, "Array", ""},
70 {eModifierType_Bevel, "BEVEL", ICON_MOD_BEVEL, "Bevel", ""},
71 {eModifierType_Boolean, "BOOLEAN", ICON_MOD_BOOLEAN, "Boolean", ""},
72 {eModifierType_Build, "BUILD", ICON_MOD_BUILD, "Build", ""},
73 {eModifierType_Decimate, "DECIMATE", ICON_MOD_DECIM, "Decimate", ""},
74 {eModifierType_EdgeSplit, "EDGE_SPLIT", ICON_MOD_EDGESPLIT, "Edge Split", ""},
75 {eModifierType_Mask, "MASK", ICON_MOD_MASK, "Mask", ""},
76 {eModifierType_Mirror, "MIRROR", ICON_MOD_MIRROR, "Mirror", ""},
77 {eModifierType_Multires, "MULTIRES", ICON_MOD_MULTIRES, "Multiresolution", ""},
78 {eModifierType_Remesh, "REMESH", ICON_MOD_REMESH, "Remesh", ""},
79 {eModifierType_Screw, "SCREW", ICON_MOD_SCREW, "Screw", ""},
80 {eModifierType_Skin, "SKIN", ICON_MOD_SKIN, "Skin", ""},
81 {eModifierType_Solidify, "SOLIDIFY", ICON_MOD_SOLIDIFY, "Solidify", ""},
82 {eModifierType_Subsurf, "SUBSURF", ICON_MOD_SUBSURF, "Subdivision Surface", ""},
83 {eModifierType_Triangulate, "TRIANGULATE", ICON_MOD_TRIANGULATE, "Triangulate", ""},
84 {0, "", 0, N_("Deform"), ""},
85 {eModifierType_Armature, "ARMATURE", ICON_MOD_ARMATURE, "Armature", ""},
86 {eModifierType_Cast, "CAST", ICON_MOD_CAST, "Cast", ""},
87 {eModifierType_Curve, "CURVE", ICON_MOD_CURVE, "Curve", ""},
88 {eModifierType_Displace, "DISPLACE", ICON_MOD_DISPLACE, "Displace", ""},
89 {eModifierType_Hook, "HOOK", ICON_HOOK, "Hook", ""},
90 {eModifierType_LaplacianSmooth, "LAPLACIANSMOOTH", ICON_MOD_SMOOTH, "Laplacian Smooth", ""},
91 {eModifierType_Lattice, "LATTICE", ICON_MOD_LATTICE, "Lattice", ""},
92 {eModifierType_MeshDeform, "MESH_DEFORM", ICON_MOD_MESHDEFORM, "Mesh Deform", ""},
93 {eModifierType_Shrinkwrap, "SHRINKWRAP", ICON_MOD_SHRINKWRAP, "Shrinkwrap", ""},
94 {eModifierType_SimpleDeform, "SIMPLE_DEFORM", ICON_MOD_SIMPLEDEFORM, "Simple Deform", ""},
95 {eModifierType_Smooth, "SMOOTH", ICON_MOD_SMOOTH, "Smooth", ""},
96 {eModifierType_Warp, "WARP", ICON_MOD_WARP, "Warp", ""},
97 {eModifierType_Wave, "WAVE", ICON_MOD_WAVE, "Wave", ""},
98 {0, "", 0, N_("Simulate"), ""},
99 {eModifierType_Cloth, "CLOTH", ICON_MOD_CLOTH, "Cloth", ""},
100 {eModifierType_Collision, "COLLISION", ICON_MOD_PHYSICS, "Collision", ""},
101 {eModifierType_DynamicPaint, "DYNAMIC_PAINT", ICON_MOD_DYNAMICPAINT, "Dynamic Paint", ""},
102 {eModifierType_Explode, "EXPLODE", ICON_MOD_EXPLODE, "Explode", ""},
103 {eModifierType_Fluidsim, "FLUID_SIMULATION", ICON_MOD_FLUIDSIM, "Fluid Simulation", ""},
104 {eModifierType_Ocean, "OCEAN", ICON_MOD_OCEAN, "Ocean", ""},
105 {eModifierType_ParticleInstance, "PARTICLE_INSTANCE", ICON_MOD_PARTICLES, "Particle Instance", ""},
106 {eModifierType_ParticleSystem, "PARTICLE_SYSTEM", ICON_MOD_PARTICLES, "Particle System", ""},
107 {eModifierType_Smoke, "SMOKE", ICON_MOD_SMOKE, "Smoke", ""},
108 {eModifierType_Softbody, "SOFT_BODY", ICON_MOD_SOFT, "Soft Body", ""},
109 {eModifierType_Surface, "SURFACE", ICON_MOD_PHYSICS, "Surface", ""},
110 {0, NULL, 0, NULL, NULL}
115 #include "DNA_particle_types.h"
116 #include "DNA_smoke_types.h"
118 #include "BKE_context.h"
119 #include "BKE_depsgraph.h"
120 #include "BKE_library.h"
121 #include "BKE_modifier.h"
122 #include "BKE_particle.h"
124 static void rna_UVProject_projectors_begin(CollectionPropertyIterator *iter, PointerRNA *ptr)
126 UVProjectModifierData *uvp = (UVProjectModifierData *)ptr->data;
127 rna_iterator_array_begin(iter, (void *)uvp->projectors, sizeof(Object *), uvp->num_projectors, 0, NULL);
130 static StructRNA *rna_Modifier_refine(struct PointerRNA *ptr)
132 ModifierData *md = (ModifierData *)ptr->data;
134 switch ((ModifierType)md->type) {
135 case eModifierType_Subsurf:
136 return &RNA_SubsurfModifier;
137 case eModifierType_Lattice:
138 return &RNA_LatticeModifier;
139 case eModifierType_Curve:
140 return &RNA_CurveModifier;
141 case eModifierType_Build:
142 return &RNA_BuildModifier;
143 case eModifierType_Mirror:
144 return &RNA_MirrorModifier;
145 case eModifierType_Decimate:
146 return &RNA_DecimateModifier;
147 case eModifierType_Wave:
148 return &RNA_WaveModifier;
149 case eModifierType_Armature:
150 return &RNA_ArmatureModifier;
151 case eModifierType_Hook:
152 return &RNA_HookModifier;
153 case eModifierType_Softbody:
154 return &RNA_SoftBodyModifier;
155 case eModifierType_Boolean:
156 return &RNA_BooleanModifier;
157 case eModifierType_Array:
158 return &RNA_ArrayModifier;
159 case eModifierType_EdgeSplit:
160 return &RNA_EdgeSplitModifier;
161 case eModifierType_Displace:
162 return &RNA_DisplaceModifier;
163 case eModifierType_UVProject:
164 return &RNA_UVProjectModifier;
165 case eModifierType_Smooth:
166 return &RNA_SmoothModifier;
167 case eModifierType_Cast:
168 return &RNA_CastModifier;
169 case eModifierType_MeshDeform:
170 return &RNA_MeshDeformModifier;
171 case eModifierType_ParticleSystem:
172 return &RNA_ParticleSystemModifier;
173 case eModifierType_ParticleInstance:
174 return &RNA_ParticleInstanceModifier;
175 case eModifierType_Explode:
176 return &RNA_ExplodeModifier;
177 case eModifierType_Cloth:
178 return &RNA_ClothModifier;
179 case eModifierType_Collision:
180 return &RNA_CollisionModifier;
181 case eModifierType_Bevel:
182 return &RNA_BevelModifier;
183 case eModifierType_Shrinkwrap:
184 return &RNA_ShrinkwrapModifier;
185 case eModifierType_Fluidsim:
186 return &RNA_FluidSimulationModifier;
187 case eModifierType_Mask:
188 return &RNA_MaskModifier;
189 case eModifierType_SimpleDeform:
190 return &RNA_SimpleDeformModifier;
191 case eModifierType_Multires:
192 return &RNA_MultiresModifier;
193 case eModifierType_Surface:
194 return &RNA_SurfaceModifier;
195 case eModifierType_Smoke:
196 return &RNA_SmokeModifier;
197 case eModifierType_Solidify:
198 return &RNA_SolidifyModifier;
199 case eModifierType_Screw:
200 return &RNA_ScrewModifier;
201 case eModifierType_Ocean:
202 return &RNA_OceanModifier;
203 case eModifierType_Warp:
204 return &RNA_WarpModifier;
205 case eModifierType_WeightVGEdit:
206 return &RNA_VertexWeightEditModifier;
207 case eModifierType_WeightVGMix:
208 return &RNA_VertexWeightMixModifier;
209 case eModifierType_WeightVGProximity:
210 return &RNA_VertexWeightProximityModifier;
211 case eModifierType_DynamicPaint:
212 return &RNA_DynamicPaintModifier;
213 case eModifierType_Remesh:
214 return &RNA_RemeshModifier;
215 case eModifierType_Skin:
216 return &RNA_SkinModifier;
217 case eModifierType_LaplacianSmooth:
218 return &RNA_LaplacianSmoothModifier;
219 case eModifierType_Triangulate:
220 return &RNA_TriangulateModifier;
221 case eModifierType_UVWarp:
222 return &RNA_UVWarpModifier;
223 case eModifierType_MeshCache:
224 return &RNA_MeshCacheModifier;
226 case eModifierType_None:
227 case eModifierType_ShapeKey:
228 case NUM_MODIFIER_TYPES:
229 return &RNA_Modifier;
232 return &RNA_Modifier;
235 static void rna_Modifier_name_set(PointerRNA *ptr, const char *value)
237 ModifierData *md = ptr->data;
238 char oldname[sizeof(md->name)];
240 /* make a copy of the old name first */
241 BLI_strncpy(oldname, md->name, sizeof(md->name));
243 /* copy the new name into the name slot */
244 BLI_strncpy_utf8(md->name, value, sizeof(md->name));
246 /* make sure the name is truly unique */
248 Object *ob = ptr->id.data;
249 modifier_unique_name(&ob->modifiers, md);
252 /* fix all the animation data which may link to this */
253 BKE_all_animdata_fix_paths_rename(NULL, "modifiers", oldname, md->name);
256 static char *rna_Modifier_path(PointerRNA *ptr)
258 return BLI_sprintfN("modifiers[\"%s\"]", ((ModifierData *)ptr->data)->name);
261 static void rna_Modifier_update(Main *UNUSED(bmain), Scene *UNUSED(scene), PointerRNA *ptr)
263 DAG_id_tag_update(ptr->id.data, OB_RECALC_DATA);
264 WM_main_add_notifier(NC_OBJECT | ND_MODIFIER, ptr->id.data);
267 static void rna_Modifier_dependency_update(Main *bmain, Scene *scene, PointerRNA *ptr)
269 rna_Modifier_update(bmain, scene, ptr);
270 DAG_scene_sort(bmain, scene);
273 static void rna_Smoke_set_type(Main *bmain, Scene *scene, PointerRNA *ptr)
275 SmokeModifierData *smd = (SmokeModifierData *)ptr->data;
276 Object *ob = (Object *)ptr->id.data;
278 /* nothing changed */
279 if ((smd->type & MOD_SMOKE_TYPE_DOMAIN) && smd->domain)
282 smokeModifier_free(smd); /* XXX TODO: completely free all 3 pointers */
283 smokeModifier_createType(smd); /* create regarding of selected type */
286 case MOD_SMOKE_TYPE_DOMAIN:
289 case MOD_SMOKE_TYPE_FLOW:
290 case MOD_SMOKE_TYPE_COLL:
297 /* update dependency since a domain - other type switch could have happened */
298 rna_Modifier_dependency_update(bmain, scene, ptr);
301 static void rna_ExplodeModifier_vgroup_get(PointerRNA *ptr, char *value)
303 ExplodeModifierData *emd = (ExplodeModifierData *)ptr->data;
304 rna_object_vgroup_name_index_get(ptr, value, emd->vgroup);
307 static int rna_ExplodeModifier_vgroup_length(PointerRNA *ptr)
309 ExplodeModifierData *emd = (ExplodeModifierData *)ptr->data;
310 return rna_object_vgroup_name_index_length(ptr, emd->vgroup);
313 static void rna_ExplodeModifier_vgroup_set(PointerRNA *ptr, const char *value)
315 ExplodeModifierData *emd = (ExplodeModifierData *)ptr->data;
316 rna_object_vgroup_name_index_set(ptr, value, &emd->vgroup);
319 static void rna_SimpleDeformModifier_vgroup_set(PointerRNA *ptr, const char *value)
321 SimpleDeformModifierData *smd = (SimpleDeformModifierData *)ptr->data;
322 rna_object_vgroup_name_set(ptr, value, smd->vgroup_name, sizeof(smd->vgroup_name));
325 static void rna_ShrinkwrapModifier_vgroup_set(PointerRNA *ptr, const char *value)
327 ShrinkwrapModifierData *smd = (ShrinkwrapModifierData *)ptr->data;
328 rna_object_vgroup_name_set(ptr, value, smd->vgroup_name, sizeof(smd->vgroup_name));
331 static void rna_LatticeModifier_vgroup_set(PointerRNA *ptr, const char *value)
333 LatticeModifierData *lmd = (LatticeModifierData *)ptr->data;
334 rna_object_vgroup_name_set(ptr, value, lmd->name, sizeof(lmd->name));
337 static void rna_ArmatureModifier_vgroup_set(PointerRNA *ptr, const char *value)
339 ArmatureModifierData *lmd = (ArmatureModifierData *)ptr->data;
340 rna_object_vgroup_name_set(ptr, value, lmd->defgrp_name, sizeof(lmd->defgrp_name));
343 static void rna_CurveModifier_vgroup_set(PointerRNA *ptr, const char *value)
345 CurveModifierData *lmd = (CurveModifierData *)ptr->data;
346 rna_object_vgroup_name_set(ptr, value, lmd->name, sizeof(lmd->name));
349 static void rna_DisplaceModifier_vgroup_set(PointerRNA *ptr, const char *value)
351 DisplaceModifierData *lmd = (DisplaceModifierData *)ptr->data;
352 rna_object_vgroup_name_set(ptr, value, lmd->defgrp_name, sizeof(lmd->defgrp_name));
355 static void rna_HookModifier_vgroup_set(PointerRNA *ptr, const char *value)
357 HookModifierData *lmd = (HookModifierData *)ptr->data;
358 rna_object_vgroup_name_set(ptr, value, lmd->name, sizeof(lmd->name));
361 static void rna_MaskModifier_vgroup_set(PointerRNA *ptr, const char *value)
363 MaskModifierData *lmd = (MaskModifierData *)ptr->data;
364 rna_object_vgroup_name_set(ptr, value, lmd->vgroup, sizeof(lmd->vgroup));
367 static void rna_MeshDeformModifier_vgroup_set(PointerRNA *ptr, const char *value)
369 MeshDeformModifierData *lmd = (MeshDeformModifierData *)ptr->data;
370 rna_object_vgroup_name_set(ptr, value, lmd->defgrp_name, sizeof(lmd->defgrp_name));
373 static void rna_SmoothModifier_vgroup_set(PointerRNA *ptr, const char *value)
375 SmoothModifierData *lmd = (SmoothModifierData *)ptr->data;
376 rna_object_vgroup_name_set(ptr, value, lmd->defgrp_name, sizeof(lmd->defgrp_name));
379 static void rna_LaplacianSmoothModifier_vgroup_set(PointerRNA *ptr, const char *value)
381 LaplacianSmoothModifierData *lmd = (LaplacianSmoothModifierData *)ptr->data;
382 rna_object_vgroup_name_set(ptr, value, lmd->defgrp_name, sizeof(lmd->defgrp_name));
385 static void rna_WaveModifier_vgroup_set(PointerRNA *ptr, const char *value)
387 WaveModifierData *lmd = (WaveModifierData *)ptr->data;
388 rna_object_vgroup_name_set(ptr, value, lmd->defgrp_name, sizeof(lmd->defgrp_name));
391 static void rna_CastModifier_vgroup_set(PointerRNA *ptr, const char *value)
393 CastModifierData *lmd = (CastModifierData *)ptr->data;
394 rna_object_vgroup_name_set(ptr, value, lmd->defgrp_name, sizeof(lmd->defgrp_name));
397 static void rna_SolidifyModifier_vgroup_set(PointerRNA *ptr, const char *value)
399 SolidifyModifierData *smd = (SolidifyModifierData *)ptr->data;
400 rna_object_vgroup_name_set(ptr, value, smd->defgrp_name, sizeof(smd->defgrp_name));
403 static void rna_DecimateModifier_vgroup_set(PointerRNA *ptr, const char *value)
405 DecimateModifierData *dmd = (DecimateModifierData *)ptr->data;
406 rna_object_vgroup_name_set(ptr, value, dmd->defgrp_name, sizeof(dmd->defgrp_name));
409 static void rna_WeightVGModifier_vgroup_set(PointerRNA *ptr, const char *value)
411 ModifierData *md = (ModifierData *)ptr->data;
412 if (md->type == eModifierType_WeightVGEdit) {
413 WeightVGEditModifierData *wmd = (WeightVGEditModifierData *)md;
414 rna_object_vgroup_name_set(ptr, value, wmd->defgrp_name, sizeof(wmd->defgrp_name));
416 else if (md->type == eModifierType_WeightVGMix) {
417 WeightVGMixModifierData *wmd = (WeightVGMixModifierData *)md;
418 rna_object_vgroup_name_set(ptr, value, wmd->defgrp_name_a, sizeof(wmd->defgrp_name_a));
420 else if (md->type == eModifierType_WeightVGProximity) {
421 WeightVGProximityModifierData *wmd = (WeightVGProximityModifierData *)md;
422 rna_object_vgroup_name_set(ptr, value, wmd->defgrp_name, sizeof(wmd->defgrp_name));
426 static void rna_WeightVGModifier_mask_vgroup_set(PointerRNA *ptr, const char *value)
428 ModifierData *md = (ModifierData *)ptr->data;
429 if (md->type == eModifierType_WeightVGEdit) {
430 WeightVGEditModifierData *wmd = (WeightVGEditModifierData *)md;
431 rna_object_vgroup_name_set(ptr, value, wmd->mask_defgrp_name, sizeof(wmd->mask_defgrp_name));
433 else if (md->type == eModifierType_WeightVGMix) {
434 WeightVGMixModifierData *wmd = (WeightVGMixModifierData *)md;
435 rna_object_vgroup_name_set(ptr, value, wmd->mask_defgrp_name, sizeof(wmd->mask_defgrp_name));
437 else if (md->type == eModifierType_WeightVGProximity) {
438 WeightVGProximityModifierData *wmd = (WeightVGProximityModifierData *)md;
439 rna_object_vgroup_name_set(ptr, value, wmd->mask_defgrp_name, sizeof(wmd->mask_defgrp_name));
443 static void rna_WeightVGMixModifier_vgroup2_set(PointerRNA *ptr, const char *value)
445 WeightVGMixModifierData *wmd = (WeightVGMixModifierData *)ptr->data;
446 rna_object_vgroup_name_set(ptr, value, wmd->defgrp_name_b, sizeof(wmd->defgrp_name_b));
449 static void rna_MappingInfo_uvlayer_set(PointerRNA *ptr, const char *value)
451 MappingInfoModifierData *mmd = (MappingInfoModifierData *)ptr->data;
452 rna_object_uvlayer_name_set(ptr, value, mmd->uvlayer_name, sizeof(mmd->uvlayer_name));
455 static void rna_UVProjectModifier_uvlayer_set(PointerRNA *ptr, const char *value)
457 UVProjectModifierData *umd = (UVProjectModifierData *)ptr->data;
458 rna_object_uvlayer_name_set(ptr, value, umd->uvlayer_name, sizeof(umd->uvlayer_name));
461 static void RNA_WarpModifier_vgroup_set(PointerRNA *ptr, const char *value)
463 WarpModifierData *tmd = (WarpModifierData *)ptr->data;
464 rna_object_vgroup_name_set(ptr, value, tmd->defgrp_name, sizeof(tmd->defgrp_name));
467 static void rna_WeightVGModifier_mask_uvlayer_set(PointerRNA *ptr, const char *value)
469 ModifierData *md = (ModifierData *)ptr->data;
470 if (md->type == eModifierType_WeightVGEdit) {
471 WeightVGEditModifierData *wmd = (WeightVGEditModifierData *)md;
472 rna_object_uvlayer_name_set(ptr, value, wmd->mask_tex_uvlayer_name, sizeof(wmd->mask_tex_uvlayer_name));
474 else if (md->type == eModifierType_WeightVGMix) {
475 WeightVGMixModifierData *wmd = (WeightVGMixModifierData *)md;
476 rna_object_uvlayer_name_set(ptr, value, wmd->mask_tex_uvlayer_name, sizeof(wmd->mask_tex_uvlayer_name));
478 else if (md->type == eModifierType_WeightVGProximity) {
479 WeightVGProximityModifierData *wmd = (WeightVGProximityModifierData *)md;
480 rna_object_uvlayer_name_set(ptr, value, wmd->mask_tex_uvlayer_name, sizeof(wmd->mask_tex_uvlayer_name));
484 static void rna_MultiresModifier_type_set(PointerRNA *ptr, int value)
486 Object *ob = (Object *)ptr->id.data;
487 MultiresModifierData *mmd = (MultiresModifierData *)ptr->data;
489 multires_force_update(ob);
493 static void rna_MultiresModifier_level_range(PointerRNA *ptr, int *min, int *max, int *softmin, int *softmax)
495 MultiresModifierData *mmd = (MultiresModifierData *)ptr->data;
498 *max = max_ii(0, mmd->totlvl); /* intentionally _not_ -1 */
501 static int rna_MultiresModifier_external_get(PointerRNA *ptr)
503 Object *ob = (Object *)ptr->id.data;
506 return CustomData_external_test(&me->ldata, CD_MDISPS);
509 static void rna_MultiresModifier_filepath_get(PointerRNA *ptr, char *value)
511 Object *ob = (Object *)ptr->id.data;
512 CustomDataExternal *external = ((Mesh *)ob->data)->ldata.external;
514 BLI_strncpy(value, (external) ? external->filename : "", sizeof(external->filename));
517 static void rna_MultiresModifier_filepath_set(PointerRNA *ptr, const char *value)
519 Object *ob = (Object *)ptr->id.data;
520 CustomDataExternal *external = ((Mesh *)ob->data)->ldata.external;
522 if (external && strcmp(external->filename, value)) {
523 BLI_strncpy(external->filename, value, sizeof(external->filename));
524 multires_force_external_reload(ob);
528 static int rna_MultiresModifier_filepath_length(PointerRNA *ptr)
530 Object *ob = (Object *)ptr->id.data;
531 CustomDataExternal *external = ((Mesh *)ob->data)->ldata.external;
533 return strlen((external) ? external->filename : "");
536 static void modifier_object_set(Object *self, Object **ob_p, int type, PointerRNA value)
538 Object *ob = value.data;
540 if (!self || ob != self) {
541 if (!ob || type == OB_EMPTY || ob->type == type) {
542 id_lib_extern((ID *)ob);
548 static void rna_LatticeModifier_object_set(PointerRNA *ptr, PointerRNA value)
550 modifier_object_set(ptr->id.data, &((LatticeModifierData *)ptr->data)->object, OB_LATTICE, value);
553 static void rna_BooleanModifier_object_set(PointerRNA *ptr, PointerRNA value)
555 modifier_object_set(ptr->id.data, &((BooleanModifierData *)ptr->data)->object, OB_MESH, value);
558 static void rna_CurveModifier_object_set(PointerRNA *ptr, PointerRNA value)
560 modifier_object_set(ptr->id.data, &((CurveModifierData *)ptr->data)->object, OB_CURVE, value);
563 static void rna_CastModifier_object_set(PointerRNA *ptr, PointerRNA value)
565 modifier_object_set(ptr->id.data, &((CastModifierData *)ptr->data)->object, OB_EMPTY, value);
568 static void rna_ArmatureModifier_object_set(PointerRNA *ptr, PointerRNA value)
570 modifier_object_set(ptr->id.data, &((ArmatureModifierData *)ptr->data)->object, OB_ARMATURE, value);
573 static void rna_MaskModifier_armature_set(PointerRNA *ptr, PointerRNA value)
575 modifier_object_set(ptr->id.data, &((MaskModifierData *)ptr->data)->ob_arm, OB_ARMATURE, value);
578 static void rna_ShrinkwrapModifier_auxiliary_target_set(PointerRNA *ptr, PointerRNA value)
580 modifier_object_set(ptr->id.data, &((ShrinkwrapModifierData *)ptr->data)->auxTarget, OB_MESH, value);
583 static void rna_ShrinkwrapModifier_target_set(PointerRNA *ptr, PointerRNA value)
585 modifier_object_set(ptr->id.data, &((ShrinkwrapModifierData *)ptr->data)->target, OB_MESH, value);
588 static int rna_ShrinkwrapModifier_face_cull_get(PointerRNA *ptr)
590 ShrinkwrapModifierData *swm = (ShrinkwrapModifierData *)ptr->data;
591 return swm->shrinkOpts & (MOD_SHRINKWRAP_CULL_TARGET_FRONTFACE | MOD_SHRINKWRAP_CULL_TARGET_BACKFACE);
594 static void rna_ShrinkwrapModifier_face_cull_set(struct PointerRNA *ptr, int value)
596 ShrinkwrapModifierData *swm = (ShrinkwrapModifierData *)ptr->data;
599 (swm->shrinkOpts & ~(MOD_SHRINKWRAP_CULL_TARGET_FRONTFACE | MOD_SHRINKWRAP_CULL_TARGET_BACKFACE)) | value;
602 static void rna_MeshDeformModifier_object_set(PointerRNA *ptr, PointerRNA value)
604 modifier_object_set(ptr->id.data, &((MeshDeformModifierData *)ptr->data)->object, OB_MESH, value);
607 static void rna_ArrayModifier_end_cap_set(PointerRNA *ptr, PointerRNA value)
609 modifier_object_set(ptr->id.data, &((ArrayModifierData *)ptr->data)->end_cap, OB_MESH, value);
612 static void rna_ArrayModifier_start_cap_set(PointerRNA *ptr, PointerRNA value)
614 modifier_object_set(ptr->id.data, &((ArrayModifierData *)ptr->data)->start_cap, OB_MESH, value);
617 static void rna_ArrayModifier_curve_set(PointerRNA *ptr, PointerRNA value)
619 modifier_object_set(ptr->id.data, &((ArrayModifierData *)ptr->data)->curve_ob, OB_CURVE, value);
622 static int rna_MeshDeformModifier_is_bound_get(PointerRNA *ptr)
624 return (((MeshDeformModifierData *)ptr->data)->bindcagecos != NULL);
627 static PointerRNA rna_SoftBodyModifier_settings_get(PointerRNA *ptr)
629 Object *ob = (Object *)ptr->id.data;
630 return rna_pointer_inherit_refine(ptr, &RNA_SoftBodySettings, ob->soft);
633 static PointerRNA rna_SoftBodyModifier_point_cache_get(PointerRNA *ptr)
635 Object *ob = (Object *)ptr->id.data;
636 return rna_pointer_inherit_refine(ptr, &RNA_PointCache, ob->soft->pointcache);
639 static PointerRNA rna_CollisionModifier_settings_get(PointerRNA *ptr)
641 Object *ob = (Object *)ptr->id.data;
642 return rna_pointer_inherit_refine(ptr, &RNA_CollisionSettings, ob->pd);
645 static PointerRNA rna_UVProjector_object_get(PointerRNA *ptr)
647 Object **ob = (Object **)ptr->data;
648 return rna_pointer_inherit_refine(ptr, &RNA_Object, *ob);
651 static void rna_UVProjector_object_set(PointerRNA *ptr, PointerRNA value)
653 Object **ob = (Object **)ptr->data;
656 id_us_min((ID *)*ob);
658 id_us_plus((ID *)value.data);
663 static void rna_UVProjectModifier_num_projectors_set(PointerRNA *ptr, int value)
665 UVProjectModifierData *md = (UVProjectModifierData *)ptr->data;
668 md->num_projectors = CLAMPIS(value, 1, MOD_UVPROJECT_MAX);
669 for (a = md->num_projectors; a < MOD_UVPROJECT_MAX; a++)
670 md->projectors[a] = NULL;
673 static int rna_OceanModifier_is_build_enabled_get(PointerRNA *UNUSED(ptr))
677 #else /* WITH_OCEANSIM */
679 #endif /* WITH_OCEANSIM */
682 static void rna_OceanModifier_init_update(Main *bmain, Scene *scene, PointerRNA *ptr)
684 OceanModifierData *omd = (OceanModifierData *)ptr->data;
686 omd->refresh |= (MOD_OCEAN_REFRESH_RESET | MOD_OCEAN_REFRESH_SIM | MOD_OCEAN_REFRESH_CLEAR_CACHE);
688 rna_Modifier_update(bmain, scene, ptr);
691 static void rna_OceanModifier_sim_update(Main *bmain, Scene *scene, PointerRNA *ptr)
693 OceanModifierData *omd = (OceanModifierData *)ptr->data;
695 omd->refresh |= MOD_OCEAN_REFRESH_SIM;
697 rna_Modifier_update(bmain, scene, ptr);
700 static void rna_OceanModifier_topology_update(Main *bmain, Scene *scene, PointerRNA *ptr)
702 OceanModifierData *omd = (OceanModifierData *)ptr->data;
704 omd->refresh |= MOD_OCEAN_REFRESH_TOPOLOGY;
706 rna_Modifier_update(bmain, scene, ptr);
709 static void rna_OceanModifier_ocean_chop_set(PointerRNA *ptr, float value)
711 OceanModifierData *omd = (OceanModifierData *)ptr->data;
712 float old_value = omd->chop_amount;
714 omd->chop_amount = value;
716 if ((old_value == 0.0f && value > 0.0f) ||
717 (old_value > 0.0f && value == 0.0f))
719 omd->refresh |= MOD_OCEAN_REFRESH_RESET;
720 omd->refresh |= MOD_OCEAN_REFRESH_CLEAR_CACHE;
724 static float rna_EdgeSplitModifier_split_angle_get(PointerRNA *ptr)
726 EdgeSplitModifierData *md = (EdgeSplitModifierData *)ptr->data;
727 return DEG2RADF(md->split_angle);
730 static void rna_EdgeSplitModifier_split_angle_set(PointerRNA *ptr, float value)
732 EdgeSplitModifierData *md = (EdgeSplitModifierData *)ptr->data;
733 value = RAD2DEGF(value);
734 CLAMP(value, 0.0f, 180.0f);
735 md->split_angle = (int)value;
738 static float rna_BevelModifier_angle_limit_get(PointerRNA *ptr)
740 BevelModifierData *md = (BevelModifierData *)ptr->data;
741 return DEG2RADF(md->bevel_angle);
744 static void rna_BevelModifier_angle_limit_set(PointerRNA *ptr, float value)
746 BevelModifierData *md = (BevelModifierData *)ptr->data;
747 value = RAD2DEGF(value);
748 CLAMP(value, 0.0f, 180.0f);
749 md->bevel_angle = (int)value;
752 static void rna_UVWarpModifier_vgroup_set(PointerRNA *ptr, const char *value)
754 UVWarpModifierData *umd = (UVWarpModifierData *)ptr->data;
755 rna_object_vgroup_name_set(ptr, value, umd->vgroup_name, sizeof(umd->vgroup_name));
758 static void rna_UVWarpModifier_uvlayer_set(PointerRNA *ptr, const char *value)
760 UVWarpModifierData *umd = (UVWarpModifierData *)ptr->data;
761 rna_object_uvlayer_name_set(ptr, value, umd->uvlayer_name, sizeof(umd->uvlayer_name));
766 static PropertyRNA *rna_def_property_subdivision_common(StructRNA *srna, const char type[])
768 static EnumPropertyItem prop_subdivision_type_items[] = {
769 {0, "CATMULL_CLARK", 0, "Catmull-Clark", ""},
770 {1, "SIMPLE", 0, "Simple", ""},
771 {0, NULL, 0, NULL, NULL}
774 PropertyRNA *prop = RNA_def_property(srna, "subdivision_type", PROP_ENUM, PROP_NONE);
775 RNA_def_property_enum_sdna(prop, NULL, type);
776 RNA_def_property_enum_items(prop, prop_subdivision_type_items);
777 RNA_def_property_ui_text(prop, "Subdivision Type", "Select type of subdivision algorithm");
778 RNA_def_property_update(prop, 0, "rna_Modifier_update");
783 static void rna_def_modifier_subsurf(BlenderRNA *brna)
788 srna = RNA_def_struct(brna, "SubsurfModifier", "Modifier");
789 RNA_def_struct_ui_text(srna, "Subsurf Modifier", "Subdivision surface modifier");
790 RNA_def_struct_sdna(srna, "SubsurfModifierData");
791 RNA_def_struct_ui_icon(srna, ICON_MOD_SUBSURF);
793 rna_def_property_subdivision_common(srna, "subdivType");
795 prop = RNA_def_property(srna, "levels", PROP_INT, PROP_UNSIGNED);
796 RNA_def_property_int_sdna(prop, NULL, "levels");
797 RNA_def_property_ui_range(prop, 0, 6, 1, 0);
798 RNA_def_property_ui_text(prop, "Levels", "Number of subdivisions to perform");
799 RNA_def_property_update(prop, 0, "rna_Modifier_update");
801 prop = RNA_def_property(srna, "render_levels", PROP_INT, PROP_UNSIGNED);
802 RNA_def_property_int_sdna(prop, NULL, "renderLevels");
803 RNA_def_property_ui_range(prop, 0, 6, 1, 0);
804 RNA_def_property_ui_text(prop, "Render Levels", "Number of subdivisions to perform when rendering");
806 prop = RNA_def_property(srna, "show_only_control_edges", PROP_BOOLEAN, PROP_NONE);
807 RNA_def_property_boolean_sdna(prop, NULL, "flags", eSubsurfModifierFlag_ControlEdges);
808 RNA_def_property_ui_text(prop, "Optimal Display", "Skip drawing/rendering of interior subdivided edges");
809 RNA_def_property_update(prop, 0, "rna_Modifier_update");
811 prop = RNA_def_property(srna, "use_subsurf_uv", PROP_BOOLEAN, PROP_NONE);
812 RNA_def_property_boolean_sdna(prop, NULL, "flags", eSubsurfModifierFlag_SubsurfUv);
813 RNA_def_property_ui_text(prop, "Subdivide UVs", "Use subsurf to subdivide UVs");
814 RNA_def_property_update(prop, 0, "rna_Modifier_update");
817 static void rna_def_modifier_generic_map_info(StructRNA *srna)
819 static EnumPropertyItem prop_texture_coordinates_items[] = {
820 {MOD_DISP_MAP_LOCAL, "LOCAL", 0, "Local", "Use the local coordinate system for the texture coordinates"},
821 {MOD_DISP_MAP_GLOBAL, "GLOBAL", 0, "Global", "Use the global coordinate system for the texture coordinates"},
822 {MOD_DISP_MAP_OBJECT, "OBJECT", 0, "Object",
823 "Use the linked object's local coordinate system for the texture coordinates"},
824 {MOD_DISP_MAP_UV, "UV", 0, "UV", "Use UV coordinates for the texture coordinates"},
825 {0, NULL, 0, NULL, NULL}
830 prop = RNA_def_property(srna, "texture", PROP_POINTER, PROP_NONE);
831 RNA_def_property_ui_text(prop, "Texture", "");
832 RNA_def_property_flag(prop, PROP_EDITABLE);
833 RNA_def_property_update(prop, 0, "rna_Modifier_update");
835 prop = RNA_def_property(srna, "texture_coords", PROP_ENUM, PROP_NONE);
836 RNA_def_property_enum_sdna(prop, NULL, "texmapping");
837 RNA_def_property_enum_items(prop, prop_texture_coordinates_items);
838 RNA_def_property_ui_text(prop, "Texture Coordinates", "");
839 RNA_def_property_update(prop, 0, "rna_Modifier_dependency_update");
841 prop = RNA_def_property(srna, "uv_layer", PROP_STRING, PROP_NONE);
842 RNA_def_property_string_sdna(prop, NULL, "uvlayer_name");
843 RNA_def_property_ui_text(prop, "UV Map", "UV map name");
844 RNA_def_property_string_funcs(prop, NULL, NULL, "rna_MappingInfo_uvlayer_set");
845 RNA_def_property_update(prop, 0, "rna_Modifier_update");
847 prop = RNA_def_property(srna, "texture_coords_object", PROP_POINTER, PROP_NONE);
848 RNA_def_property_pointer_sdna(prop, NULL, "map_object");
849 RNA_def_property_ui_text(prop, "Texture Coordinate Object", "Object to set the texture coordinates");
850 RNA_def_property_flag(prop, PROP_EDITABLE | PROP_ID_SELF_CHECK);
851 RNA_def_property_update(prop, 0, "rna_Modifier_dependency_update");
854 static void rna_def_modifier_warp(BlenderRNA *brna)
859 static EnumPropertyItem prop_falloff_items[] = {
860 {eWarp_Falloff_None, "NONE", 0, "No Falloff", ""},
861 {eWarp_Falloff_Curve, "CURVE", 0, "Curve", ""},
862 {eWarp_Falloff_Smooth, "SMOOTH", ICON_SMOOTHCURVE, "Smooth", ""},
863 {eWarp_Falloff_Sphere, "SPHERE", ICON_SPHERECURVE, "Sphere", ""},
864 {eWarp_Falloff_Root, "ROOT", ICON_ROOTCURVE, "Root", ""},
865 {eWarp_Falloff_Sharp, "SHARP", ICON_SHARPCURVE, "Sharp", ""},
866 {eWarp_Falloff_Linear, "LINEAR", ICON_LINCURVE, "Linear", ""},
867 {eWarp_Falloff_Const, "CONSTANT", ICON_NOCURVE, "Constant", ""},
868 {0, NULL, 0, NULL, NULL}
871 srna = RNA_def_struct(brna, "WarpModifier", "Modifier");
872 RNA_def_struct_ui_text(srna, "Warp Modifier", "Warp modifier");
873 RNA_def_struct_sdna(srna, "WarpModifierData");
874 RNA_def_struct_ui_icon(srna, ICON_MOD_WARP);
876 prop = RNA_def_property(srna, "object_from", PROP_POINTER, PROP_NONE);
877 RNA_def_property_ui_text(prop, "From", "Object to transform from");
878 RNA_def_property_flag(prop, PROP_EDITABLE | PROP_ID_SELF_CHECK);
879 RNA_def_property_update(prop, 0, "rna_Modifier_dependency_update");
881 prop = RNA_def_property(srna, "object_to", PROP_POINTER, PROP_NONE);
882 RNA_def_property_ui_text(prop, "To", "Object to transform to");
883 RNA_def_property_flag(prop, PROP_EDITABLE | PROP_ID_SELF_CHECK);
884 RNA_def_property_update(prop, 0, "rna_Modifier_dependency_update");
886 prop = RNA_def_property(srna, "strength", PROP_FLOAT, PROP_NONE);
887 RNA_def_property_range(prop, -FLT_MAX, FLT_MAX);
888 RNA_def_property_ui_range(prop, -100, 100, 10, 2);
889 RNA_def_property_ui_text(prop, "Strength", "");
890 RNA_def_property_update(prop, 0, "rna_Modifier_update");
892 prop = RNA_def_property(srna, "falloff_type", PROP_ENUM, PROP_NONE);
893 RNA_def_property_enum_items(prop, prop_falloff_items);
894 RNA_def_property_ui_text(prop, "Falloff Type", "");
895 RNA_def_property_update(prop, 0, "rna_Modifier_update");
897 prop = RNA_def_property(srna, "falloff_radius", PROP_FLOAT, PROP_UNSIGNED | PROP_DISTANCE);
898 RNA_def_property_ui_text(prop, "Radius", "Radius to apply");
899 RNA_def_property_update(prop, 0, "rna_Modifier_update");
901 prop = RNA_def_property(srna, "falloff_curve", PROP_POINTER, PROP_NONE);
902 RNA_def_property_pointer_sdna(prop, NULL, "curfalloff");
903 RNA_def_property_ui_text(prop, "Falloff Curve", "Custom Lamp Falloff Curve");
904 RNA_def_property_update(prop, 0, "rna_Modifier_update");
906 prop = RNA_def_property(srna, "use_volume_preserve", PROP_BOOLEAN, PROP_NONE);
907 RNA_def_property_boolean_sdna(prop, NULL, "flag", MOD_WARP_VOLUME_PRESERVE);
908 RNA_def_property_ui_text(prop, "Preserve Volume", "Preserve volume when rotations are used");
909 RNA_def_property_update(prop, 0, "rna_Modifier_update");
911 prop = RNA_def_property(srna, "vertex_group", PROP_STRING, PROP_NONE);
912 RNA_def_property_string_sdna(prop, NULL, "defgrp_name");
913 RNA_def_property_ui_text(prop, "Vertex Group", "Vertex group name for modulating the deform");
914 RNA_def_property_string_funcs(prop, NULL, NULL, "RNA_WarpModifier_vgroup_set");
915 RNA_def_property_update(prop, 0, "rna_Modifier_update");
917 rna_def_modifier_generic_map_info(srna);
920 static void rna_def_modifier_multires(BlenderRNA *brna)
925 srna = RNA_def_struct(brna, "MultiresModifier", "Modifier");
926 RNA_def_struct_ui_text(srna, "Multires Modifier", "Multiresolution mesh modifier");
927 RNA_def_struct_sdna(srna, "MultiresModifierData");
928 RNA_def_struct_ui_icon(srna, ICON_MOD_MULTIRES);
930 prop = rna_def_property_subdivision_common(srna, "simple");
931 RNA_def_property_enum_funcs(prop, NULL, "rna_MultiresModifier_type_set", NULL);
933 prop = RNA_def_property(srna, "levels", PROP_INT, PROP_UNSIGNED);
934 RNA_def_property_int_sdna(prop, NULL, "lvl");
935 RNA_def_property_ui_text(prop, "Levels", "Number of subdivisions to use in the viewport");
936 RNA_def_property_int_funcs(prop, NULL, NULL, "rna_MultiresModifier_level_range");
937 RNA_def_property_update(prop, 0, "rna_Modifier_update");
939 prop = RNA_def_property(srna, "sculpt_levels", PROP_INT, PROP_UNSIGNED);
940 RNA_def_property_int_sdna(prop, NULL, "sculptlvl");
941 RNA_def_property_ui_text(prop, "Sculpt Levels", "Number of subdivisions to use in sculpt mode");
942 RNA_def_property_int_funcs(prop, NULL, NULL, "rna_MultiresModifier_level_range");
943 RNA_def_property_update(prop, 0, "rna_Modifier_update");
945 prop = RNA_def_property(srna, "render_levels", PROP_INT, PROP_UNSIGNED);
946 RNA_def_property_int_sdna(prop, NULL, "renderlvl");
947 RNA_def_property_ui_text(prop, "Render Levels", "The subdivision level visible at render time");
948 RNA_def_property_int_funcs(prop, NULL, NULL, "rna_MultiresModifier_level_range");
950 prop = RNA_def_property(srna, "total_levels", PROP_INT, PROP_UNSIGNED);
951 RNA_def_property_int_sdna(prop, NULL, "totlvl");
952 RNA_def_property_clear_flag(prop, PROP_EDITABLE);
953 RNA_def_property_ui_text(prop, "Total Levels", "Number of subdivisions for which displacements are stored");
955 prop = RNA_def_property(srna, "is_external", PROP_BOOLEAN, PROP_NONE);
956 RNA_def_property_clear_flag(prop, PROP_EDITABLE);
957 RNA_def_property_boolean_funcs(prop, "rna_MultiresModifier_external_get", NULL);
958 RNA_def_property_ui_text(prop, "External",
959 "Store multires displacements outside the .blend file, to save memory");
961 prop = RNA_def_property(srna, "filepath", PROP_STRING, PROP_FILEPATH);
962 RNA_def_property_string_funcs(prop, "rna_MultiresModifier_filepath_get", "rna_MultiresModifier_filepath_length",
963 "rna_MultiresModifier_filepath_set");
964 RNA_def_property_ui_text(prop, "File Path", "Path to external displacements file");
965 RNA_def_property_update(prop, 0, "rna_Modifier_update");
967 prop = RNA_def_property(srna, "show_only_control_edges", PROP_BOOLEAN, PROP_NONE);
968 RNA_def_property_boolean_sdna(prop, NULL, "flags", eMultiresModifierFlag_ControlEdges);
969 RNA_def_property_ui_text(prop, "Optimal Display", "Skip drawing/rendering of interior subdivided edges");
970 RNA_def_property_update(prop, 0, "rna_Modifier_update");
972 prop = RNA_def_property(srna, "use_subsurf_uv", PROP_BOOLEAN, PROP_NONE);
973 RNA_def_property_boolean_negative_sdna(prop, NULL, "flags", eMultiresModifierFlag_PlainUv);
974 RNA_def_property_ui_text(prop, "Subdivide UVs", "Use subsurf to subdivide UVs");
975 RNA_def_property_update(prop, 0, "rna_Modifier_update");
978 static void rna_def_modifier_lattice(BlenderRNA *brna)
983 srna = RNA_def_struct(brna, "LatticeModifier", "Modifier");
984 RNA_def_struct_ui_text(srna, "Lattice Modifier", "Lattice deformation modifier");
985 RNA_def_struct_sdna(srna, "LatticeModifierData");
986 RNA_def_struct_ui_icon(srna, ICON_MOD_LATTICE);
988 prop = RNA_def_property(srna, "object", PROP_POINTER, PROP_NONE);
989 RNA_def_property_ui_text(prop, "Object", "Lattice object to deform with");
990 RNA_def_property_pointer_funcs(prop, NULL, "rna_LatticeModifier_object_set", NULL, "rna_Lattice_object_poll");
991 RNA_def_property_flag(prop, PROP_EDITABLE | PROP_ID_SELF_CHECK);
992 RNA_def_property_update(prop, 0, "rna_Modifier_dependency_update");
994 prop = RNA_def_property(srna, "vertex_group", PROP_STRING, PROP_NONE);
995 RNA_def_property_string_sdna(prop, NULL, "name");
996 RNA_def_property_ui_text(prop, "Vertex Group",
997 "Name of Vertex Group which determines influence of modifier per point");
998 RNA_def_property_string_funcs(prop, NULL, NULL, "rna_LatticeModifier_vgroup_set");
999 RNA_def_property_update(prop, 0, "rna_Modifier_update");
1001 prop = RNA_def_property(srna, "strength", PROP_FLOAT, PROP_NONE);
1002 RNA_def_property_range(prop, -FLT_MAX, FLT_MAX);
1003 RNA_def_property_ui_range(prop, 0, 1, 10, 2);
1004 RNA_def_property_ui_text(prop, "Strength", "Strength of modifier effect");
1005 RNA_def_property_update(prop, 0, "rna_Modifier_update");
1008 static void rna_def_modifier_curve(BlenderRNA *brna)
1013 static EnumPropertyItem prop_deform_axis_items[] = {
1014 {MOD_CURVE_POSX, "POS_X", 0, "X", ""},
1015 {MOD_CURVE_POSY, "POS_Y", 0, "Y", ""},
1016 {MOD_CURVE_POSZ, "POS_Z", 0, "Z", ""},
1017 {MOD_CURVE_NEGX, "NEG_X", 0, "-X", ""},
1018 {MOD_CURVE_NEGY, "NEG_Y", 0, "-Y", ""},
1019 {MOD_CURVE_NEGZ, "NEG_Z", 0, "-Z", ""},
1020 {0, NULL, 0, NULL, NULL}
1023 srna = RNA_def_struct(brna, "CurveModifier", "Modifier");
1024 RNA_def_struct_ui_text(srna, "Curve Modifier", "Curve deformation modifier");
1025 RNA_def_struct_sdna(srna, "CurveModifierData");
1026 RNA_def_struct_ui_icon(srna, ICON_MOD_CURVE);
1028 prop = RNA_def_property(srna, "object", PROP_POINTER, PROP_NONE);
1029 RNA_def_property_ui_text(prop, "Object", "Curve object to deform with");
1030 RNA_def_property_pointer_funcs(prop, NULL, "rna_CurveModifier_object_set", NULL, "rna_Curve_object_poll");
1031 RNA_def_property_flag(prop, PROP_EDITABLE | PROP_ID_SELF_CHECK);
1032 RNA_def_property_update(prop, 0, "rna_Modifier_dependency_update");
1034 prop = RNA_def_property(srna, "vertex_group", PROP_STRING, PROP_NONE);
1035 RNA_def_property_string_sdna(prop, NULL, "name");
1036 RNA_def_property_ui_text(prop, "Vertex Group",
1037 "Name of Vertex Group which determines influence of modifier per point");
1038 RNA_def_property_string_funcs(prop, NULL, NULL, "rna_CurveModifier_vgroup_set");
1039 RNA_def_property_update(prop, 0, "rna_Modifier_update");
1041 prop = RNA_def_property(srna, "deform_axis", PROP_ENUM, PROP_NONE);
1042 RNA_def_property_enum_sdna(prop, NULL, "defaxis");
1043 RNA_def_property_enum_items(prop, prop_deform_axis_items);
1044 RNA_def_property_ui_text(prop, "Deform Axis", "The axis that the curve deforms along");
1045 RNA_def_property_update(prop, 0, "rna_Modifier_update");
1048 static void rna_def_modifier_build(BlenderRNA *brna)
1053 srna = RNA_def_struct(brna, "BuildModifier", "Modifier");
1054 RNA_def_struct_ui_text(srna, "Build Modifier", "Build effect modifier");
1055 RNA_def_struct_sdna(srna, "BuildModifierData");
1056 RNA_def_struct_ui_icon(srna, ICON_MOD_BUILD);
1058 prop = RNA_def_property(srna, "frame_start", PROP_FLOAT, PROP_TIME);
1059 RNA_def_property_float_sdna(prop, NULL, "start");
1060 RNA_def_property_range(prop, MINAFRAMEF, MAXFRAMEF);
1061 RNA_def_property_ui_text(prop, "Start", "Start frame of the effect");
1062 RNA_def_property_update(prop, 0, "rna_Modifier_update");
1064 prop = RNA_def_property(srna, "frame_duration", PROP_FLOAT, PROP_TIME);
1065 RNA_def_property_float_sdna(prop, NULL, "length");
1066 RNA_def_property_range(prop, 1, MAXFRAMEF);
1067 RNA_def_property_ui_text(prop, "Length", "Total time the build effect requires");
1068 RNA_def_property_update(prop, 0, "rna_Modifier_update");
1070 prop = RNA_def_property(srna, "use_random_order", PROP_BOOLEAN, PROP_NONE);
1071 RNA_def_property_boolean_sdna(prop, NULL, "randomize", 1);
1072 RNA_def_property_ui_text(prop, "Randomize", "Randomize the faces or edges during build");
1073 RNA_def_property_update(prop, 0, "rna_Modifier_update");
1075 prop = RNA_def_property(srna, "seed", PROP_INT, PROP_NONE);
1076 RNA_def_property_range(prop, 1, MAXFRAMEF);
1077 RNA_def_property_ui_text(prop, "Seed", "Seed for random if used");
1078 RNA_def_property_update(prop, 0, "rna_Modifier_update");
1081 static void rna_def_modifier_mirror(BlenderRNA *brna)
1086 srna = RNA_def_struct(brna, "MirrorModifier", "Modifier");
1087 RNA_def_struct_ui_text(srna, "Mirror Modifier", "Mirroring modifier");
1088 RNA_def_struct_sdna(srna, "MirrorModifierData");
1089 RNA_def_struct_ui_icon(srna, ICON_MOD_MIRROR);
1091 prop = RNA_def_property(srna, "use_x", PROP_BOOLEAN, PROP_NONE);
1092 RNA_def_property_boolean_sdna(prop, NULL, "flag", MOD_MIR_AXIS_X);
1093 RNA_def_property_ui_text(prop, "X", "Enable X axis mirror");
1094 RNA_def_property_update(prop, 0, "rna_Modifier_update");
1096 prop = RNA_def_property(srna, "use_y", PROP_BOOLEAN, PROP_NONE);
1097 RNA_def_property_boolean_sdna(prop, NULL, "flag", MOD_MIR_AXIS_Y);
1098 RNA_def_property_ui_text(prop, "Y", "Enable Y axis mirror");
1099 RNA_def_property_update(prop, 0, "rna_Modifier_update");
1101 prop = RNA_def_property(srna, "use_z", PROP_BOOLEAN, PROP_NONE);
1102 RNA_def_property_boolean_sdna(prop, NULL, "flag", MOD_MIR_AXIS_Z);
1103 RNA_def_property_ui_text(prop, "Z", "Enable Z axis mirror");
1104 RNA_def_property_update(prop, 0, "rna_Modifier_update");
1106 prop = RNA_def_property(srna, "use_clip", PROP_BOOLEAN, PROP_NONE);
1107 RNA_def_property_boolean_sdna(prop, NULL, "flag", MOD_MIR_CLIPPING);
1108 RNA_def_property_ui_text(prop, "Clip", "Prevent vertices from going through the mirror during transform");
1109 RNA_def_property_update(prop, 0, "rna_Modifier_update");
1111 prop = RNA_def_property(srna, "use_mirror_vertex_groups", PROP_BOOLEAN, PROP_NONE);
1112 RNA_def_property_boolean_sdna(prop, NULL, "flag", MOD_MIR_VGROUP);
1113 RNA_def_property_ui_text(prop, "Mirror Vertex Groups", "Mirror vertex groups (e.g. .R->.L)");
1114 RNA_def_property_update(prop, 0, "rna_Modifier_update");
1116 prop = RNA_def_property(srna, "use_mirror_merge", PROP_BOOLEAN, PROP_NONE);
1117 RNA_def_property_boolean_negative_sdna(prop, NULL, "flag", MOD_MIR_NO_MERGE);
1118 RNA_def_property_ui_text(prop, "Merge Vertices", "Merge vertices within the merge threshold");
1119 RNA_def_property_update(prop, 0, "rna_Modifier_update");
1121 prop = RNA_def_property(srna, "use_mirror_u", PROP_BOOLEAN, PROP_NONE);
1122 RNA_def_property_boolean_sdna(prop, NULL, "flag", MOD_MIR_MIRROR_U);
1123 RNA_def_property_ui_text(prop, "Mirror U", "Mirror the U texture coordinate around the 0.5 point");
1124 RNA_def_property_update(prop, 0, "rna_Modifier_update");
1126 prop = RNA_def_property(srna, "use_mirror_v", PROP_BOOLEAN, PROP_NONE);
1127 RNA_def_property_boolean_sdna(prop, NULL, "flag", MOD_MIR_MIRROR_V);
1128 RNA_def_property_ui_text(prop, "Mirror V", "Mirror the V texture coordinate around the 0.5 point");
1129 RNA_def_property_update(prop, 0, "rna_Modifier_update");
1131 prop = RNA_def_property(srna, "merge_threshold", PROP_FLOAT, PROP_DISTANCE);
1132 RNA_def_property_float_sdna(prop, NULL, "tolerance");
1133 RNA_def_property_range(prop, 0, FLT_MAX);
1134 RNA_def_property_ui_range(prop, 0, 1, 0.01, 6);
1135 RNA_def_property_ui_text(prop, "Merge Limit", "Distance from axis within which mirrored vertices are merged");
1136 RNA_def_property_update(prop, 0, "rna_Modifier_update");
1138 prop = RNA_def_property(srna, "mirror_object", PROP_POINTER, PROP_NONE);
1139 RNA_def_property_pointer_sdna(prop, NULL, "mirror_ob");
1140 RNA_def_property_ui_text(prop, "Mirror Object", "Object to use as mirror");
1141 RNA_def_property_flag(prop, PROP_EDITABLE | PROP_ID_SELF_CHECK);
1142 RNA_def_property_update(prop, 0, "rna_Modifier_dependency_update");
1145 static void rna_def_modifier_decimate(BlenderRNA *brna)
1147 static EnumPropertyItem modifier_decim_mode_items[] = {
1148 {MOD_DECIM_MODE_COLLAPSE, "COLLAPSE", 0, "Collapse", "Use edge collapsing"},
1149 {MOD_DECIM_MODE_UNSUBDIV, "UNSUBDIV", 0, "Un-Subdivide", "Use un-subdivide face reduction"},
1150 {MOD_DECIM_MODE_DISSOLVE, "DISSOLVE", 0, "Planar", "Dissolve geometry to form planar polygons"},
1151 {0, NULL, 0, NULL, NULL}
1157 srna = RNA_def_struct(brna, "DecimateModifier", "Modifier");
1158 RNA_def_struct_ui_text(srna, "Decimate Modifier", "Decimation modifier");
1159 RNA_def_struct_sdna(srna, "DecimateModifierData");
1160 RNA_def_struct_ui_icon(srna, ICON_MOD_DECIM);
1162 prop = RNA_def_property(srna, "decimate_type", PROP_ENUM, PROP_NONE);
1163 RNA_def_property_enum_sdna(prop, NULL, "mode");
1164 RNA_def_property_enum_items(prop, modifier_decim_mode_items);
1165 RNA_def_property_ui_text(prop, "Mode", "");
1166 RNA_def_property_update(prop, 0, "rna_Modifier_update");
1168 /* (mode == MOD_DECIM_MODE_COLLAPSE) */
1169 prop = RNA_def_property(srna, "ratio", PROP_FLOAT, PROP_NONE);
1170 RNA_def_property_float_sdna(prop, NULL, "percent");
1171 RNA_def_property_range(prop, 0, 1);
1172 RNA_def_property_ui_range(prop, 0, 1, 1, 4);
1173 RNA_def_property_ui_text(prop, "Ratio", "Ratio of triangles to reduce to (collapse only)");
1174 RNA_def_property_update(prop, 0, "rna_Modifier_update");
1176 /* (mode == MOD_DECIM_MODE_UNSUBDIV) */
1177 prop = RNA_def_property(srna, "iterations", PROP_INT, PROP_UNSIGNED);
1178 RNA_def_property_int_sdna(prop, NULL, "iter");
1179 RNA_def_property_range(prop, 0, SHRT_MAX);
1180 RNA_def_property_ui_range(prop, 0, 100, 1, 0);
1181 RNA_def_property_ui_text(prop, "Iterations", "Number of times reduce the geometry (unsubdivide only)");
1182 RNA_def_property_update(prop, 0, "rna_Modifier_update");
1184 /* (mode == MOD_DECIM_MODE_DISSOLVE) */
1185 prop = RNA_def_property(srna, "angle_limit", PROP_FLOAT, PROP_ANGLE);
1186 RNA_def_property_float_sdna(prop, NULL, "angle");
1187 RNA_def_property_range(prop, 0, DEG2RAD(180));
1188 RNA_def_property_ui_range(prop, 0, DEG2RAD(180), 100, 2);
1189 RNA_def_property_ui_text(prop, "Angle Limit", "Only dissolve angles below this (planar only)");
1190 RNA_def_property_update(prop, 0, "rna_Modifier_update");
1192 /* (mode == MOD_DECIM_MODE_COLLAPSE) */
1193 prop = RNA_def_property(srna, "vertex_group", PROP_STRING, PROP_NONE);
1194 RNA_def_property_string_sdna(prop, NULL, "defgrp_name");
1195 RNA_def_property_ui_text(prop, "Vertex Group", "Vertex group name (collapse only)");
1196 RNA_def_property_string_funcs(prop, NULL, NULL, "rna_DecimateModifier_vgroup_set");
1197 RNA_def_property_update(prop, 0, "rna_Modifier_update");
1199 prop = RNA_def_property(srna, "invert_vertex_group", PROP_BOOLEAN, PROP_NONE);
1200 RNA_def_property_boolean_sdna(prop, NULL, "flag", MOD_DECIM_FLAG_INVERT_VGROUP);
1201 RNA_def_property_ui_text(prop, "Invert", "Invert vertex group influence (collapse only)");
1202 RNA_def_property_update(prop, 0, "rna_Modifier_update");
1204 prop = RNA_def_property(srna, "use_collapse_triangulate", PROP_BOOLEAN, PROP_NONE);
1205 RNA_def_property_boolean_sdna(prop, NULL, "flag", MOD_DECIM_FLAG_TRIANGULATE);
1206 RNA_def_property_ui_text(prop, "Triangulate", "Keep triangulated faces resulting from decimation (collapse only)");
1207 RNA_def_property_update(prop, 0, "rna_Modifier_update");
1208 /* end collapse-only option */
1210 /* (mode == MOD_DECIM_MODE_DISSOLVE) */
1211 prop = RNA_def_property(srna, "use_dissolve_boundaries", PROP_BOOLEAN, PROP_NONE);
1212 RNA_def_property_boolean_sdna(prop, NULL, "flag", MOD_DECIM_FLAG_ALL_BOUNDARY_VERTS);
1213 RNA_def_property_ui_text(prop, "All Boundaries", "Dissolve all vertices inbetween face boundaries (planar only)");
1214 RNA_def_property_update(prop, 0, "rna_Modifier_update");
1215 /* end dissolve-only option */
1219 /* all modes use this */
1220 prop = RNA_def_property(srna, "face_count", PROP_INT, PROP_NONE);
1221 RNA_def_property_clear_flag(prop, PROP_EDITABLE);
1222 RNA_def_property_ui_text(prop, "Face Count", "The current number of faces in the decimated mesh");
1225 static void rna_def_modifier_wave(BlenderRNA *brna)
1230 srna = RNA_def_struct(brna, "WaveModifier", "Modifier");
1231 RNA_def_struct_ui_text(srna, "Wave Modifier", "Wave effect modifier");
1232 RNA_def_struct_sdna(srna, "WaveModifierData");
1233 RNA_def_struct_ui_icon(srna, ICON_MOD_WAVE);
1235 prop = RNA_def_property(srna, "use_x", PROP_BOOLEAN, PROP_NONE);
1236 RNA_def_property_boolean_sdna(prop, NULL, "flag", MOD_WAVE_X);
1237 RNA_def_property_ui_text(prop, "X", "X axis motion");
1238 RNA_def_property_update(prop, 0, "rna_Modifier_update");
1240 prop = RNA_def_property(srna, "use_y", PROP_BOOLEAN, PROP_NONE);
1241 RNA_def_property_boolean_sdna(prop, NULL, "flag", MOD_WAVE_Y);
1242 RNA_def_property_ui_text(prop, "Y", "Y axis motion");
1243 RNA_def_property_update(prop, 0, "rna_Modifier_update");
1245 prop = RNA_def_property(srna, "use_cyclic", PROP_BOOLEAN, PROP_NONE);
1246 RNA_def_property_boolean_sdna(prop, NULL, "flag", MOD_WAVE_CYCL);
1247 RNA_def_property_ui_text(prop, "Cyclic", "Cyclic wave effect");
1248 RNA_def_property_update(prop, 0, "rna_Modifier_update");
1250 prop = RNA_def_property(srna, "use_normal", PROP_BOOLEAN, PROP_NONE);
1251 RNA_def_property_boolean_sdna(prop, NULL, "flag", MOD_WAVE_NORM);
1252 RNA_def_property_ui_text(prop, "Normals", "Displace along normals");
1253 RNA_def_property_update(prop, 0, "rna_Modifier_update");
1255 prop = RNA_def_property(srna, "use_normal_x", PROP_BOOLEAN, PROP_NONE);
1256 RNA_def_property_boolean_sdna(prop, NULL, "flag", MOD_WAVE_NORM_X);
1257 RNA_def_property_ui_text(prop, "X Normal", "Enable displacement along the X normal");
1258 RNA_def_property_update(prop, 0, "rna_Modifier_update");
1260 prop = RNA_def_property(srna, "use_normal_y", PROP_BOOLEAN, PROP_NONE);
1261 RNA_def_property_boolean_sdna(prop, NULL, "flag", MOD_WAVE_NORM_Y);
1262 RNA_def_property_ui_text(prop, "Y Normal", "Enable displacement along the Y normal");
1263 RNA_def_property_update(prop, 0, "rna_Modifier_update");
1265 prop = RNA_def_property(srna, "use_normal_z", PROP_BOOLEAN, PROP_NONE);
1266 RNA_def_property_boolean_sdna(prop, NULL, "flag", MOD_WAVE_NORM_Z);
1267 RNA_def_property_ui_text(prop, "Z Normal", "Enable displacement along the Z normal");
1268 RNA_def_property_update(prop, 0, "rna_Modifier_update");
1270 prop = RNA_def_property(srna, "time_offset", PROP_FLOAT, PROP_NONE);
1271 RNA_def_property_float_sdna(prop, NULL, "timeoffs");
1272 RNA_def_property_range(prop, MINAFRAMEF, MAXFRAMEF);
1273 RNA_def_property_ui_text(prop, "Time Offset",
1274 "Either the starting frame (for positive speed) or ending frame (for negative speed.)");
1275 RNA_def_property_update(prop, 0, "rna_Modifier_update");
1277 prop = RNA_def_property(srna, "lifetime", PROP_FLOAT, PROP_TIME);
1278 RNA_def_property_float_sdna(prop, NULL, "lifetime");
1279 RNA_def_property_range(prop, MINAFRAMEF, MAXFRAMEF);
1280 RNA_def_property_ui_text(prop, "Lifetime", "Lifetime of the wave in frames, zero means infinite");
1281 RNA_def_property_update(prop, 0, "rna_Modifier_update");
1283 prop = RNA_def_property(srna, "damping_time", PROP_FLOAT, PROP_TIME);
1284 RNA_def_property_float_sdna(prop, NULL, "damp");
1285 RNA_def_property_range(prop, MINAFRAMEF, MAXFRAMEF);
1286 RNA_def_property_ui_text(prop, "Damping Time", "Number of frames in which the wave damps out after it dies");
1287 RNA_def_property_update(prop, 0, "rna_Modifier_update");
1289 prop = RNA_def_property(srna, "falloff_radius", PROP_FLOAT, PROP_DISTANCE);
1290 RNA_def_property_float_sdna(prop, NULL, "falloff");
1291 RNA_def_property_range(prop, 0, FLT_MAX);
1292 RNA_def_property_ui_range(prop, 0, 100, 100, 2);
1293 RNA_def_property_ui_text(prop, "Falloff Radius", "Distance after which it fades out");
1294 RNA_def_property_update(prop, 0, "rna_Modifier_update");
1296 prop = RNA_def_property(srna, "start_position_x", PROP_FLOAT, PROP_DISTANCE);
1297 RNA_def_property_float_sdna(prop, NULL, "startx");
1298 RNA_def_property_range(prop, -FLT_MAX, FLT_MAX);
1299 RNA_def_property_ui_range(prop, -100, 100, 100, 2);
1300 RNA_def_property_ui_text(prop, "Start Position X", "X coordinate of the start position");
1301 RNA_def_property_update(prop, 0, "rna_Modifier_update");
1303 prop = RNA_def_property(srna, "start_position_y", PROP_FLOAT, PROP_DISTANCE);
1304 RNA_def_property_float_sdna(prop, NULL, "starty");
1305 RNA_def_property_range(prop, -FLT_MAX, FLT_MAX);
1306 RNA_def_property_ui_range(prop, -100, 100, 100, 2);
1307 RNA_def_property_ui_text(prop, "Start Position Y", "Y coordinate of the start position");
1308 RNA_def_property_update(prop, 0, "rna_Modifier_update");
1310 prop = RNA_def_property(srna, "start_position_object", PROP_POINTER, PROP_NONE);
1311 RNA_def_property_pointer_sdna(prop, NULL, "objectcenter");
1312 RNA_def_property_ui_text(prop, "Start Position Object", "Object which defines the wave center");
1313 RNA_def_property_flag(prop, PROP_EDITABLE | PROP_ID_SELF_CHECK);
1314 RNA_def_property_update(prop, 0, "rna_Modifier_dependency_update");
1316 prop = RNA_def_property(srna, "vertex_group", PROP_STRING, PROP_NONE);
1317 RNA_def_property_string_sdna(prop, NULL, "defgrp_name");
1318 RNA_def_property_ui_text(prop, "Vertex Group", "Vertex group name for modulating the wave");
1319 RNA_def_property_string_funcs(prop, NULL, NULL, "rna_WaveModifier_vgroup_set");
1320 RNA_def_property_update(prop, 0, "rna_Modifier_update");
1322 prop = RNA_def_property(srna, "speed", PROP_FLOAT, PROP_NONE);
1323 RNA_def_property_range(prop, -FLT_MAX, FLT_MAX);
1324 RNA_def_property_ui_range(prop, -1, 1, 10, 2);
1325 RNA_def_property_ui_text(prop, "Speed", "Speed of the wave, towards the starting point when negative");
1326 RNA_def_property_update(prop, 0, "rna_Modifier_update");
1328 prop = RNA_def_property(srna, "height", PROP_FLOAT, PROP_DISTANCE);
1329 RNA_def_property_range(prop, -FLT_MAX, FLT_MAX);
1330 RNA_def_property_ui_range(prop, -2, 2, 10, 2);
1331 RNA_def_property_ui_text(prop, "Height", "Height of the wave");
1332 RNA_def_property_update(prop, 0, "rna_Modifier_update");
1334 prop = RNA_def_property(srna, "width", PROP_FLOAT, PROP_DISTANCE);
1335 RNA_def_property_range(prop, 0, FLT_MAX);
1336 RNA_def_property_ui_range(prop, 0, 5, 10, 2);
1337 RNA_def_property_ui_text(prop, "Width", "Distance between the waves");
1338 RNA_def_property_update(prop, 0, "rna_Modifier_update");
1340 prop = RNA_def_property(srna, "narrowness", PROP_FLOAT, PROP_DISTANCE);
1341 RNA_def_property_float_sdna(prop, NULL, "narrow");
1342 RNA_def_property_range(prop, 0, FLT_MAX);
1343 RNA_def_property_ui_range(prop, 0, 10, 10, 2);
1344 RNA_def_property_ui_text(prop, "Narrowness",
1345 "Distance between the top and the base of a wave, the higher the value, "
1346 "the more narrow the wave");
1347 RNA_def_property_update(prop, 0, "rna_Modifier_update");
1349 rna_def_modifier_generic_map_info(srna);
1352 static void rna_def_modifier_armature(BlenderRNA *brna)
1357 srna = RNA_def_struct(brna, "ArmatureModifier", "Modifier");
1358 RNA_def_struct_ui_text(srna, "Armature Modifier", "Armature deformation modifier");
1359 RNA_def_struct_sdna(srna, "ArmatureModifierData");
1360 RNA_def_struct_ui_icon(srna, ICON_MOD_ARMATURE);
1362 prop = RNA_def_property(srna, "object", PROP_POINTER, PROP_NONE);
1363 RNA_def_property_ui_text(prop, "Object", "Armature object to deform with");
1364 RNA_def_property_pointer_funcs(prop, NULL, "rna_ArmatureModifier_object_set", NULL, "rna_Armature_object_poll");
1365 RNA_def_property_flag(prop, PROP_EDITABLE | PROP_ID_SELF_CHECK);
1366 RNA_def_property_update(prop, 0, "rna_Modifier_dependency_update");
1368 prop = RNA_def_property(srna, "use_bone_envelopes", PROP_BOOLEAN, PROP_NONE);
1369 RNA_def_property_boolean_sdna(prop, NULL, "deformflag", ARM_DEF_ENVELOPE);
1370 RNA_def_property_ui_text(prop, "Use Bone Envelopes", "Bind Bone envelopes to armature modifier");
1371 RNA_def_property_update(prop, 0, "rna_Modifier_update");
1373 prop = RNA_def_property(srna, "use_vertex_groups", PROP_BOOLEAN, PROP_NONE);
1374 RNA_def_property_boolean_sdna(prop, NULL, "deformflag", ARM_DEF_VGROUP);
1375 RNA_def_property_ui_text(prop, "Use Vertex Groups", "Bind vertex groups to armature modifier");
1376 RNA_def_property_update(prop, 0, "rna_Modifier_update");
1378 prop = RNA_def_property(srna, "use_deform_preserve_volume", PROP_BOOLEAN, PROP_NONE);
1379 RNA_def_property_boolean_sdna(prop, NULL, "deformflag", ARM_DEF_QUATERNION);
1380 RNA_def_property_ui_text(prop, "Preserve Volume", "Deform rotation interpolation with quaternions");
1381 RNA_def_property_update(prop, 0, "rna_Modifier_update");
1383 prop = RNA_def_property(srna, "use_multi_modifier", PROP_BOOLEAN, PROP_NONE);
1384 RNA_def_property_boolean_sdna(prop, NULL, "multi", 0);
1385 RNA_def_property_ui_text(prop, "Multi Modifier",
1386 "Use same input as previous modifier, and mix results using overall vgroup");
1387 RNA_def_property_update(prop, 0, "rna_Modifier_update");
1389 prop = RNA_def_property(srna, "vertex_group", PROP_STRING, PROP_NONE);
1390 RNA_def_property_string_sdna(prop, NULL, "defgrp_name");
1391 RNA_def_property_ui_text(prop, "Vertex Group",
1392 "Name of Vertex Group which determines influence of modifier per point");
1393 RNA_def_property_string_funcs(prop, NULL, NULL, "rna_ArmatureModifier_vgroup_set");
1394 RNA_def_property_update(prop, 0, "rna_Modifier_update");
1396 prop = RNA_def_property(srna, "invert_vertex_group", PROP_BOOLEAN, PROP_NONE);
1397 RNA_def_property_boolean_sdna(prop, NULL, "deformflag", ARM_DEF_INVERT_VGROUP);
1398 RNA_def_property_ui_text(prop, "Invert", "Invert vertex group influence");
1399 RNA_def_property_update(prop, 0, "rna_Modifier_update");
1402 static void rna_def_modifier_hook(BlenderRNA *brna)
1407 srna = RNA_def_struct(brna, "HookModifier", "Modifier");
1408 RNA_def_struct_ui_text(srna, "Hook Modifier", "Hook modifier to modify the location of vertices");
1409 RNA_def_struct_sdna(srna, "HookModifierData");
1410 RNA_def_struct_ui_icon(srna, ICON_HOOK);
1412 prop = RNA_def_property(srna, "falloff", PROP_FLOAT, PROP_DISTANCE);
1413 RNA_def_property_range(prop, 0, FLT_MAX);
1414 RNA_def_property_ui_range(prop, 0, 100, 100, 2);
1415 RNA_def_property_ui_text(prop, "Falloff", "If not zero, the distance from the hook where influence ends");
1416 RNA_def_property_update(prop, 0, "rna_Modifier_update");
1418 prop = RNA_def_property(srna, "force", PROP_FLOAT, PROP_NONE);
1419 RNA_def_property_range(prop, 0, 1);
1420 RNA_def_property_ui_text(prop, "Force", "Relative force of the hook");
1421 RNA_def_property_update(prop, 0, "rna_Modifier_update");
1423 prop = RNA_def_property(srna, "object", PROP_POINTER, PROP_NONE);
1424 RNA_def_property_ui_text(prop, "Object", "Parent Object for hook, also recalculates and clears offset");
1425 RNA_def_property_flag(prop, PROP_EDITABLE | PROP_ID_SELF_CHECK);
1426 RNA_def_property_update(prop, 0, "rna_Modifier_dependency_update");
1428 prop = RNA_def_property(srna, "subtarget", PROP_STRING, PROP_NONE);
1429 RNA_def_property_string_sdna(prop, NULL, "subtarget");
1430 RNA_def_property_ui_text(prop, "Sub-Target",
1431 "Name of Parent Bone for hook (if applicable), also recalculates and clears offset");
1432 RNA_def_property_update(prop, 0, "rna_Modifier_dependency_update");
1434 prop = RNA_def_property(srna, "vertex_group", PROP_STRING, PROP_NONE);
1435 RNA_def_property_string_sdna(prop, NULL, "name");
1436 RNA_def_property_ui_text(prop, "Vertex Group",
1437 "Name of Vertex Group which determines influence of modifier per point");
1438 RNA_def_property_string_funcs(prop, NULL, NULL, "rna_HookModifier_vgroup_set");
1439 RNA_def_property_update(prop, 0, "rna_Modifier_update");
1442 static void rna_def_modifier_softbody(BlenderRNA *brna)
1447 srna = RNA_def_struct(brna, "SoftBodyModifier", "Modifier");
1448 RNA_def_struct_ui_text(srna, "Soft Body Modifier", "Soft body simulation modifier");
1449 RNA_def_struct_sdna(srna, "SoftbodyModifierData");
1450 RNA_def_struct_ui_icon(srna, ICON_MOD_SOFT);
1452 prop = RNA_def_property(srna, "settings", PROP_POINTER, PROP_NONE);
1453 RNA_def_property_flag(prop, PROP_NEVER_NULL);
1454 RNA_def_property_struct_type(prop, "SoftBodySettings");
1455 RNA_def_property_pointer_funcs(prop, "rna_SoftBodyModifier_settings_get", NULL, NULL, NULL);
1456 RNA_def_property_ui_text(prop, "Soft Body Settings", "");
1458 prop = RNA_def_property(srna, "point_cache", PROP_POINTER, PROP_NONE);
1459 RNA_def_property_flag(prop, PROP_NEVER_NULL);
1460 RNA_def_property_struct_type(prop, "PointCache");
1461 RNA_def_property_pointer_funcs(prop, "rna_SoftBodyModifier_point_cache_get", NULL, NULL, NULL);
1462 RNA_def_property_ui_text(prop, "Soft Body Point Cache", "");
1465 static void rna_def_modifier_boolean(BlenderRNA *brna)
1470 static EnumPropertyItem prop_operation_items[] = {
1471 {eBooleanModifierOp_Intersect, "INTERSECT", 0, "Intersect",
1472 "Keep the part of the mesh that intersects with the other selected object"},
1473 {eBooleanModifierOp_Union, "UNION", 0, "Union", "Combine two meshes in an additive way"},
1474 {eBooleanModifierOp_Difference, "DIFFERENCE", 0, "Difference", "Combine two meshes in a subtractive way"},
1475 {0, NULL, 0, NULL, NULL}
1478 srna = RNA_def_struct(brna, "BooleanModifier", "Modifier");
1479 RNA_def_struct_ui_text(srna, "Boolean Modifier", "Boolean operations modifier");
1480 RNA_def_struct_sdna(srna, "BooleanModifierData");
1481 RNA_def_struct_ui_icon(srna, ICON_MOD_BOOLEAN);
1483 prop = RNA_def_property(srna, "object", PROP_POINTER, PROP_NONE);
1484 RNA_def_property_ui_text(prop, "Object", "Mesh object to use for Boolean operation");
1485 RNA_def_property_pointer_funcs(prop, NULL, "rna_BooleanModifier_object_set", NULL, "rna_Mesh_object_poll");
1486 RNA_def_property_flag(prop, PROP_EDITABLE | PROP_ID_SELF_CHECK);
1487 RNA_def_property_update(prop, 0, "rna_Modifier_dependency_update");
1489 prop = RNA_def_property(srna, "operation", PROP_ENUM, PROP_NONE);
1490 RNA_def_property_enum_items(prop, prop_operation_items);
1491 RNA_def_property_ui_text(prop, "Operation", "");
1492 RNA_def_property_update(prop, 0, "rna_Modifier_update");
1495 static void rna_def_modifier_array(BlenderRNA *brna)
1500 static EnumPropertyItem prop_fit_type_items[] = {
1501 {MOD_ARR_FIXEDCOUNT, "FIXED_COUNT", 0, "Fixed Count", "Duplicate the object a certain number of times"},
1502 {MOD_ARR_FITLENGTH, "FIT_LENGTH", 0, "Fit Length",
1503 "Duplicate the object as many times as fits in a certain length"},
1504 {MOD_ARR_FITCURVE, "FIT_CURVE", 0, "Fit Curve", "Fit the duplicated objects to a curve"},
1505 {0, NULL, 0, NULL, NULL}
1508 srna = RNA_def_struct(brna, "ArrayModifier", "Modifier");
1509 RNA_def_struct_ui_text(srna, "Array Modifier", "Array duplication modifier");
1510 RNA_def_struct_sdna(srna, "ArrayModifierData");
1511 RNA_def_struct_ui_icon(srna, ICON_MOD_ARRAY);
1513 /* Length parameters */
1514 prop = RNA_def_property(srna, "fit_type", PROP_ENUM, PROP_NONE);
1515 RNA_def_property_enum_items(prop, prop_fit_type_items);
1516 RNA_def_property_ui_text(prop, "Fit Type", "Array length calculation method");
1517 RNA_def_property_update(prop, 0, "rna_Modifier_update");
1519 prop = RNA_def_property(srna, "count", PROP_INT, PROP_NONE);
1520 RNA_def_property_range(prop, 1, INT_MAX);
1521 RNA_def_property_ui_range(prop, 1, 1000, 1, 0);
1522 RNA_def_property_ui_text(prop, "Count", "Number of duplicates to make");
1523 RNA_def_property_update(prop, 0, "rna_Modifier_update");
1525 prop = RNA_def_property(srna, "fit_length", PROP_FLOAT, PROP_DISTANCE);
1526 RNA_def_property_float_sdna(prop, NULL, "length");
1527 RNA_def_property_range(prop, 0, INT_MAX);
1528 RNA_def_property_ui_range(prop, 0, 10000, 10, 2);
1529 RNA_def_property_ui_text(prop, "Length", "Length to fit array within");
1530 RNA_def_property_update(prop, 0, "rna_Modifier_update");
1532 prop = RNA_def_property(srna, "curve", PROP_POINTER, PROP_NONE);
1533 RNA_def_property_pointer_sdna(prop, NULL, "curve_ob");
1534 RNA_def_property_ui_text(prop, "Curve", "Curve object to fit array length to");
1535 RNA_def_property_pointer_funcs(prop, NULL, "rna_ArrayModifier_curve_set", NULL, "rna_Curve_object_poll");
1536 RNA_def_property_flag(prop, PROP_EDITABLE | PROP_ID_SELF_CHECK);
1537 RNA_def_property_update(prop, 0, "rna_Modifier_dependency_update");
1539 /* Offset parameters */
1540 prop = RNA_def_property(srna, "use_constant_offset", PROP_BOOLEAN, PROP_NONE);
1541 RNA_def_property_boolean_sdna(prop, NULL, "offset_type", MOD_ARR_OFF_CONST);
1542 RNA_def_property_ui_text(prop, "Constant Offset", "Add a constant offset");
1543 RNA_def_property_update(prop, 0, "rna_Modifier_update");
1545 prop = RNA_def_property(srna, "constant_offset_displace", PROP_FLOAT, PROP_TRANSLATION);
1546 RNA_def_property_float_sdna(prop, NULL, "offset");
1547 RNA_def_property_ui_text(prop, "Constant Offset Displacement", "Value for the distance between arrayed items");
1548 RNA_def_property_ui_range(prop, -FLT_MAX, FLT_MAX, 1, RNA_TRANSLATION_PREC_DEFAULT);
1549 RNA_def_property_update(prop, 0, "rna_Modifier_update");
1551 prop = RNA_def_property(srna, "use_relative_offset", PROP_BOOLEAN, PROP_NONE);
1552 RNA_def_property_boolean_sdna(prop, NULL, "offset_type", MOD_ARR_OFF_RELATIVE);
1553 RNA_def_property_ui_text(prop, "Relative Offset", "Add an offset relative to the object's bounding box");
1554 RNA_def_property_update(prop, 0, "rna_Modifier_update");
1556 /* PROP_TRANSLATION causes units to be used which we don't want */
1557 prop = RNA_def_property(srna, "relative_offset_displace", PROP_FLOAT, PROP_NONE);
1558 RNA_def_property_float_sdna(prop, NULL, "scale");
1559 RNA_def_property_ui_text(prop, "Relative Offset Displacement",
1560 "The size of the geometry will determine the distance between arrayed items");
1561 RNA_def_property_update(prop, 0, "rna_Modifier_update");
1563 /* Vertex merging parameters */
1564 prop = RNA_def_property(srna, "use_merge_vertices", PROP_BOOLEAN, PROP_NONE);
1565 RNA_def_property_boolean_sdna(prop, NULL, "flags", MOD_ARR_MERGE);
1566 RNA_def_property_ui_text(prop, "Merge Vertices", "Merge vertices in adjacent duplicates");
1567 RNA_def_property_update(prop, 0, "rna_Modifier_update");
1569 prop = RNA_def_property(srna, "use_merge_vertices_cap", PROP_BOOLEAN, PROP_NONE);
1570 RNA_def_property_boolean_sdna(prop, NULL, "flags", MOD_ARR_MERGEFINAL);
1571 RNA_def_property_ui_text(prop, "Merge Vertices", "Merge vertices in first and last duplicates");
1572 RNA_def_property_update(prop, 0, "rna_Modifier_update");
1574 prop = RNA_def_property(srna, "merge_threshold", PROP_FLOAT, PROP_DISTANCE);
1575 RNA_def_property_float_sdna(prop, NULL, "merge_dist");
1576 RNA_def_property_range(prop, 0, FLT_MAX);
1577 RNA_def_property_ui_range(prop, 0, 1, 1, 4);
1578 RNA_def_property_ui_text(prop, "Merge Distance", "Limit below which to merge vertices");
1579 RNA_def_property_update(prop, 0, "rna_Modifier_update");
1582 prop = RNA_def_property(srna, "use_object_offset", PROP_BOOLEAN, PROP_NONE);
1583 RNA_def_property_boolean_sdna(prop, NULL, "offset_type", MOD_ARR_OFF_OBJ);
1584 RNA_def_property_ui_text(prop, "Object Offset", "Add another object's transformation to the total offset");
1585 RNA_def_property_update(prop, 0, "rna_Modifier_update");
1587 prop = RNA_def_property(srna, "offset_object", PROP_POINTER, PROP_NONE);
1588 RNA_def_property_pointer_sdna(prop, NULL, "offset_ob");
1589 RNA_def_property_ui_text(prop, "Object Offset",
1590 "Use the location and rotation of another object to determine the distance and "
1591 "rotational change between arrayed items");
1592 RNA_def_property_flag(prop, PROP_EDITABLE | PROP_ID_SELF_CHECK);
1593 RNA_def_property_update(prop, 0, "rna_Modifier_dependency_update");
1596 prop = RNA_def_property(srna, "start_cap", PROP_POINTER, PROP_NONE);
1597 RNA_def_property_ui_text(prop, "Start Cap", "Mesh object to use as a start cap");
1598 RNA_def_property_pointer_funcs(prop, NULL, "rna_ArrayModifier_start_cap_set", NULL, "rna_Mesh_object_poll");
1599 RNA_def_property_flag(prop, PROP_EDITABLE | PROP_ID_SELF_CHECK);
1600 RNA_def_property_update(prop, 0, "rna_Modifier_update");
1602 prop = RNA_def_property(srna, "end_cap", PROP_POINTER, PROP_NONE);
1603 RNA_def_property_ui_text(prop, "End Cap", "Mesh object to use as an end cap");
1604 RNA_def_property_pointer_funcs(prop, NULL, "rna_ArrayModifier_end_cap_set", NULL, "rna_Mesh_object_poll");
1605 RNA_def_property_flag(prop, PROP_EDITABLE | PROP_ID_SELF_CHECK);
1606 RNA_def_property_update(prop, 0, "rna_Modifier_dependency_update");
1609 static void rna_def_modifier_edgesplit(BlenderRNA *brna)
1614 srna = RNA_def_struct(brna, "EdgeSplitModifier", "Modifier");
1615 RNA_def_struct_ui_text(srna, "EdgeSplit Modifier", "Edge splitting modifier to create sharp edges");
1616 RNA_def_struct_sdna(srna, "EdgeSplitModifierData");
1617 RNA_def_struct_ui_icon(srna, ICON_MOD_EDGESPLIT);
1619 #if 1 /* expose as radians */
1620 prop = RNA_def_property(srna, "split_angle", PROP_FLOAT, PROP_ANGLE);
1621 RNA_def_property_float_funcs(prop, "rna_EdgeSplitModifier_split_angle_get",
1622 "rna_EdgeSplitModifier_split_angle_set", NULL);
1623 RNA_def_property_range(prop, 0, DEG2RAD(180));
1624 RNA_def_property_ui_range(prop, 0, DEG2RAD(180), 100, 2);
1626 prop = RNA_def_property(srna, "split_angle", PROP_FLOAT, PROP_NONE);
1627 RNA_def_property_range(prop, 0, 180);
1628 RNA_def_property_ui_range(prop, 0, 180, 100, 2);
1630 RNA_def_property_ui_text(prop, "Split Angle", "Angle above which to split edges");
1631 RNA_def_property_update(prop, 0, "rna_Modifier_update");
1633 prop = RNA_def_property(srna, "use_edge_angle", PROP_BOOLEAN, PROP_NONE);
1634 RNA_def_property_boolean_sdna(prop, NULL, "flags", MOD_EDGESPLIT_FROMANGLE);
1635 RNA_def_property_ui_text(prop, "Use Edge Angle", "Split edges with high angle between faces");
1636 RNA_def_property_update(prop, 0, "rna_Modifier_update");
1638 prop = RNA_def_property(srna, "use_edge_sharp", PROP_BOOLEAN, PROP_NONE);
1639 RNA_def_property_boolean_sdna(prop, NULL, "flags", MOD_EDGESPLIT_FROMFLAG);
1640 RNA_def_property_ui_text(prop, "Use Sharp Edges", "Split edges that are marked as sharp");
1641 RNA_def_property_update(prop, 0, "rna_Modifier_update");
1644 static void rna_def_modifier_displace(BlenderRNA *brna)
1649 static EnumPropertyItem prop_direction_items[] = {
1650 {MOD_DISP_DIR_X, "X", 0, "X", "Use the texture's intensity value to displace in the X direction"},
1651 {MOD_DISP_DIR_Y, "Y", 0, "Y", "Use the texture's intensity value to displace in the Y direction"},
1652 {MOD_DISP_DIR_Z, "Z", 0, "Z", "Use the texture's intensity value to displace in the Z direction"},
1653 {MOD_DISP_DIR_NOR, "NORMAL", 0, "Normal",
1654 "Use the texture's intensity value to displace in the normal direction"},
1655 {MOD_DISP_DIR_RGB_XYZ, "RGB_TO_XYZ", 0, "RGB to XYZ",
1656 "Use the texture's RGB values to displace the mesh in the XYZ direction"},
1657 {0, NULL, 0, NULL, NULL}
1660 srna = RNA_def_struct(brna, "DisplaceModifier", "Modifier");
1661 RNA_def_struct_ui_text(srna, "Displace Modifier", "Displacement modifier");
1662 RNA_def_struct_sdna(srna, "DisplaceModifierData");
1663 RNA_def_struct_ui_icon(srna, ICON_MOD_DISPLACE);
1665 prop = RNA_def_property(srna, "vertex_group", PROP_STRING, PROP_NONE);
1666 RNA_def_property_string_sdna(prop, NULL, "defgrp_name");
1667 RNA_def_property_ui_text(prop, "Vertex Group",
1668 "Name of Vertex Group which determines influence of modifier per point");
1669 RNA_def_property_string_funcs(prop, NULL, NULL, "rna_DisplaceModifier_vgroup_set");
1670 RNA_def_property_update(prop, 0, "rna_Modifier_update");
1672 prop = RNA_def_property(srna, "mid_level", PROP_FLOAT, PROP_FACTOR);
1673 RNA_def_property_float_sdna(prop, NULL, "midlevel");
1674 RNA_def_property_range(prop, -FLT_MAX, FLT_MAX);
1675 RNA_def_property_ui_range(prop, 0, 1, 10, 3);
1676 RNA_def_property_ui_text(prop, "Midlevel", "Material value that gives no displacement");
1677 RNA_def_property_update(prop, 0, "rna_Modifier_update");
1679 prop = RNA_def_property(srna, "strength", PROP_FLOAT, PROP_NONE);
1680 RNA_def_property_range(prop, -FLT_MAX, FLT_MAX);
1681 RNA_def_property_ui_range(prop, -100, 100, 10, 3);
1682 RNA_def_property_ui_text(prop, "Strength", "Amount to displace geometry");
1683 RNA_def_property_update(prop, 0, "rna_Modifier_update");
1685 prop = RNA_def_property(srna, "direction", PROP_ENUM, PROP_NONE);
1686 RNA_def_property_enum_items(prop, prop_direction_items);
1687 RNA_def_property_ui_text(prop, "Direction", "");
1688 RNA_def_property_update(prop, 0, "rna_Modifier_update");
1690 rna_def_modifier_generic_map_info(srna);
1693 static void rna_def_modifier_uvproject(BlenderRNA *brna)
1698 srna = RNA_def_struct(brna, "UVProjectModifier", "Modifier");
1699 RNA_def_struct_ui_text(srna, "UV Project Modifier", "UV projection modifier to set UVs from a projector");
1700 RNA_def_struct_sdna(srna, "UVProjectModifierData");
1701 RNA_def_struct_ui_icon(srna, ICON_MOD_UVPROJECT);
1703 prop = RNA_def_property(srna, "uv_layer", PROP_STRING, PROP_NONE);
1704 RNA_def_property_string_sdna(prop, NULL, "uvlayer_name");
1705 RNA_def_property_ui_text(prop, "UV Map", "UV map name");
1706 RNA_def_property_string_funcs(prop, NULL, NULL, "rna_UVProjectModifier_uvlayer_set");
1707 RNA_def_property_update(prop, 0, "rna_Modifier_update");
1709 prop = RNA_def_property(srna, "projector_count", PROP_INT, PROP_NONE);
1710 RNA_def_property_int_sdna(prop, NULL, "num_projectors");
1711 RNA_def_property_ui_text(prop, "Number of Projectors", "Number of projectors to use");
1712 RNA_def_property_int_funcs(prop, NULL, "rna_UVProjectModifier_num_projectors_set", NULL);
1713 RNA_def_property_range(prop, 1, MOD_UVPROJECT_MAX);
1714 RNA_def_property_update(prop, 0, "rna_Modifier_update");
1716 prop = RNA_def_property(srna, "projectors", PROP_COLLECTION, PROP_NONE);
1717 RNA_def_property_struct_type(prop, "UVProjector");
1718 RNA_def_property_collection_funcs(prop, "rna_UVProject_projectors_begin", "rna_iterator_array_next",
1719 "rna_iterator_array_end", "rna_iterator_array_get", NULL, NULL, NULL, NULL);
1720 RNA_def_property_ui_text(prop, "Projectors", "");
1722 prop = RNA_def_property(srna, "image", PROP_POINTER, PROP_NONE);
1723 RNA_def_property_ui_text(prop, "Image", "");
1724 RNA_def_property_flag(prop, PROP_EDITABLE);
1725 RNA_def_property_update(prop, 0, "rna_Modifier_update");
1727 prop = RNA_def_property(srna, "aspect_x", PROP_FLOAT, PROP_NONE);
1728 RNA_def_property_float_sdna(prop, NULL, "aspectx");
1729 RNA_def_property_range(prop, 1, FLT_MAX);
1730 RNA_def_property_ui_range(prop, 1, 1000, 1, 3);
1731 RNA_def_property_ui_text(prop, "Horizontal Aspect Ratio", "");
1732 RNA_def_property_update(prop, 0, "rna_Modifier_update");
1734 prop = RNA_def_property(srna, "aspect_y", PROP_FLOAT, PROP_NONE);
1735 RNA_def_property_float_sdna(prop, NULL, "aspecty");
1736 RNA_def_property_range(prop, 1, FLT_MAX);
1737 RNA_def_property_ui_range(prop, 1, 1000, 1, 3);
1738 RNA_def_property_ui_text(prop, "Vertical Aspect Ratio", "");
1739 RNA_def_property_update(prop, 0, "rna_Modifier_update");
1741 prop = RNA_def_property(srna, "scale_x", PROP_FLOAT, PROP_NONE);
1742 RNA_def_property_float_sdna(prop, NULL, "scalex");
1743 RNA_def_property_range(prop, 0, FLT_MAX);
1744 RNA_def_property_ui_range(prop, 0, 1000, 1, 3);
1745 RNA_def_property_ui_text(prop, "Horizontal Scale", "");
1746 RNA_def_property_update(prop, 0, "rna_Modifier_update");
1748 prop = RNA_def_property(srna, "scale_y", PROP_FLOAT, PROP_NONE);
1749 RNA_def_property_float_sdna(prop, NULL, "scaley");
1750 RNA_def_property_range(prop, 0, FLT_MAX);
1751 RNA_def_property_ui_range(prop, 0, 1000, 1, 3);
1752 RNA_def_property_ui_text(prop, "Vertical Scale", "");
1753 RNA_def_property_update(prop, 0, "rna_Modifier_update");
1755 prop = RNA_def_property(srna, "use_image_override", PROP_BOOLEAN, PROP_NONE);
1756 RNA_def_property_boolean_sdna(prop, NULL, "flags", MOD_UVPROJECT_OVERRIDEIMAGE);
1757 RNA_def_property_ui_text(prop, "Override Image", "Override faces' current images with the given image");
1758 RNA_def_property_update(prop, 0, "rna_Modifier_update");
1760 srna = RNA_def_struct(brna, "UVProjector", NULL);
1761 RNA_def_struct_ui_text(srna, "UVProjector", "UV projector used by the UV project modifier");
1763 prop = RNA_def_property(srna, "object", PROP_POINTER, PROP_NONE);
1764 RNA_def_property_struct_type(prop, "Object");
1765 RNA_def_property_pointer_funcs(prop, "rna_UVProjector_object_get", "rna_UVProjector_object_set", NULL, NULL);
1766 RNA_def_property_flag(prop, PROP_EDITABLE | PROP_ID_SELF_CHECK);
1767 RNA_def_property_ui_text(prop, "Object", "Object to use as projector transform");
1768 RNA_def_property_update(prop, 0, "rna_Modifier_dependency_update");
1771 static void rna_def_modifier_smooth(BlenderRNA *brna)
1776 srna = RNA_def_struct(brna, "SmoothModifier", "Modifier");
1777 RNA_def_struct_ui_text(srna, "Smooth Modifier", "Smoothing effect modifier");
1778 RNA_def_struct_sdna(srna, "SmoothModifierData");
1779 RNA_def_struct_ui_icon(srna, ICON_MOD_SMOOTH);
1781 prop = RNA_def_property(srna, "use_x", PROP_BOOLEAN, PROP_NONE);
1782 RNA_def_property_boolean_sdna(prop, NULL, "flag", MOD_SMOOTH_X);
1783 RNA_def_property_ui_text(prop, "X", "Smooth object along X axis");
1784 RNA_def_property_update(prop, 0, "rna_Modifier_update");
1786 prop = RNA_def_property(srna, "use_y", PROP_BOOLEAN, PROP_NONE);
1787 RNA_def_property_boolean_sdna(prop, NULL, "flag", MOD_SMOOTH_Y);
1788 RNA_def_property_ui_text(prop, "Y", "Smooth object along Y axis");
1789 RNA_def_property_update(prop, 0, "rna_Modifier_update");
1791 prop = RNA_def_property(srna, "use_z", PROP_BOOLEAN, PROP_NONE);
1792 RNA_def_property_boolean_sdna(prop, NULL, "flag", MOD_SMOOTH_Z);
1793 RNA_def_property_ui_text(prop, "Z", "Smooth object along Z axis");
1794 RNA_def_property_update(prop, 0, "rna_Modifier_update");
1796 prop = RNA_def_property(srna, "factor", PROP_FLOAT, PROP_NONE);
1797 RNA_def_property_float_sdna(prop, NULL, "fac");
1798 RNA_def_property_range(prop, -FLT_MAX, FLT_MAX);
1799 RNA_def_property_ui_range(prop, -10, 10, 1, 3);
1800 RNA_def_property_ui_text(prop, "Factor", "Strength of modifier effect");
1801 RNA_def_property_update(prop, 0, "rna_Modifier_update");
1803 prop = RNA_def_property(srna, "iterations", PROP_INT, PROP_NONE);
1804 RNA_def_property_int_sdna(prop, NULL, "repeat");
1805 RNA_def_property_ui_range(prop, 0, 30, 1, 0);
1806 RNA_def_property_ui_text(prop, "Repeat", "");
1807 RNA_def_property_update(prop, 0, "rna_Modifier_update");
1809 prop = RNA_def_property(srna, "vertex_group", PROP_STRING, PROP_NONE);
1810 RNA_def_property_string_sdna(prop, NULL, "defgrp_name");
1811 RNA_def_property_ui_text(prop, "Vertex Group",
1812 "Name of Vertex Group which determines influence of modifier per point");
1813 RNA_def_property_string_funcs(prop, NULL, NULL, "rna_SmoothModifier_vgroup_set");
1814 RNA_def_property_update(prop, 0, "rna_Modifier_update");
1817 static void rna_def_modifier_laplaciansmooth(BlenderRNA *brna)
1822 srna = RNA_def_struct(brna, "LaplacianSmoothModifier", "Modifier");
1823 RNA_def_struct_ui_text(srna, "Laplacian Smooth Modifier", "Smoothing effect modifier");
1824 RNA_def_struct_sdna(srna, "LaplacianSmoothModifierData");
1825 RNA_def_struct_ui_icon(srna, ICON_MOD_SMOOTH);
1827 prop = RNA_def_property(srna, "use_x", PROP_BOOLEAN, PROP_NONE);
1828 RNA_def_property_boolean_sdna(prop, NULL, "flag", MOD_LAPLACIANSMOOTH_X);
1829 RNA_def_property_ui_text(prop, "X", "Smooth object along X axis");
1830 RNA_def_property_update(prop, 0, "rna_Modifier_update");
1832 prop = RNA_def_property(srna, "use_y", PROP_BOOLEAN, PROP_NONE);
1833 RNA_def_property_boolean_sdna(prop, NULL, "flag", MOD_LAPLACIANSMOOTH_Y);
1834 RNA_def_property_ui_text(prop, "Y", "Smooth object along Y axis");
1835 RNA_def_property_update(prop, 0, "rna_Modifier_update");
1837 prop = RNA_def_property(srna, "use_z", PROP_BOOLEAN, PROP_NONE);
1838 RNA_def_property_boolean_sdna(prop, NULL, "flag", MOD_LAPLACIANSMOOTH_Z);
1839 RNA_def_property_ui_text(prop, "Z", "Smooth object along Z axis");
1840 RNA_def_property_update(prop, 0, "rna_Modifier_update");
1842 prop = RNA_def_property(srna, "use_volume_preserve", PROP_BOOLEAN, PROP_NONE);
1843 RNA_def_property_boolean_sdna(prop, NULL, "flag", MOD_LAPLACIANSMOOTH_PRESERVE_VOLUME);
1844 RNA_def_property_ui_text(prop, "Preserve Volume", "Apply volume preservation after smooth");
1845 RNA_def_property_update(prop, 0, "rna_Modifier_update");
1847 prop = RNA_def_property(srna, "use_normalized", PROP_BOOLEAN, PROP_NONE);
1848 RNA_def_property_boolean_sdna(prop, NULL, "flag", MOD_LAPLACIANSMOOTH_NORMALIZED);
1849 RNA_def_property_ui_text(prop, "Normalized", "Improve and stabilize the enhanced shape");
1850 RNA_def_property_update(prop, 0, "rna_Modifier_update");
1852 prop = RNA_def_property(srna, "lambda_factor", PROP_FLOAT, PROP_NONE);
1853 RNA_def_property_float_sdna(prop, NULL, "lambda");
1854 RNA_def_property_range(prop, -FLT_MAX, FLT_MAX);
1855 RNA_def_property_ui_range(prop, -1000.0, 1000.0, 5, 3);
1856 RNA_def_property_ui_text(prop, "Lambda Factor", "Smooth factor effect");
1857 RNA_def_property_update(prop, 0, "rna_Modifier_update");
1859 prop = RNA_def_property(srna, "lambda_border", PROP_FLOAT, PROP_NONE);
1860 RNA_def_property_float_sdna(prop, NULL, "lambda_border");
1861 RNA_def_property_range(prop, -FLT_MAX, FLT_MAX);
1862 RNA_def_property_ui_range(prop, -1000.0, 1000.0, 5, 3);
1863 RNA_def_property_ui_text(prop, "Lambda Border", "Lambda factor in border");
1864 RNA_def_property_update(prop, 0, "rna_Modifier_update");
1866 prop = RNA_def_property(srna, "iterations", PROP_INT, PROP_NONE);
1867 RNA_def_property_int_sdna(prop, NULL, "repeat");
1868 RNA_def_property_ui_range(prop, 0, 200, 1, 0);
1869 RNA_def_property_ui_text(prop, "Repeat", "");
1870 RNA_def_property_update(prop, 0, "rna_Modifier_update");
1872 prop = RNA_def_property(srna, "vertex_group", PROP_STRING, PROP_NONE);
1873 RNA_def_property_string_sdna(prop, NULL, "defgrp_name");
1874 RNA_def_property_ui_text(prop, "Vertex Group",
1875 "Name of Vertex Group which determines influence of modifier per point");
1876 RNA_def_property_string_funcs(prop, NULL, NULL, "rna_LaplacianSmoothModifier_vgroup_set");
1877 RNA_def_property_update(prop, 0, "rna_Modifier_update");
1880 static void rna_def_modifier_cast(BlenderRNA *brna)
1885 static EnumPropertyItem prop_cast_type_items[] = {
1886 {MOD_CAST_TYPE_SPHERE, "SPHERE", 0, "Sphere", ""},
1887 {MOD_CAST_TYPE_CYLINDER, "CYLINDER", 0, "Cylinder", ""},
1888 {MOD_CAST_TYPE_CUBOID, "CUBOID", 0, "Cuboid", ""},
1889 {0, NULL, 0, NULL, NULL}
1892 srna = RNA_def_struct(brna, "CastModifier", "Modifier");
1893 RNA_def_struct_ui_text(srna, "Cast Modifier", "Modifier to cast to other shapes");
1894 RNA_def_struct_sdna(srna, "CastModifierData");
1895 RNA_def_struct_ui_icon(srna, ICON_MOD_CAST);
1897 prop = RNA_def_property(srna, "cast_type", PROP_ENUM, PROP_NONE);
1898 RNA_def_property_enum_sdna(prop, NULL, "type");
1899 RNA_def_property_enum_items(prop, prop_cast_type_items);
1900 RNA_def_property_ui_text(prop, "Cast Type", "Target object shape");
1901 RNA_def_property_update(prop, 0, "rna_Modifier_update");
1903 prop = RNA_def_property(srna, "object", PROP_POINTER, PROP_NONE);
1904 RNA_def_property_ui_text(prop, "Object",
1905 "Control object: if available, its location determines the center of the effect");
1906 RNA_def_property_pointer_funcs(prop, NULL, "rna_CastModifier_object_set", NULL, NULL);
1907 RNA_def_property_flag(prop, PROP_EDITABLE | PROP_ID_SELF_CHECK);
1908 RNA_def_property_update(prop, 0, "rna_Modifier_dependency_update");
1910 prop = RNA_def_property(srna, "use_x", PROP_BOOLEAN, PROP_NONE);
1911 RNA_def_property_boolean_sdna(prop, NULL, "flag", MOD_CAST_X);
1912 RNA_def_property_ui_text(prop, "X", "");
1913 RNA_def_property_update(prop, 0, "rna_Modifier_update");
1915 prop = RNA_def_property(srna, "use_y", PROP_BOOLEAN, PROP_NONE);
1916 RNA_def_property_boolean_sdna(prop, NULL, "flag", MOD_CAST_Y);
1917 RNA_def_property_ui_text(prop, "Y", "");
1918 RNA_def_property_update(prop, 0, "rna_Modifier_update");
1920 prop = RNA_def_property(srna, "use_z", PROP_BOOLEAN, PROP_NONE);
1921 RNA_def_property_boolean_sdna(prop, NULL, "flag", MOD_CAST_Z);
1922 RNA_def_property_ui_text(prop, "Z", "");
1923 RNA_def_property_update(prop, 0, "rna_Modifier_update");
1925 prop = RNA_def_property(srna, "use_radius_as_size", PROP_BOOLEAN, PROP_NONE);
1926 RNA_def_property_boolean_sdna(prop, NULL, "flag", MOD_CAST_SIZE_FROM_RADIUS);
1927 RNA_def_property_ui_text(prop, "From Radius", "Use radius as size of projection shape (0 = auto)");
1928 RNA_def_property_update(prop, 0, "rna_Modifier_update");
1930 prop = RNA_def_property(srna, "use_transform", PROP_BOOLEAN, PROP_NONE);
1931 RNA_def_property_boolean_sdna(prop, NULL, "flag", MOD_CAST_USE_OB_TRANSFORM);
1932 RNA_def_property_ui_text(prop, "Use transform", "Use object transform to control projection shape");
1933 RNA_def_property_update(prop, 0, "rna_Modifier_update");
1935 prop = RNA_def_property(srna, "factor", PROP_FLOAT, PROP_NONE);
1936 RNA_def_property_float_sdna(prop, NULL, "fac");
1937 RNA_def_property_range(prop, -FLT_MAX, FLT_MAX);
1938 RNA_def_property_ui_range(prop, -10, 10, 5, 2);
1939 RNA_def_property_ui_text(prop, "Factor", "");
1940 RNA_def_property_update(prop, 0, "rna_Modifier_update");
1942 prop = RNA_def_property(srna, "radius", PROP_FLOAT, PROP_DISTANCE);
1943 RNA_def_property_range(prop, 0, FLT_MAX);
1944 RNA_def_property_ui_range(prop, 0, 100, 5, 2);
1945 RNA_def_property_ui_text(prop, "Radius",
1946 "Only deform vertices within this distance from the center of the effect "
1947 "(leave as 0 for infinite.)");
1948 RNA_def_property_update(prop, 0, "rna_Modifier_update");
1950 prop = RNA_def_property(srna, "size", PROP_FLOAT, PROP_NONE);
1951 RNA_def_property_range(prop, 0, FLT_MAX);
1952 RNA_def_property_ui_range(prop, 0, 100, 5, 2);
1953 RNA_def_property_ui_text(prop, "Size", "Size of projection shape (leave as 0 for auto)");
1954 RNA_def_property_update(prop, 0, "rna_Modifier_update");
1956 prop = RNA_def_property(srna, "vertex_group", PROP_STRING, PROP_NONE);
1957 RNA_def_property_string_sdna(prop, NULL, "defgrp_name");
1958 RNA_def_property_ui_text(prop, "Vertex Group", "Vertex group name");
1959 RNA_def_property_string_funcs(prop, NULL, NULL, "rna_CastModifier_vgroup_set");
1960 RNA_def_property_update(prop, 0, "rna_Modifier_update");
1963 static void rna_def_modifier_meshdeform(BlenderRNA *brna)
1968 static EnumPropertyItem prop_mode_items[] = {
1969 {0, "VOLUME", 0, "Volume", "Bind to volume inside cage mesh"},
1970 {1, "SURFACE", 0, "Surface", "Bind to surface of cage mesh"},
1971 {0, NULL, 0, NULL, NULL}
1975 srna = RNA_def_struct(brna, "MeshDeformModifier", "Modifier");
1976 RNA_def_struct_ui_text(srna, "MeshDeform Modifier", "Mesh deformation modifier to deform with other meshes");
1977 RNA_def_struct_sdna(srna, "MeshDeformModifierData");
1978 RNA_def_struct_ui_icon(srna, ICON_MOD_MESHDEFORM);
1980 prop = RNA_def_property(srna, "object", PROP_POINTER, PROP_NONE);
1981 RNA_def_property_ui_text(prop, "Object", "Mesh object to deform with");
1982 RNA_def_property_pointer_funcs(prop, NULL, "rna_MeshDeformModifier_object_set", NULL, NULL);
1983 RNA_def_property_flag(prop, PROP_EDITABLE | PROP_ID_SELF_CHECK);
1984 RNA_def_property_update(prop, 0, "rna_Modifier_dependency_update");
1986 prop = RNA_def_property(srna, "is_bound", PROP_BOOLEAN, PROP_NONE);
1987 RNA_def_property_boolean_funcs(prop, "rna_MeshDeformModifier_is_bound_get", NULL);
1988 RNA_def_property_ui_text(prop, "Bound", "Whether geometry has been bound to control cage");
1989 RNA_def_property_clear_flag(prop, PROP_EDITABLE);
1991 prop = RNA_def_property(srna, "invert_vertex_group", PROP_BOOLEAN, PROP_NONE);
1992 RNA_def_property_boolean_sdna(prop, NULL, "flag", MOD_MDEF_INVERT_VGROUP);
1993 RNA_def_property_ui_text(prop, "Invert", "Invert vertex group influence");
1994 RNA_def_property_update(prop, 0, "rna_Modifier_update");
1996 prop = RNA_def_property(srna, "vertex_group", PROP_STRING, PROP_NONE);
1997 RNA_def_property_string_sdna(prop, NULL, "defgrp_name");
1998 RNA_def_property_ui_text(prop, "Vertex Group", "Vertex group name");
1999 RNA_def_property_string_funcs(prop, NULL, NULL, "rna_MeshDeformModifier_vgroup_set");
2000 RNA_def_property_update(prop, 0, "rna_Modifier_update");
2002 prop = RNA_def_property(srna, "precision", PROP_INT, PROP_NONE);
2003 RNA_def_property_int_sdna(prop, NULL, "gridsize");
2004 RNA_def_property_range(prop, 2, 10);
2005 RNA_def_property_ui_text(prop, "Precision", "The grid size for binding");
2006 RNA_def_property_update(prop, 0, "rna_Modifier_update");
2008 prop = RNA_def_property(srna, "use_dynamic_bind", PROP_BOOLEAN, PROP_NONE);
2009 RNA_def_property_boolean_sdna(prop, NULL, "flag", MOD_MDEF_DYNAMIC_BIND);
2010 RNA_def_property_ui_text(prop, "Dynamic",
2011 "Recompute binding dynamically on top of other deformers "
2012 "(slower and more memory consuming)");
2013 RNA_def_property_update(prop, 0, "rna_Modifier_update");
2016 prop = RNA_def_property(srna, "mode", PROP_ENUM, PROP_NONE);
2017 RNA_def_property_enum_items(prop, prop_mode_items);
2018 RNA_def_property_ui_text(prop, "Mode", "Method of binding vertices are bound to cage mesh");
2019 RNA_def_property_update(prop, 0, "rna_Modifier_update");
2023 static void rna_def_modifier_particlesystem(BlenderRNA *brna)
2028 srna = RNA_def_struct(brna, "ParticleSystemModifier", "Modifier");
2029 RNA_def_struct_ui_text(srna, "ParticleSystem Modifier", "Particle system simulation modifier");
2030 RNA_def_struct_sdna(srna, "ParticleSystemModifierData");
2031 RNA_def_struct_ui_icon(srna, ICON_MOD_PARTICLES);
2033 prop = RNA_def_property(srna, "particle_system", PROP_POINTER, PROP_NONE);
2034 RNA_def_property_flag(prop, PROP_NEVER_NULL);
2035 RNA_def_property_pointer_sdna(prop, NULL, "psys");
2036 RNA_def_property_ui_text(prop, "Particle System", "Particle System that this modifier controls");
2039 static void rna_def_modifier_particleinstance(BlenderRNA *brna)
2044 static EnumPropertyItem particleinstance_axis[] = {
2045 {0, "X", 0, "X", ""},
2046 {1, "Y", 0, "Y", ""},
2047 {2, "Z", 0, "Z", ""},
2048 {0, NULL, 0, NULL, NULL}
2051 srna = RNA_def_struct(brna, "ParticleInstanceModifier", "Modifier");
2052 RNA_def_struct_ui_text(srna, "ParticleInstance Modifier", "Particle system instancing modifier");
2053 RNA_def_struct_sdna(srna, "ParticleInstanceModifierData");
2054 RNA_def_struct_ui_icon(srna, ICON_MOD_PARTICLES);
2056 prop = RNA_def_property(srna, "object", PROP_POINTER, PROP_NONE);
2057 RNA_def_property_pointer_sdna(prop, NULL, "ob");
2058 RNA_def_property_ui_text(prop, "Object", "Object that has the particle system");
2059 RNA_def_property_flag(prop, PROP_EDITABLE | PROP_ID_SELF_CHECK);
2060 RNA_def_property_update(prop, 0, "rna_Modifier_dependency_update");
2062 prop = RNA_def_property(srna, "particle_system_index", PROP_INT, PROP_NONE);
2063 RNA_def_property_int_sdna(prop, NULL, "psys");
2064 RNA_def_property_range(prop, 1, 10);
2065 RNA_def_property_ui_text(prop, "Particle System Number", "");
2066 RNA_def_property_update(prop, 0, "rna_Modifier_update");
2068 prop = RNA_def_property(srna, "axis", PROP_ENUM, PROP_NONE);
2069 RNA_def_property_enum_sdna(prop, NULL, "axis");
2070 RNA_def_property_enum_items(prop, particleinstance_axis);
2071 RNA_def_property_ui_text(prop, "Axis", "Pole axis for rotation");
2072 RNA_def_property_update(prop, 0, "rna_Modifier_update");
2074 prop = RNA_def_property(srna, "use_normal", PROP_BOOLEAN, PROP_NONE);
2075 RNA_def_property_boolean_sdna(prop, NULL, "flag", eParticleInstanceFlag_Parents);
2076 RNA_def_property_ui_text(prop, "Normal", "Create instances from normal particles");
2077 RNA_def_property_update(prop, 0, "rna_Modifier_update");
2079 prop = RNA_def_property(srna, "use_children", PROP_BOOLEAN, PROP_NONE);
2080 RNA_def_property_boolean_sdna(prop, NULL, "flag", eParticleInstanceFlag_Children);
2081 RNA_def_property_ui_text(prop, "Children", "Create instances from child particles");
2082 RNA_def_property_update(prop, 0, "rna_Modifier_update");
2084 prop = RNA_def_property(srna, "use_path", PROP_BOOLEAN, PROP_NONE);
2085 RNA_def_property_boolean_sdna(prop, NULL, "flag", eParticleInstanceFlag_Path);
2086 RNA_def_property_ui_text(prop, "Path", "Create instances along particle paths");
2087 RNA_def_property_update(prop, 0, "rna_Modifier_update");
2089 prop = RNA_def_property(srna, "show_unborn", PROP_BOOLEAN, PROP_NONE);
2090 RNA_def_property_boolean_sdna(prop, NULL, "flag", eParticleInstanceFlag_Unborn);
2091 RNA_def_property_ui_text(prop, "Unborn", "Show instances when particles are unborn");
2092 RNA_def_property_update(prop, 0, "rna_Modifier_update");
2094 prop = RNA_def_property(srna, "show_alive", PROP_BOOLEAN, PROP_NONE);
2095 RNA_def_property_boolean_sdna(prop, NULL, "flag", eParticleInstanceFlag_Alive);
2096 RNA_def_property_ui_text(prop, "Alive", "Show instances when particles are alive");
2097 RNA_def_property_update(prop, 0, "rna_Modifier_update");
2099 prop = RNA_def_property(srna, "show_dead", PROP_BOOLEAN, PROP_NONE);
2100 RNA_def_property_boolean_sdna(prop, NULL, "flag", eParticleInstanceFlag_Dead);
2101 RNA_def_property_ui_text(prop, "Dead", "Show instances when particles are dead");
2102 RNA_def_property_update(prop, 0, "rna_Modifier_update");
2104 prop = RNA_def_property(srna, "use_preserve_shape", PROP_BOOLEAN, PROP_NONE);
2105 RNA_def_property_boolean_sdna(prop, NULL, "flag", eParticleInstanceFlag_KeepShape);
2106 RNA_def_property_ui_text(prop, "Keep Shape", "Don't stretch the object");
2107 RNA_def_property_update(prop, 0, "rna_Modifier_update");
2109 prop = RNA_def_property(srna, "use_size", PROP_BOOLEAN, PROP_NONE);
2110 RNA_def_property_boolean_sdna(prop, NULL, "flag", eParticleInstanceFlag_UseSize);
2111 RNA_def_property_ui_text(prop, "Size", "Use particle size to scale the instances");
2112 RNA_def_property_update(prop, 0, "rna_Modifier_update");
2114 prop = RNA_def_property(srna, "position", PROP_FLOAT, PROP_NONE);
2115 RNA_def_property_float_sdna(prop, NULL, "position");
2116 RNA_def_property_range(prop, 0.0, 1.0);
2117 RNA_def_property_ui_text(prop, "Position", "Position along path");
2118 RNA_def_property_update(prop, 0, "rna_Modifier_update");
2120 prop = RNA_def_property(srna, "random_position", PROP_FLOAT, PROP_NONE);
2121 RNA_def_property_float_sdna(prop, NULL, "random_position");
2122 RNA_def_property_range(prop, 0.0, 1.0);
2123 RNA_def_property_ui_text(prop, "Random Position", "Randomize position along path");
2124 RNA_def_property_update(prop, 0, "rna_Modifier_update");
2127 static void rna_def_modifier_explode(BlenderRNA *brna)
2132 srna = RNA_def_struct(brna, "ExplodeModifier", "Modifier");
2133 RNA_def_struct_ui_text(srna, "Explode Modifier", "Explosion effect modifier based on a particle system");
2134 RNA_def_struct_sdna(srna, "ExplodeModifierData");
2135 RNA_def_struct_ui_icon(srna, ICON_MOD_EXPLODE);
2137 prop = RNA_def_property(srna, "vertex_group", PROP_STRING, PROP_NONE);
2138 RNA_def_property_string_funcs(prop, "rna_ExplodeModifier_vgroup_get", "rna_ExplodeModifier_vgroup_length",
2139 "rna_ExplodeModifier_vgroup_set");
2140 RNA_def_property_ui_text(prop, "Vertex Group", "");
2142 prop = RNA_def_property(srna, "protect", PROP_FLOAT, PROP_NONE);
2143 RNA_def_property_range(prop, 0, 1);
2144 RNA_def_property_ui_text(prop, "Protect", "Clean vertex group edges");
2145 RNA_def_property_update(prop, 0, "rna_Modifier_update");
2147 prop = RNA_def_property(srna, "use_edge_cut", PROP_BOOLEAN, PROP_NONE);
2148 RNA_def_property_boolean_sdna(prop, NULL, "flag", eExplodeFlag_EdgeCut);
2149 RNA_def_property_ui_text(prop, "Cut Edges", "Cut face edges for nicer shrapnel");
2150 RNA_def_property_update(prop, 0, "rna_Modifier_update");
2152 prop = RNA_def_property(srna, "show_unborn", PROP_BOOLEAN, PROP_NONE);
2153 RNA_def_property_boolean_sdna(prop, NULL, "flag", eExplodeFlag_Unborn);
2154 RNA_def_property_ui_text(prop, "Unborn", "Show mesh when particles are unborn");
2155 RNA_def_property_update(prop, 0, "rna_Modifier_update");
2157 prop = RNA_def_property(srna, "show_alive", PROP_BOOLEAN, PROP_NONE);
2158 RNA_def_property_boolean_sdna(prop, NULL, "flag", eExplodeFlag_Alive);
2159 RNA_def_property_ui_text(prop, "Alive", "Show mesh when particles are alive");
2160 RNA_def_property_update(prop, 0, "rna_Modifier_update");
2162 prop = RNA_def_property(srna, "show_dead", PROP_BOOLEAN, PROP_NONE);
2163 RNA_def_property_boolean_sdna(prop, NULL, "flag", eExplodeFlag_Dead);
2164 RNA_def_property_ui_text(prop, "Dead", "Show mesh when particles are dead");
2165 RNA_def_property_update(prop, 0, "rna_Modifier_update");
2167 prop = RNA_def_property(srna, "use_size", PROP_BOOLEAN, PROP_NONE);
2168 RNA_def_property_boolean_sdna(prop, NULL, "flag", eExplodeFlag_PaSize);
2169 RNA_def_property_ui_text(prop, "Size", "Use particle size for the shrapnel");
2170 RNA_def_property_update(prop, 0, "rna_Modifier_update");
2172 prop = RNA_def_property(srna, "particle_uv", PROP_STRING, PROP_NONE);
2173 RNA_def_property_string_sdna(prop, NULL, "uvname");
2174 RNA_def_property_string_maxlength(prop, MAX_CUSTOMDATA_LAYER_NAME);
2175 RNA_def_property_ui_text(prop, "Particle UV", "UV map to change with particle age");
2176 RNA_def_property_update(prop, 0, "rna_Modifier_update");
2179 static void rna_def_modifier_cloth(BlenderRNA *brna)
2184 srna = RNA_def_struct(brna, "ClothModifier", "Modifier");
2185 RNA_def_struct_ui_text(srna, "Cloth Modifier", "Cloth simulation modifier");
2186 RNA_def_struct_sdna(srna, "ClothModifierData");
2187 RNA_def_struct_ui_icon(srna, ICON_MOD_CLOTH);
2189 prop = RNA_def_property(srna, "settings", PROP_POINTER, PROP_NONE);
2190 RNA_def_property_flag(prop, PROP_NEVER_NULL);
2191 RNA_def_property_pointer_sdna(prop, NULL, "sim_parms");
2192 RNA_def_property_ui_text(prop, "Cloth Settings", "");
2194 prop = RNA_def_property(srna, "collision_settings", PROP_POINTER, PROP_NONE);
2195 RNA_def_property_flag(prop, PROP_NEVER_NULL);
2196 RNA_def_property_pointer_sdna(prop, NULL, "coll_parms");
2197 RNA_def_property_ui_text(prop, "Cloth Collision Settings", "");
2199 prop = RNA_def_property(srna, "point_cache", PROP_POINTER, PROP_NONE);
2200 RNA_def_property_flag(prop, PROP_NEVER_NULL);
2201 RNA_def_property_ui_text(prop, "Point Cache", "");
2204 static void rna_def_modifier_smoke(BlenderRNA *brna)
2209 static EnumPropertyItem prop_smoke_type_items[] = {
2210 {0, "NONE", 0, "None", ""},
2211 {MOD_SMOKE_TYPE_DOMAIN, "DOMAIN", 0, "Domain", ""},
2212 {MOD_SMOKE_TYPE_FLOW, "FLOW", 0, "Flow", "Inflow/Outflow"},
2213 {MOD_SMOKE_TYPE_COLL, "COLLISION", 0, "Collision", ""},
2214 {0, NULL, 0, NULL, NULL}
2217 srna = RNA_def_struct(brna, "SmokeModifier", "Modifier");
2218 RNA_def_struct_ui_text(srna, "Smoke Modifier", "Smoke simulation modifier");
2219 RNA_def_struct_sdna(srna, "SmokeModifierData");
2220 RNA_def_struct_ui_icon(srna, ICON_MOD_SMOKE);
2222 prop = RNA_def_property(srna, "domain_settings", PROP_POINTER, PROP_NONE);
2223 RNA_def_property_pointer_sdna(prop, NULL, "domain");
2224 RNA_def_property_ui_text(prop, "Domain Settings", "");
2226 prop = RNA_def_property(srna, "flow_settings", PROP_POINTER, PROP_NONE);
2227 RNA_def_property_pointer_sdna(prop, NULL, "flow");
2228 RNA_def_property_ui_text(prop, "Flow Settings", "");
2230 prop = RNA_def_property(srna, "coll_settings", PROP_POINTER, PROP_NONE);
2231 RNA_def_property_pointer_sdna(prop, NULL, "coll");
2232 RNA_def_property_ui_text(prop, "Collision Settings", "");
2234 prop = RNA_def_property(srna, "smoke_type", PROP_ENUM, PROP_NONE);
2235 RNA_def_property_enum_sdna(prop, NULL, "type");
2236 RNA_def_property_enum_items(prop, prop_smoke_type_items);
2237 RNA_def_property_ui_text(prop, "Type", "");
2238 RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
2239 RNA_def_property_update(prop, 0, "rna_Smoke_set_type");
2242 static void rna_def_modifier_dynamic_paint(BlenderRNA *brna)
2247 srna = RNA_def_struct(brna, "DynamicPaintModifier", "Modifier");
2248 RNA_def_struct_ui_text(srna, "Dynamic Paint Modifier", "Dynamic Paint modifier");
2249 RNA_def_struct_sdna(srna, "DynamicPaintModifierData");
2250 RNA_def_struct_ui_icon(srna, ICON_MOD_DYNAMICPAINT);
2252 prop = RNA_def_property(srna, "canvas_settings", PROP_POINTER, PROP_NONE);
2253 RNA_def_property_pointer_sdna(prop, NULL, "canvas");
2254 RNA_def_property_ui_text(prop, "Canvas Settings", "");
2256 prop = RNA_def_property(srna, "brush_settings", PROP_POINTER, PROP_NONE);
2257 RNA_def_property_pointer_sdna(prop, NULL, "brush");
2258 RNA_def_property_ui_text(prop, "Brush Settings", "");
2260 prop = RNA_def_property(srna, "ui_type", PROP_ENUM, PROP_NONE);
2261 RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
2262 RNA_def_property_enum_sdna(prop, NULL, "type");
2263 RNA_def_property_enum_items(prop, prop_dynamicpaint_type_items);
2264 RNA_def_property_ui_text(prop, "Type", "");
2267 static void rna_def_modifier_collision(BlenderRNA *brna)
2272 srna = RNA_def_struct(brna, "CollisionModifier", "Modifier");
2273 RNA_def_struct_ui_text(srna, "Collision Modifier",
2274 "Collision modifier defining modifier stack position used for collision");
2275 RNA_def_struct_sdna(srna, "CollisionModifierData");
2276 RNA_def_struct_ui_icon(srna, ICON_MOD_PHYSICS);
2278 prop = RNA_def_property(srna, "settings", PROP_POINTER, PROP_NONE);
2279 RNA_def_property_flag(prop, PROP_NEVER_NULL);
2280 RNA_def_property_struct_type(prop, "CollisionSettings");
2281 RNA_def_property_pointer_funcs(prop, "rna_CollisionModifier_settings_get", NULL, NULL, NULL);
2282 RNA_def_property_ui_text(prop, "Settings", "");
2285 static void rna_def_modifier_bevel(BlenderRNA *brna)
2290 static EnumPropertyItem prop_limit_method_items[] = {
2291 {0, "NONE", 0, "None", "Bevel the entire mesh by a constant amount"},
2292 {BME_BEVEL_ANGLE, "ANGLE", 0, "Angle", "Only bevel edges with sharp enough angles between faces"},
2293 {BME_BEVEL_WEIGHT, "WEIGHT", 0, "Weight",
2294 "Use bevel weights to determine how much bevel is applied; "
2295 "apply them separately in vert/edge select mode"},
2296 {0, NULL, 0, NULL, NULL}
2299 static EnumPropertyItem prop_edge_weight_method_items[] = {
2300 {0, "AVERAGE", 0, "Average", ""},
2301 {BME_BEVEL_EMIN, "SHARPEST", 0, "Sharpest", ""},
2302 {BME_BEVEL_EMAX, "LARGEST", 0, "Largest", ""},
2303 {0, NULL, 0, NULL, NULL}
2306 srna = RNA_def_struct(brna, "BevelModifier", "Modifier");
2307 RNA_def_struct_ui_text(srna, "Bevel Modifier", "Bevel modifier to make edges and vertices more rounded");
2308 RNA_def_struct_sdna(srna, "BevelModifierData");
2309 RNA_def_struct_ui_icon(srna, ICON_MOD_BEVEL);
2311 prop = RNA_def_property(srna, "width", PROP_FLOAT, PROP_DISTANCE);
2312 RNA_def_property_float_sdna(prop, NULL, "value");
2313 RNA_def_property_range(prop, 0, FLT_MAX);
2314 RNA_def_property_ui_range(prop, 0, 10, 0.1, 4);
2315 RNA_def_property_ui_text(prop, "Width", "Bevel value/amount");
2316 RNA_def_property_update(prop, 0, "rna_Modifier_update");
2318 prop = RNA_def_property(srna, "use_only_vertices", PROP_BOOLEAN, PROP_NONE);
2319 RNA_def_property_boolean_sdna(prop, NULL, "flags", BME_BEVEL_VERT);
2320 RNA_def_property_ui_text(prop, "Only Vertices", "Bevel verts/corners, not edges");
2321 RNA_def_property_update(prop, 0, "rna_Modifier_update");
2323 prop = RNA_def_property(srna, "limit_method", PROP_ENUM, PROP_NONE);
2324 RNA_def_property_enum_sdna(prop, NULL, "lim_flags");
2325 RNA_def_property_enum_items(prop, prop_limit_method_items);
2326 RNA_def_property_ui_text(prop, "Limit Method", "");
2327 RNA_def_property_update(prop, 0, "rna_Modifier_update");
2329 prop = RNA_def_property(srna, "edge_weight_method", PROP_ENUM, PROP_NONE);
2330 RNA_def_property_enum_sdna(prop, NULL, "e_flags");
2331 RNA_def_property_enum_items(prop, prop_edge_weight_method_items);
2332 RNA_def_property_ui_text(prop, "Edge Weight Method", "What edge weight to use for weighting a vertex");
2333 RNA_def_property_update(prop, 0, "rna_Modifier_update");
2335 #if 1 /* expose as radians */
2336 prop = RNA_def_property(srna, "angle_limit", PROP_FLOAT, PROP_ANGLE);
2337 RNA_def_property_float_funcs(prop, "rna_BevelModifier_angle_limit_get",
2338 "rna_BevelModifier_angle_limit_set", NULL);
2339 RNA_def_property_range(prop, 0, DEG2RAD(180));
2340 RNA_def_property_ui_range(prop, 0, DEG2RAD(180), 100, 2);
2342 prop = RNA_def_property(srna, "angle_limit", PROP_FLOAT, PROP_NONE);
2343 RNA_def_property_float_sdna(prop, NULL, "bevel_angle");
2344 RNA_def_property_range(prop, 0, 180);
2345 RNA_def_property_ui_range(prop, 0, 180, 100, 2);
2347 RNA_def_property_ui_text(prop, "Angle", "Angle above which to bevel edges");
2348 RNA_def_property_update(prop, 0, "rna_Modifier_update");
2350 #ifdef USE_BM_BEVEL_OP_AS_MOD
2351 prop = RNA_def_property(srna, "use_even_offset", PROP_BOOLEAN, PROP_NONE); /* name matches solidify */
2352 RNA_def_property_boolean_sdna(prop, NULL, "flags", BME_BEVEL_EVEN);
2353 RNA_def_property_ui_text(prop, "Even", "Use even bevel distance correction");
2354 RNA_def_property_update(prop, 0, "rna_Modifier_update");
2356 prop = RNA_def_property(srna, "use_distance_offset", PROP_BOOLEAN, PROP_NONE);
2357 RNA_def_property_boolean_sdna(prop, NULL, "flags", BME_BEVEL_DIST);
2358 RNA_def_property_ui_text(prop, "Distance",
2359 "Use the width as a distance in rather then a factor of the face size");
2360 RNA_def_property_update(prop, 0, "rna_Modifier_update");
2365 static void rna_def_modifier_shrinkwrap(BlenderRNA *brna)
2370 static EnumPropertyItem shrink_type_items[] = {
2371 {MOD_SHRINKWRAP_NEAREST_SURFACE, "NEAREST_SURFACEPOINT", 0, "Nearest Surface Point",
2372 "Shrink the mesh to the nearest target surface"},
2373 {MOD_SHRINKWRAP_PROJECT, "PROJECT", 0, "Project",
2374 "Shrink the mesh to the nearest target surface along a given axis"},
2375 {MOD_SHRINKWRAP_NEAREST_VERTEX, "NEAREST_VERTEX", 0, "Nearest Vertex",
2376 "Shrink the mesh to the nearest target vertex"},
2377 {0, NULL, 0, NULL, NULL}
2380 static EnumPropertyItem shrink_face_cull_items[] = {
2381 {0, "OFF", 0, "Off", "No culling"},
2382 {MOD_SHRINKWRAP_CULL_TARGET_FRONTFACE, "FRONT", 0, "Front", "No projection when in front of the face"},
2383 {MOD_SHRINKWRAP_CULL_TARGET_BACKFACE, "BACK", 0, "Back", "No projection when behind the face"},
2384 {0, NULL, 0, NULL, NULL}
2387 srna = RNA_def_struct(brna, "ShrinkwrapModifier", "Modifier");
2388 RNA_def_struct_ui_text(srna, "Shrinkwrap Modifier",
2389 "Shrink wrapping modifier to shrink wrap and object to a target");
2390 RNA_def_struct_sdna(srna, "ShrinkwrapModifierData");
2391 RNA_def_struct_ui_icon(srna, ICON_MOD_SHRINKWRAP);
2393 prop = RNA_def_property(srna, "wrap_method", PROP_ENUM, PROP_NONE);
2394 RNA_def_property_enum_sdna(prop, NULL, "shrinkType");
2395 RNA_def_property_enum_items(prop, shrink_type_items);
2396 RNA_def_property_ui_text(prop, "Mode", "");
2397 RNA_def_property_update(prop, 0, "rna_Modifier_update");
2399 prop = RNA_def_property(srna, "cull_face", PROP_ENUM, PROP_NONE);
2400 RNA_def_property_enum_sdna(prop, NULL, "shrinkOpts");
2401 RNA_def_property_enum_items(prop, shrink_face_cull_items);
2402 RNA_def_property_enum_funcs(prop, "rna_ShrinkwrapModifier_face_cull_get",
2403 "rna_ShrinkwrapModifier_face_cull_set", NULL);
2404 RNA_def_property_ui_text(prop, "Face Cull",
2405 "Stop vertices from projecting to a face on the target when facing towards/away");
2406 RNA_def_property_update(prop, 0, "rna_Modifier_update");
2408 prop = RNA_def_property(srna, "target", PROP_POINTER, PROP_NONE);
2409 RNA_def_property_ui_text(prop, "Target", "Mesh target to shrink to");
2410 RNA_def_property_pointer_funcs(prop, NULL, "rna_ShrinkwrapModifier_target_set", NULL, "rna_Mesh_object_poll");
2411 RNA_def_property_flag(prop, PROP_EDITABLE | PROP_ID_SELF_CHECK);
2412 RNA_def_property_update(prop, 0, "rna_Modifier_dependency_update");
2414 prop = RNA_def_property(srna, "auxiliary_target", PROP_POINTER, PROP_NONE);
2415 RNA_def_property_pointer_sdna(prop, NULL, "auxTarget");
2416 RNA_def_property_ui_text(prop, "Auxiliary Target", "Additional mesh target to shrink to");
2417 RNA_def_property_pointer_funcs(prop, NULL, "rna_ShrinkwrapModifier_auxiliary_target_set", NULL,
2418 "rna_Mesh_object_poll");
2419 RNA_def_property_flag(prop, PROP_EDITABLE | PROP_ID_SELF_CHECK);
2420 RNA_def_property_update(prop, 0, "rna_Modifier_dependency_update");
2422 prop = RNA_def_property(srna, "vertex_group", PROP_STRING, PROP_NONE);
2423 RNA_def_property_string_sdna(prop, NULL, "vgroup_name");
2424 RNA_def_property_ui_text(prop, "Vertex Group", "Vertex group name");
2425 RNA_def_property_string_funcs(prop, NULL, NULL, "rna_ShrinkwrapModifier_vgroup_set");
2426 RNA_def_property_update(prop, 0, "rna_Modifier_update");
2428 prop = RNA_def_property(srna, "offset", PROP_FLOAT, PROP_NONE);
2429 RNA_def_property_float_sdna(prop, NULL, "keepDist");
2430 RNA_def_property_range(prop, -FLT_MAX, FLT_MAX);
2431 RNA_def_property_ui_range(prop, -100, 100, 1, 2);
2432 RNA_def_property_ui_text(prop, "Offset", "Distance to keep from the target");
2433 RNA_def_property_update(prop, 0, "rna_Modifier_update");
2435 prop = RNA_def_property(srna, "project_limit", PROP_FLOAT, PROP_NONE);
2436 RNA_def_property_float_sdna(prop, NULL, "projLimit");
2437 RNA_def_property_range(prop, 0.0, FLT_MAX);
2438 RNA_def_property_ui_range(prop, 0, 100, 1, 2);
2439 RNA_def_property_ui_text(prop, "Project Limit", "Limit the distance used for projection (zero disables)");
2440 RNA_def_property_update(prop, 0, "rna_Modifier_update");
2442 prop = RNA_def_property(srna, "use_project_x", PROP_BOOLEAN, PROP_NONE);
2443 RNA_def_property_boolean_sdna(prop, NULL, "projAxis", MOD_SHRINKWRAP_PROJECT_OVER_X_AXIS);
2444 RNA_def_property_ui_text(prop, "X", "");
2445 RNA_def_property_update(prop, 0, "rna_Modifier_update");
2447 prop = RNA_def_property(srna, "use_project_y", PROP_BOOLEAN, PROP_NONE);
2448 RNA_def_property_boolean_sdna(prop, NULL, "projAxis", MOD_SHRINKWRAP_PROJECT_OVER_Y_AXIS);
2449 RNA_def_property_ui_text(prop, "Y", "");
2450 RNA_def_property_update(prop, 0, "rna_Modifier_update");
2452 prop = RNA_def_property(srna, "use_project_z", PROP_BOOLEAN, PROP_NONE);
2453 RNA_def_property_boolean_sdna(prop, NULL, "projAxis", MOD_SHRINKWRAP_PROJECT_OVER_Z_AXIS);
2454 RNA_def_property_ui_text(prop, "Z", "");
2455 RNA_def_property_update(prop, 0, "rna_Modifier_update");
2457 prop = RNA_def_property(srna, "subsurf_levels", PROP_INT, PROP_NONE);
2458 RNA_def_property_int_sdna(prop, NULL, "subsurfLevels");
2459 RNA_def_property_range(prop, 0, 6);
2460 RNA_def_property_ui_range(prop, 0, 6, 1, 0);
2461 RNA_def_property_ui_text(prop, "Subsurf Levels",
2462 "Number of subdivisions that must be performed before extracting vertices' "
2463 "positions and normals");
2464 RNA_def_property_update(prop, 0, "rna_Modifier_update");
2466 prop = RNA_def_property(srna, "use_negative_direction", PROP_BOOLEAN, PROP_NONE);
2467 RNA_def_property_boolean_sdna(prop, NULL, "shrinkOpts", MOD_SHRINKWRAP_PROJECT_ALLOW_NEG_DIR);
2468 RNA_def_property_ui_text(prop, "Negative", "Allow vertices to move in the negative direction of axis");
2469 RNA_def_property_update(prop, 0, "rna_Modifier_update");
2471 prop = RNA_def_property(srna, "use_positive_direction", PROP_BOOLEAN, PROP_NONE);
2472 RNA_def_property_boolean_sdna(prop, NULL, "shrinkOpts", MOD_SHRINKWRAP_PROJECT_ALLOW_POS_DIR);
2473 RNA_def_property_ui_text(prop, "Positive", "Allow vertices to move in the positive direction of axis");
2474 RNA_def_property_update(prop, 0, "rna_Modifier_update");
2476 prop = RNA_def_property(srna, "use_keep_above_surface", PROP_BOOLEAN, PROP_NONE);
2477 RNA_def_property_boolean_sdna(prop, NULL, "shrinkOpts", MOD_SHRINKWRAP_KEEP_ABOVE_SURFACE);
2478 RNA_def_property_ui_text(prop, "Keep Above Surface", "");
2479 RNA_def_property_update(prop, 0, "rna_Modifier_update");
2482 static void rna_def_modifier_fluidsim(BlenderRNA *brna)
2487 srna = RNA_def_struct(brna, "FluidSimulationModifier", "Modifier");
2488 RNA_def_struct_ui_text(srna, "Fluid Simulation Modifier", "Fluid simulation modifier");
2489 RNA_def_struct_sdna(srna, "FluidsimModifierData");
2490 RNA_def_struct_ui_icon(srna, ICON_MOD_FLUIDSIM);
2492 prop = RNA_def_property(srna, "settings", PROP_POINTER, PROP_NONE);
2493 RNA_def_property_flag(prop, PROP_NEVER_NULL);
2494 RNA_def_property_pointer_sdna(prop, NULL, "fss");
2495 RNA_def_property_ui_text(prop, "Settings", "Settings for how this object is used in the fluid simulation");
2498 static void rna_def_modifier_mask(BlenderRNA *brna)
2503 static EnumPropertyItem modifier_mask_mode_items[] = {
2504 {MOD_MASK_MODE_VGROUP, "VERTEX_GROUP", 0, "Vertex Group", ""},
2505 {MOD_MASK_MODE_ARM, "ARMATURE", 0, "Armature", ""},
2506 {0, NULL, 0, NULL, NULL}
2509 srna = RNA_def_struct(brna, "MaskModifier", "Modifier");
2510 RNA_def_struct_ui_text(srna, "Mask Modifier", "Mask modifier to hide parts of the mesh");
2511 RNA_def_struct_sdna(srna, "MaskModifierData");
2512 RNA_def_struct_ui_icon(srna, ICON_MOD_MASK);
2514 prop = RNA_def_property(srna, "mode", PROP_ENUM, PROP_NONE);
2515 RNA_def_property_enum_items(prop, modifier_mask_mode_items);
2516 RNA_def_property_ui_text(prop, "Mode", "");
2517 RNA_def_property_update(prop, 0, "rna_Modifier_update");
2519 prop = RNA_def_property(srna, "armature", PROP_POINTER, PROP_NONE);
2520 RNA_def_property_pointer_sdna(prop, NULL, "ob_arm");
2521 RNA_def_property_ui_text(prop, "Armature", "Armature to use as source of bones to mask");
2522 RNA_def_property_pointer_funcs(prop, NULL, "rna_MaskModifier_armature_set", NULL, "rna_Armature_object_poll");
2523 RNA_def_property_flag(prop, PROP_EDITABLE | PROP_ID_SELF_CHECK);
2524 RNA_def_property_update(prop, 0, "rna_Modifier_dependency_update");
2526 prop = RNA_def_property(srna, "vertex_group", PROP_STRING, PROP_NONE);
2527 RNA_def_property_string_sdna(prop, NULL, "vgroup");
2528 RNA_def_property_ui_text(prop, "Vertex Group", "Vertex group name");
2529 RNA_def_property_string_funcs(prop, NULL, NULL, "rna_MaskModifier_vgroup_set");
2530 RNA_def_property_update(prop, 0, "rna_Modifier_update");
2532 prop = RNA_def_property(srna, "invert_vertex_group", PROP_BOOLEAN, PROP_NONE);
2533 RNA_def_property_boolean_sdna(prop, NULL, "flag", MOD_MASK_INV);
2534 RNA_def_property_ui_text(prop, "Invert", "Use vertices that are not part of region defined");
2535 RNA_def_property_update(prop, 0, "rna_Modifier_update");
2538 static void rna_def_modifier_simpledeform(BlenderRNA *brna)
2543 static EnumPropertyItem simple_deform_mode_items[] = {
2544 {MOD_SIMPLEDEFORM_MODE_TWIST, "TWIST", 0, "Twist", "Rotate around the Z axis of the modifier space"},
2545 {MOD_SIMPLEDEFORM_MODE_BEND, "BEND", 0, "Bend", "Bend the mesh over the Z axis of the modifier space"},
2546 {MOD_SIMPLEDEFORM_MODE_TAPER, "TAPER", 0, "Taper", "Linearly scale along Z axis of the modifier space"},
2547 {MOD_SIMPLEDEFORM_MODE_STRETCH, "STRETCH", 0, "Stretch",
2548 "Stretch the object along the Z axis of the modifier space"},
2549 {0, NULL, 0, NULL, NULL}
2552 srna = RNA_def_struct(brna, "SimpleDeformModifier", "Modifier");
2553 RNA_def_struct_ui_text(srna, "SimpleDeform Modifier",
2554 "Simple deformation modifier to apply effects such as twisting and bending");
2555 RNA_def_struct_sdna(srna, "SimpleDeformModifierData");
2556 RNA_def_struct_ui_icon(srna, ICON_MOD_SIMPLEDEFORM);
2558 prop = RNA_def_property(srna, "deform_method", PROP_ENUM, PROP_NONE);
2559 RNA_def_property_enum_sdna(prop, NULL, "mode");
2560 RNA_def_property_enum_items(prop, simple_deform_mode_items);
2561 RNA_def_property_ui_text(prop, "Mode", "");
2562 RNA_def_property_update(prop, 0, "rna_Modifier_update");
2564 prop = RNA_def_property(srna, "vertex_group", PROP_STRING, PROP_NONE);
2565 RNA_def_property_string_sdna(prop, NULL, "vgroup_name");
2566 RNA_def_property_ui_text(prop, "Vertex Group", "Vertex group name");
2567 RNA_def_property_string_funcs(prop, NULL, NULL, "rna_SimpleDeformModifier_vgroup_set");
2568 RNA_def_property_update(prop, 0, "rna_Modifier_update");
2570 prop = RNA_def_property(srna, "origin", PROP_POINTER, PROP_NONE);
2571 RNA_def_property_ui_text(prop, "Origin", "Origin of modifier space coordinates");
2572 RNA_def_property_flag(prop, PROP_EDITABLE | PROP_ID_SELF_CHECK);
2573 RNA_def_property_update(prop, 0, "rna_Modifier_dependency_update");
2575 prop = RNA_def_property(srna, "use_relative", PROP_BOOLEAN, PROP_NONE);
2576 RNA_def_property_boolean_sdna(prop, NULL, "originOpts", MOD_SIMPLEDEFORM_ORIGIN_LOCAL);
2577 RNA_def_property_ui_text(prop, "Relative", "Set the origin of deform space to be relative to the object");
2578 RNA_def_property_update(prop, 0, "rna_Modifier_update");
2580 prop = RNA_def_property(srna, "factor", PROP_FLOAT, PROP_NONE);
2581 RNA_def_property_range(prop, -FLT_MAX, FLT_MAX);
2582 RNA_def_property_ui_range(prop, -10, 10, 1, 3);
2583 RNA_def_property_ui_text(prop, "Factor", "Amount to deform object");
2584 RNA_def_property_update(prop, 0, "rna_Modifier_update");
2586 prop = RNA_def_property(srna, "limits", PROP_FLOAT, PROP_NONE);
2587 RNA_def_property_float_sdna(prop, NULL, "limit");
2588 RNA_def_property_array(prop, 2);
2589 RNA_def_property_range(prop, 0, 1);
2590 RNA_def_property_ui_range(prop, 0, 1, 5, 2);
2591 RNA_def_property_ui_text(prop, "Limits", "Lower/Upper limits for deform");
2592 RNA_def_property_update(prop, 0, "rna_Modifier_update");
2594 prop = RNA_def_property(srna, "lock_x", PROP_BOOLEAN, PROP_NONE);
2595 RNA_def_property_boolean_sdna(prop, NULL, "axis", MOD_SIMPLEDEFORM_LOCK_AXIS_X);
2596 RNA_def_property_ui_text(prop, "Lock X Axis", "Do not allow deformation along the X axis");
2597 RNA_def_property_update(prop, 0, "rna_Modifier_update");
2599 prop = RNA_def_property(srna, "lock_y", PROP_BOOLEAN, PROP_NONE);
2600 RNA_def_property_boolean_sdna(prop, NULL, "axis", MOD_SIMPLEDEFORM_LOCK_AXIS_Y);
2601 RNA_def_property_ui_text(prop, "Lock Y Axis", "Do not allow deformation along the Y axis");
2602 RNA_def_property_update(prop, 0, "rna_Modifier_update");
2605 static void rna_def_modifier_surface(BlenderRNA *brna)
2609 srna = RNA_def_struct(brna, "SurfaceModifier", "Modifier");
2610 RNA_def_struct_ui_text(srna, "Surface Modifier",
2611 "Surface modifier defining modifier stack position used for surface fields");
2612 RNA_def_struct_sdna(srna, "SurfaceModifierData");
2613 RNA_def_struct_ui_icon(srna, ICON_MOD_PHYSICS);
2616 static void rna_def_modifier_solidify(BlenderRNA *brna)
2621 srna = RNA_def_struct(brna, "SolidifyModifier", "Modifier");
2622 RNA_def_struct_ui_text(srna, "Solidify Modifier",
2623 "Create a solid skin by extruding, compensating for sharp angles");
2624 RNA_def_struct_sdna(srna, "SolidifyModifierData");
2625 RNA_def_struct_ui_icon(srna, ICON_MOD_SOLIDIFY);
2627 prop = RNA_def_property(srna, "thickness", PROP_FLOAT, PROP_DISTANCE);
2628 RNA_def_property_float_sdna(prop, NULL, "offset");
2629 RNA_def_property_range(prop, -FLT_MAX, FLT_MAX);
2630 RNA_def_property_ui_range(prop, -10, 10, 0.1, 4);
2631 RNA_def_property_ui_text(prop, "Thickness", "Thickness of the shell");
2632 RNA_def_property_update(prop, 0, "rna_Modifier_update");
2634 prop = RNA_def_property(srna, "thickness_vertex_group", PROP_FLOAT, PROP_FACTOR);
2635 RNA_def_property_float_sdna(prop, NULL, "offset_fac_vg");
2636 RNA_def_property_range(prop, 0.0, 1.0);
2637 RNA_def_property_ui_range(prop, 0, 1, 0.1, 3);
2638 RNA_def_property_ui_text(prop, "Vertex Group Factor",
2639 "Thickness factor to use for zero vertex group influence");
2640 RNA_def_property_update(prop, 0, "rna_Modifier_update");
2642 prop = RNA_def_property(srna, "offset", PROP_FLOAT, PROP_FACTOR);
2643 RNA_def_property_float_sdna(prop, NULL, "offset_fac");
2644 RNA_def_property_range(prop, -FLT_MAX, FLT_MAX);
2645 RNA_def_property_ui_range(prop, -1, 1, 0.1, 4);
2646 RNA_def_property_ui_text(prop, "Offset", "Offset the thickness from the center");
2647 RNA_def_property_update(prop, 0, "rna_Modifier_update");
2649 prop = RNA_def_property(srna, "edge_crease_inner", PROP_FLOAT, PROP_FACTOR);
2650 RNA_def_property_float_sdna(prop, NULL, "crease_inner");
2651 RNA_def_property_range(prop, 0, 1);
2652 RNA_def_property_ui_range(prop, 0, 1, 0.1, 3);
2653 RNA_def_property_ui_text(prop, "Inner Crease", "Assign a crease to inner edges");
2654 RNA_def_property_update(prop, 0, "rna_Modifier_update");
2656 prop = RNA_def_property(srna, "edge_crease_outer", PROP_FLOAT, PROP_FACTOR);
2657 RNA_def_property_float_sdna(prop, NULL, "crease_outer");
2658 RNA_def_property_range(prop, 0, 1);
2659 RNA_def_property_ui_range(prop, 0, 1, 0.1, 3);
2660 RNA_def_property_ui_text(prop, "Outer Crease", "Assign a crease to outer edges");
2661 RNA_def_property_update(prop, 0, "rna_Modifier_update");
2663 prop = RNA_def_property(srna, "edge_crease_rim", PROP_FLOAT, PROP_FACTOR);
2664 RNA_def_property_float_sdna(prop, NULL, "crease_rim");
2665 RNA_def_property_range(prop, 0, 1);
2666 RNA_def_property_ui_range(prop, 0, 1, 0.1, 3);
2667 RNA_def_property_ui_text(prop, "Rim Crease", "Assign a crease to the edges making up the rim");
2668 RNA_def_property_update(prop, 0, "rna_Modifier_update");
2670 prop = RNA_def_property(srna, "material_offset", PROP_INT, PROP_NONE);
2671 RNA_def_property_int_sdna(prop, NULL, "mat_ofs");
2672 RNA_def_property_range(prop, SHRT_MIN, SHRT_MAX);
2673 RNA_def_property_ui_text(prop, "Material Offset", "Offset material index of generated faces");
2674 RNA_def_property_update(prop, 0, "rna_Modifier_update");
2676 prop = RNA_def_property(srna, "material_offset_rim", PROP_INT, PROP_NONE);
2677 RNA_def_property_int_sdna(prop, NULL, "mat_ofs_rim");
2678 RNA_def_property_range(prop, SHRT_MIN, SHRT_MAX);
2679 RNA_def_property_ui_text(prop, "Rim Material Offset", "Offset material index of generated rim faces");
2680 RNA_def_property_update(prop, 0, "rna_Modifier_update");
2682 prop = RNA_def_property(srna, "vertex_group", PROP_STRING, PROP_NONE);
2683 RNA_def_property_string_sdna(prop, NULL, "defgrp_name");
2684 RNA_def_property_ui_text(prop, "Vertex Group", "Vertex group name");
2685 RNA_def_property_string_funcs(prop, NULL, NULL, "rna_SolidifyModifier_vgroup_set");
2686 RNA_def_property_update(prop, 0, "rna_Modifier_update");
2688 prop = RNA_def_property(srna, "use_rim", PROP_BOOLEAN, PROP_NONE);
2689 RNA_def_property_boolean_sdna(prop, NULL, "flag", MOD_SOLIDIFY_RIM);
2690 RNA_def_property_ui_text(prop, "Fill Rim",
2691 "Create edge loops between the inner and outer surfaces on face edges "
2692 "(slow, disable when not needed)");
2693 RNA_def_property_update(prop, 0, "rna_Modifier_update");
2695 prop = RNA_def_property(srna, "use_even_offset", PROP_BOOLEAN, PROP_NONE);
2696 RNA_def_property_boolean_sdna(prop, NULL, "flag", MOD_SOLIDIFY_EVEN);
2697 RNA_def_property_ui_text(prop, "Even Thickness",
2698 "Maintain thickness by adjusting for sharp corners (slow, disable when not needed)");
2699 RNA_def_property_update(prop, 0, "rna_Modifier_update");
2701 prop = RNA_def_property(srna, "use_quality_normals", PROP_BOOLEAN, PROP_NONE);
2702 RNA_def_property_boolean_sdna(prop, NULL, "flag", MOD_SOLIDIFY_NORMAL_CALC);
2703 RNA_def_property_ui_text(prop, "High Quality Normals",
2704 "Calculate normals which result in more even thickness (slow, disable when not needed)");
2705 RNA_def_property_update(prop, 0, "rna_Modifier_update");
2707 prop = RNA_def_property(srna, "invert_vertex_group", PROP_BOOLEAN, PROP_NONE);
2708 RNA_def_property_boolean_sdna(prop, NULL, "flag", MOD_SOLIDIFY_VGROUP_INV);
2709 RNA_def_property_ui_text(prop, "Vertex Group Invert", "Invert the vertex group influence");
2710 RNA_def_property_update(prop, 0, "rna_Modifier_update");
2712 prop = RNA_def_property(srna, "use_flip_normals", PROP_BOOLEAN, PROP_NONE);
2713 RNA_def_property_boolean_sdna(prop, NULL, "flag", MOD_SOLIDIFY_FLIP);
2714 RNA_def_property_ui_text(prop, "Flip Normals", "Invert the face direction");
2715 RNA_def_property_update(prop, 0, "rna_Modifier_update");
2718 static void rna_def_modifier_screw(BlenderRNA *brna)
2720 static EnumPropertyItem axis_items[] = {
2721 {0, "X", 0, "X Axis", ""},
2722 {1, "Y", 0, "Y Axis", ""},
2723 {2, "Z", 0, "Z Axis", ""},
2724 {0, NULL, 0, NULL, NULL}
2730 srna = RNA_def_struct(brna, "ScrewModifier", "Modifier");
2731 RNA_def_struct_ui_text(srna, "Screw Modifier", "Revolve edges");
2732 RNA_def_struct_sdna(srna, "ScrewModifierData");
2733 RNA_def_struct_ui_icon(srna, ICON_MOD_SCREW);
2735 prop = RNA_def_property(srna, "object", PROP_POINTER, PROP_NONE);
2736 RNA_def_property_pointer_sdna(prop, NULL, "ob_axis");
2737 RNA_def_property_ui_text(prop, "Object", "Object to define the screw axis");
2738 RNA_def_property_flag(prop, PROP_EDITABLE | PROP_ID_SELF_CHECK);
2739 RNA_def_property_update(prop, 0, "rna_Modifier_dependency_update");
2741 prop = RNA_def_property(srna, "steps", PROP_INT, PROP_UNSIGNED);
2742 RNA_def_property_range(prop, 2, 10000);
2743 RNA_def_property_ui_range(prop, 3, 512, 1, 0);
2744 RNA_def_property_ui_text(prop, "Steps", "Number of steps in the revolution");
2745 RNA_def_property_update(prop, 0, "rna_Modifier_update");
2747 prop = RNA_def_property(srna, "render_steps", PROP_INT, PROP_UNSIGNED);
2748 RNA_def_property_range(prop, 2, 10000);
2749 RNA_def_property_ui_range(prop, 2, 512, 1, 0);
2750 RNA_def_property_ui_text(prop, "Render Steps", "Number of steps in the revolution");
2751 RNA_def_property_update(prop, 0, "rna_Modifier_update");
2753 prop = RNA_def_property(srna, "iterations", PROP_INT, PROP_UNSIGNED);
2754 RNA_def_property_int_sdna(prop, NULL, "iter");
2755 RNA_def_property_range(prop, 1, 10000);
2756 RNA_def_property_ui_range(prop, 1, 100, 1, 0);
2757 RNA_def_property_ui_text(prop, "Iterations", "Number of times to apply the screw operation");
2758 RNA_def_property_update(prop, 0, "rna_Modifier_update");
2760 prop = RNA_def_property(srna, "axis", PROP_ENUM, PROP_NONE);
2761 RNA_def_property_enum_items(prop, axis_items);
2762 RNA_def_property_ui_text(prop, "Axis", "Screw axis");
2763 RNA_def_property_update(prop, 0, "rna_Modifier_update");
2765 prop = RNA_def_property(srna, "angle", PROP_FLOAT, PROP_ANGLE);
2766 RNA_def_property_ui_range(prop, 0, -M_PI * 2, M_PI * 2, 2);
2767 RNA_def_property_range(prop, -FLT_MAX, FLT_MAX);
2768 RNA_def_property_ui_text(prop, "Angle", "Angle of revolution");
2769 RNA_def_property_update(prop, 0, "rna_Modifier_update");
2771 prop = RNA_def_property(srna, "screw_offset", PROP_FLOAT, PROP_DISTANCE);
2772 RNA_def_property_float_sdna(prop, NULL, "screw_ofs");
2773 RNA_def_property_ui_text(prop, "Screw", "Offset the revolution along its axis");
2774 RNA_def_property_update(prop, 0, "rna_Modifier_update");
2776 prop = RNA_def_property(srna, "use_normal_flip", PROP_BOOLEAN, PROP_NONE);
2777 RNA_def_property_boolean_sdna(prop, NULL, "flag", MOD_SCREW_NORMAL_FLIP);
2778 RNA_def_property_ui_text(prop, "Flip", "Flip normals of lathed faces");
2779 RNA_def_property_update(prop, 0, "rna_Modifier_update");
2781 prop = RNA_def_property(srna, "use_normal_calculate", PROP_BOOLEAN, PROP_NONE);
2782 RNA_def_property_boolean_sdna(prop, NULL, "flag", MOD_SCREW_NORMAL_CALC);
2783 RNA_def_property_ui_text(prop, "Calc Order", "Calculate the order of edges (needed for meshes, but not curves)");
2784 RNA_def_property_update(prop, 0, "rna_Modifier_update");
2786 prop = RNA_def_property(srna, "use_object_screw_offset", PROP_BOOLEAN, PROP_NONE);
2787 RNA_def_property_boolean_sdna(prop, NULL, "flag", MOD_SCREW_OBJECT_OFFSET);
2788 RNA_def_property_ui_text(prop, "Object Screw", "Use the distance between the objects to make a screw");
2789 RNA_def_property_update(prop, 0, "rna_Modifier_update");
2791 prop = RNA_def_property(srna, "use_smooth_shade", PROP_BOOLEAN, PROP_NONE);
2792 RNA_def_property_boolean_sdna(prop, NULL, "flag", MOD_SCREW_SMOOTH_SHADING);
2793 RNA_def_property_ui_text(prop, "Smooth Shading", "Output faces with smooth shading rather than flat shaded");
2794 RNA_def_property_update(prop, 0, "rna_Modifier_update");
2797 prop = RNA_def_property(srna, "use_angle_object", PROP_BOOLEAN, PROP_NONE);
2798 RNA_def_property_boolean_sdna(prop, NULL, "flag", MOD_SCREW_OBJECT_ANGLE);
2799 RNA_def_property_ui_text(prop, "Object Angle", "Use the angle between the objects rather than the fixed angle");
2800 RNA_def_property_update(prop, 0, "rna_Modifier_update");
2804 static void rna_def_modifier_uvwarp(BlenderRNA *brna)
2809 static EnumPropertyItem uvwarp_axis[] = {
2810 {0, "X", 0, "X", ""},
2811 {1, "Y", 0, "Y", ""},
2812 {2, "Z", 0, "Z", ""},
2813 {0, NULL, 0, NULL, NULL}
2816 srna = RNA_def_struct(brna, "UVWarpModifier", "Modifier");
2817 RNA_def_struct_ui_text(srna, "UVWarp Modifier", "Add target position to uv coordinates");
2818 RNA_def_struct_sdna(srna, "UVWarpModifierData");
2819 RNA_def_struct_ui_icon(srna, ICON_MOD_UVPROJECT);
2821 prop = RNA_def_property(srna, "axis_u", PROP_ENUM, PROP_NONE);
2822 RNA_def_property_enum_sdna(prop, NULL, "axis_u");
2823 RNA_def_property_enum_items(prop, uvwarp_axis);
2824 RNA_def_property_ui_text(prop, "U-Axis", "Pole axis for rotation");
2825 RNA_def_property_update(prop, 0, "rna_Modifier_update");
2827 prop = RNA_def_property(srna, "axis_v", PROP_ENUM, PROP_NONE);
2828 RNA_def_property_enum_sdna(prop, NULL, "axis_v");
2829 RNA_def_property_enum_items(prop, uvwarp_axis);
2830 RNA_def_property_ui_text(prop, "V-Axis", "Pole axis for rotation");
2831 RNA_def_property_update(prop, 0, "rna_Modifier_update");
2833 prop = RNA_def_property(srna, "center", PROP_FLOAT, PROP_NONE);
2834 RNA_def_property_float_sdna(prop, NULL, "center");
2835 RNA_def_property_ui_text(prop, "UV Center", "Center point for rotate/scale");
2836 RNA_def_property_update(prop, 0, "rna_Modifier_update");
2838 prop = RNA_def_property(srna, "object_from", PROP_POINTER, PROP_NONE);
2839 RNA_def_property_pointer_sdna(prop, NULL, "object_src");
2840 RNA_def_property_ui_text(prop, "Target", "Object defining offset");
2841 RNA_def_property_flag(prop, PROP_EDITABLE);
2842 RNA_def_property_update(prop, 0, "rna_Modifier_dependency_update");
2844 prop = RNA_def_property(srna, "bone_from", PROP_STRING, PROP_NONE);
2845 RNA_def_property_string_sdna(prop, NULL, "bone_src");
2846 RNA_def_property_ui_text(prop, "Sub-Target", "Bone defining offset");
2847 RNA_def_property_update(prop, 0, "rna_Modifier_dependency_update");
2849 prop = RNA_def_property(srna, "object_to", PROP_POINTER, PROP_NONE);
2850 RNA_def_property_pointer_sdna(prop, NULL, "object_dst");
2851 RNA_def_property_ui_text(prop, "Target", "Object defining offset");
2852 RNA_def_property_flag(prop, PROP_EDITABLE);
2853 RNA_def_property_update(prop, 0, "rna_Modifier_dependency_update");
2855 prop = RNA_def_property(srna, "bone_to", PROP_STRING, PROP_NONE);
2856 RNA_def_property_string_sdna(prop, NULL, "bone_dst");
2857 RNA_def_property_ui_text(prop, "Sub-Target", "Bone defining offset");
2858 RNA_def_property_update(prop, 0, "rna_Modifier_dependency_update");
2860 prop = RNA_def_property(srna, "vertex_group", PROP_STRING, PROP_NONE);
2861 RNA_def_property_string_sdna(prop, NULL, "vgroup_name");
2862 RNA_def_property_ui_text(prop, "Vertex Group", "Vertex group name");
2863 RNA_def_property_string_funcs(prop, NULL, NULL, "rna_UVWarpModifier_vgroup_set");
2864 RNA_def_property_update(prop, 0, "rna_Modifier_update");
2866 prop = RNA_def_property(srna, "uv_layer", PROP_STRING, PROP_NONE);
2867 RNA_def_property_string_sdna(prop, NULL, "uvlayer_name");
2868 RNA_def_property_ui_text(prop, "UV Layer", "UV Layer name");
2869 RNA_def_property_string_funcs(prop, NULL, NULL, "rna_UVWarpModifier_uvlayer_set");
2870 RNA_def_property_update(prop, 0, "rna_Modifier_update");
2873 static void rna_def_modifier_weightvg_mask(BlenderRNA *UNUSED(brna), StructRNA *srna)
2875 static EnumPropertyItem weightvg_mask_tex_map_items[] = {
2876 {MOD_DISP_MAP_LOCAL, "LOCAL", 0, "Local", "Use local generated coordinates"},
2877 {MOD_DISP_MAP_GLOBAL, "GLOBAL", 0, "Global", "Use global coordinates"},
2878 {MOD_DISP_MAP_OBJECT, "OBJECT", 0, "Object", "Use local generated coordinates of another object"},
2879 {MOD_DISP_MAP_UV, "UV", 0, "UV", "Use coordinates from an UV layer"},
2880 {0, NULL, 0, NULL, NULL}
2883 static EnumPropertyItem weightvg_mask_tex_used_items[] = {
2884 {MOD_WVG_MASK_TEX_USE_INT, "INT", 0, "Intensity", ""},
2885 {MOD_WVG_MASK_TEX_USE_RED, "RED", 0, "Red", ""},
2886 {MOD_WVG_MASK_TEX_USE_GREEN, "GREEN", 0, "Green", ""},
2887 {MOD_WVG_MASK_TEX_USE_BLUE, "BLUE", 0, "Blue", ""},
2888 {MOD_WVG_MASK_TEX_USE_HUE, "HUE", 0, "Hue", ""},
2889 {MOD_WVG_MASK_TEX_USE_SAT, "SAT", 0, "Saturation", ""},
2890 {MOD_WVG_MASK_TEX_USE_VAL, "VAL", 0, "Value", ""},
2891 {MOD_WVG_MASK_TEX_USE_ALPHA, "ALPHA", 0, "Alpha", ""},
2892 {0, NULL, 0, NULL, NULL}
2897 prop = RNA_def_property(srna, "mask_constant", PROP_FLOAT, PROP_NONE);
2898 RNA_def_property_range(prop, -FLT_MAX, FLT_MAX);
2899 RNA_def_property_ui_range(prop, 0.0, 1.0, 1, 0);
2900 RNA_def_property_ui_text(prop, "Influence", "Global influence of current modifications on vgroup");
2901 RNA_def_property_update(prop, 0, "rna_Modifier_update");
2903 prop = RNA_def_property(srna, "mask_vertex_group", PROP_STRING, PROP_NONE);
2904 RNA_def_property_string_sdna(prop, NULL, "mask_defgrp_name");
2905 RNA_def_property_ui_text(prop, "Mask VGroup", "Masking vertex group name");
2906 RNA_def_property_string_funcs(prop, NULL, NULL, "rna_WeightVGModifier_mask_vgroup_set");
2907 RNA_def_property_update(prop, 0, "rna_Modifier_update");
2909 prop = RNA_def_property(srna, "mask_texture", PROP_POINTER, PROP_NONE);
2910 RNA_def_property_ui_text(prop, "Masking Tex", "Masking texture");
2911 RNA_def_property_flag(prop, PROP_EDITABLE);
2912 RNA_def_property_update(prop, 0, "rna_Modifier_update");
2914 prop = RNA_def_property(srna, "mask_tex_use_channel", PROP_ENUM, PROP_NONE);
2915 RNA_def_property_enum_items(prop, weightvg_mask_tex_used_items);
2916 RNA_def_property_ui_text(prop, "Use Channel", "Which texture channel to use for masking");
2917 RNA_def_property_update(prop, 0, "rna_Modifier_update");
2919 prop = RNA_def_property(srna, "mask_tex_mapping", PROP_ENUM, PROP_NONE);
2920 RNA_def_property_enum_items(prop, weightvg_mask_tex_map_items);
2921 RNA_def_property_ui_text(prop, "Texture Coordinates", "Which texture coordinates "
2922 "to use for mapping");
2923 RNA_def_property_update(prop, 0, "rna_Modifier_dependency_update");
2925 prop = RNA_def_property(srna, "mask_tex_uv_layer", PROP_STRING, PROP_NONE);
2926 RNA_def_property_string_sdna(prop, NULL, "mask_tex_uvlayer_name");
2927 RNA_def_property_ui_text(prop, "UV Map", "UV map name");
2928 RNA_def_property_string_funcs(prop, NULL, NULL, "rna_WeightVGModifier_mask_uvlayer_set");
2929 RNA_def_property_update(prop, 0, "rna_Modifier_update");
2931 prop = RNA_def_property(srna, "mask_tex_map_object", PROP_POINTER, PROP_NONE);
2932 RNA_def_property_pointer_sdna(prop, NULL, "mask_tex_map_obj");
2933 RNA_def_property_ui_text(prop, "Texture Coordinate Object", "Which object to take texture "
2934 "coordinates from");
2935 RNA_def_property_flag(prop, PROP_EDITABLE | PROP_ID_SELF_CHECK);
2936 RNA_def_property_update(prop, 0, "rna_Modifier_dependency_update");
2939 static void rna_def_modifier_weightvgedit(BlenderRNA *brna)
2941 static EnumPropertyItem weightvg_edit_falloff_type_items[] = {
2942 {MOD_WVG_MAPPING_NONE, "LINEAR", ICON_LINCURVE, "Linear", "Null action"},
2943 {MOD_WVG_MAPPING_CURVE, "CURVE", ICON_RNDCURVE, "Custom Curve", ""},
2944 {MOD_WVG_MAPPING_SHARP, "SHARP", ICON_SHARPCURVE, "Sharp", ""},
2945 {MOD_WVG_MAPPING_SMOOTH, "SMOOTH", ICON_SMOOTHCURVE, "Smooth", ""},
2946 {MOD_WVG_MAPPING_ROOT, "ROOT", ICON_ROOTCURVE, "Root", ""},
2947 {MOD_WVG_MAPPING_SPHERE, "ICON_SPHERECURVE", ICON_SPHERECURVE, "Sphere", ""},
2948 {MOD_WVG_MAPPING_RANDOM, "RANDOM", ICON_RNDCURVE, "Random", ""},
2949 {MOD_WVG_MAPPING_STEP, "STEP", ICON_NOCURVE /* Would need a better icon... */, "Median Step",
2950 "Map all values below 0.5 to 0.0, and all others to 1.0"},
2951 {0, NULL, 0, NULL, NULL}
2957 srna = RNA_def_struct(brna, "VertexWeightEditModifier", "Modifier");
2958 RNA_def_struct_ui_text(srna, "WeightVG Edit Modifier",
2959 "Edit the weights of vertices in a group");
2960 RNA_def_struct_sdna(srna, "WeightVGEditModifierData");
2961 RNA_def_struct_ui_icon(srna, ICON_MOD_VERTEX_WEIGHT);
2963 prop = RNA_def_property(srna, "vertex_group", PROP_STRING, PROP_NONE);
2964 RNA_def_property_string_sdna(prop, NULL, "defgrp_name");
2965 RNA_def_property_ui_text(prop, "Vertex Group", "Vertex group name");
2966 RNA_def_property_string_funcs(prop, NULL, NULL, "rna_WeightVGModifier_vgroup_set");
2967 RNA_def_property_update(prop, 0, "rna_Modifier_update");
2969 prop = RNA_def_property(srna, "falloff_type", PROP_ENUM, PROP_NONE);
2970 RNA_def_property_enum_items(prop, weightvg_edit_falloff_type_items);
2971 RNA_def_property_ui_text(prop, "Falloff Type", "How weights are mapped to their new values");
2972 RNA_def_property_update(prop, 0, "rna_Modifier_update");
2974 prop = RNA_def_property(srna, "use_add", PROP_BOOLEAN, PROP_NONE);
2975 RNA_def_property_boolean_sdna(prop, NULL, "edit_flags", MOD_WVG_EDIT_ADD2VG);
2976 RNA_def_property_ui_text(prop, "Group Add", "Add vertices with weight over threshold "
2978 RNA_def_property_update(prop, 0, "rna_Modifier_update");
2980 prop = RNA_def_property(srna, "use_remove", PROP_BOOLEAN, PROP_NONE);
2981 RNA_def_property_boolean_sdna(prop, NULL, "edit_flags", MOD_WVG_EDIT_REMFVG);
2982 RNA_def_property_ui_text(prop, "Group Remove", "Remove vertices with weight below threshold "
2984 RNA_def_property_update(prop, 0, "rna_Modifier_update");
2986 prop = RNA_def_property(srna, "default_weight", PROP_FLOAT, PROP_NONE);
2987 RNA_def_property_range(prop, 0.0, 1.0f);
2988 RNA_def_property_ui_range(prop, 0.0, 1.0, 1, 0);
2989 RNA_def_property_ui_text(prop, "Default Weight", "Default weight a vertex will have if "
2990 "it is not in the vgroup");
2991 RNA_def_property_update(prop, 0, "rna_Modifier_update");
2993 prop = RNA_def_property(srna, "map_curve", PROP_POINTER, PROP_NONE);
2994 RNA_def_property_pointer_sdna(prop, NULL, "cmap_curve");
2995 RNA_def_property_ui_text(prop, "Mapping Curve", "Custom mapping curve");
2996 RNA_def_property_update(prop, 0, "rna_Modifier_update");
2998 prop = RNA_def_property(srna, "add_threshold", PROP_FLOAT, PROP_NONE);
2999 RNA_def_property_float_sdna(prop, NULL, "add_threshold");
3000 RNA_def_property_range(prop, 0.0, 1.0);
3001 RNA_def_property_ui_range(prop, 0.0, 1.0, 1, 0);
3002 RNA_def_property_ui_text(prop, "Add Threshold", "Lower bound for a vertex's weight "
3003 "to be added to the vgroup");
3004 RNA_def_property_update(prop, 0, "rna_Modifier_update");
3006 prop = RNA_def_property(srna, "remove_threshold", PROP_FLOAT, PROP_NONE);
3007 RNA_def_property_float_sdna(prop, NULL, "rem_threshold");
3008 RNA_def_property_range(prop, 0.0, 1.0);
3009 RNA_def_property_ui_range(prop, 0.0, 1.0, 1, 0);
3010 RNA_def_property_ui_text(prop, "Rem Threshold", "Upper bound for a vertex's weight "
3011 "to be removed from the vgroup");
3012 RNA_def_property_update(prop, 0, "rna_Modifier_update");
3014 /* Common masking properties. */
3015 rna_def_modifier_weightvg_mask(brna, srna);
3018 static void rna_def_modifier_weightvgmix(BlenderRNA *brna)
3020 static EnumPropertyItem weightvg_mix_modes_items[] = {
3021 {MOD_WVG_MIX_SET, "SET", 0, "Replace", "Replace VGroup A's weights by VGroup B's ones"},
3022 {MOD_WVG_MIX_ADD, "ADD", 0, "Add", "Add VGroup B's weights to VGroup A's ones"},
3023 {MOD_WVG_MIX_SUB, "SUB", 0, "Subtract", "Subtract VGroup B's weights from VGroup A's ones"},
3024 {MOD_WVG_MIX_MUL, "MUL", 0, "Multiply", "Multiply VGroup A's weights by VGroup B's ones"},
3025 {MOD_WVG_MIX_DIV, "DIV", 0, "Divide", "Divide VGroup A's weights by VGroup B's ones"},
3026 {MOD_WVG_MIX_DIF, "DIF", 0, "Difference", "Difference between VGroup A's and VGroup B's weights"},
3027 {MOD_WVG_MIX_AVG, "AVG", 0, "Average", "Average value of VGroup A's and VGroup B's weights"},
3028 {0, NULL, 0, NULL, NULL}
3031 static EnumPropertyItem weightvg_mix_set_items[] = {
3032 {MOD_WVG_SET_ALL, "ALL", 0, "All", "Affect all vertices (might add some to VGroup A)"},
3033 {MOD_WVG_SET_A, "A", 0, "VGroup A", "Affect vertices in VGroup A"},
3034 {MOD_WVG_SET_B, "B", 0, "VGroup B", "Affect vertices in VGroup B (might add some to VGroup A)"},
3035 {MOD_WVG_SET_OR, "OR", 0, "VGroup A or B",
3036 "Affect vertices in at least one of both VGroups (might add some to VGroup A)"},
3037 {MOD_WVG_SET_AND, "AND", 0, "VGroup A and B", "Affect vertices in both groups"},
3038 {0, NULL, 0, NULL, NULL}
3044 srna = RNA_def_struct(brna, "VertexWeightMixModifier", "Modifier");
3045 RNA_def_struct_ui_text(srna, "WeightVG Mix Modifier",
3046 "Mix the weights of two vertex groups");
3047 RNA_def_struct_sdna(srna, "WeightVGMixModifierData");
3048 RNA_def_struct_ui_icon(srna, ICON_MOD_VERTEX_WEIGHT);
3050 prop = RNA_def_property(srna, "vertex_group_a", PROP_STRING, PROP_NONE);
3051 RNA_def_property_string_sdna(prop, NULL, "defgrp_name_a");
3052 RNA_def_property_ui_text(prop, "Vertex Group A", "First vertex group name");
3053 RNA_def_property_string_funcs(prop, NULL, NULL, "rna_WeightVGModifier_vgroup_set");
3054 RNA_def_property_update(prop, 0, "rna_Modifier_update");
3056 prop = RNA_def_property(srna, "vertex_group_b", PROP_STRING, PROP_NONE);
3057 RNA_def_property_string_sdna(prop, NULL, "defgrp_name_b");
3058 RNA_def_property_ui_text(prop, "Vertex Group B", "Second vertex group name");
3059 RNA_def_property_string_funcs(prop, NULL, NULL, "rna_WeightVGMixModifier_vgroup2_set");
3060 RNA_def_property_update(prop, 0, "rna_Modifier_update");
3062 prop = RNA_def_property(srna, "default_weight_a", PROP_FLOAT, PROP_NONE);
3063 RNA_def_property_range(prop, 0.0, 1.0f);
3064 RNA_def_property_ui_range(prop, 0.0, 1.0, 1, 0);
3065 RNA_def_property_ui_text(prop, "Default Weight A", "Default weight a vertex will have if "
3066 "it is not in the first A vgroup");
3067 RNA_def_property_update(prop, 0, "rna_Modifier_update");
3069 prop = RNA_def_property(srna, "default_weight_b", PROP_FLOAT, PROP_NONE);
3070 RNA_def_property_range(prop, 0.0, 1.0f);
3071 RNA_def_property_ui_range(prop, 0.0, 1.0, 1, 0);
3072 RNA_def_property_ui_text(prop, "Default Weight B", "Default weight a vertex will have if "
3073 "it is not in the second B vgroup");
3074 RNA_def_property_update(prop, 0, "rna_Modifier_update");
3076 prop = RNA_def_property(srna, "mix_mode", PROP_ENUM, PROP_NONE);
3077 RNA_def_property_enum_items(prop, weightvg_mix_modes_items);
3078 RNA_def_property_ui_text(prop, "Mix Mode", "How weights from vgroup B affect weights "
3080 RNA_def_property_update(prop, 0, "rna_Modifier_update");
3082 prop = RNA_def_property(srna, "mix_set", PROP_ENUM, PROP_NONE);
3083 RNA_def_property_enum_items(prop, weightvg_mix_set_items);
3084 RNA_def_property_ui_text(prop, "Vertex Set", "Which vertices should be affected");
3085 RNA_def_property_update(prop, 0, "rna_Modifier_update");
3087 /* Common masking properties. */
3088 rna_def_modifier_weightvg_mask(brna, srna);
3091 static void rna_def_modifier_weightvgproximity(BlenderRNA *brna)
3093 static EnumPropertyItem weightvg_proximity_modes_items[] = {
3094 {MOD_WVG_PROXIMITY_OBJECT, "OBJECT", 0, "Object Distance",
3095 "Use distance between affected and target objects"},
3096 {MOD_WVG_PROXIMITY_GEOMETRY, "GEOMETRY", 0, "Geometry Distance",
3097 "Use distance between affected object's vertices and target "
3098 "object, or target object's geometry"},
3099 {0, NULL, 0, NULL, NULL}
3102 static EnumPropertyItem proximity_geometry_items[] = {
3103 {MOD_WVG_PROXIMITY_GEOM_VERTS, "VERTEX", ICON_VERTEXSEL, "Vertex", "Compute distance to nearest vertex"},
3104 {MOD_WVG_PROXIMITY_GEOM_EDGES, "EDGE", ICON_EDGESEL, "Edge", "Compute distance to nearest edge"},
3105 {MOD_WVG_PROXIMITY_GEOM_FACES, "FACE", ICON_FACESEL, "Face", "Compute distance to nearest face"},
3106 {0, NULL, 0, NULL, NULL}
3109 static EnumPropertyItem weightvg_proximity_falloff_type_items[] = {
3110 {MOD_WVG_MAPPING_NONE, "LINEAR", ICON_LINCURVE, "Linear", "Null action"},
3111 /* No curve mapping here! */
3112 {MOD_WVG_MAPPING_SHARP, "SHARP", ICON_SHARPCURVE, "Sharp", ""},
3113 {MOD_WVG_MAPPING_SMOOTH, "SMOOTH", ICON_SMOOTHCURVE, "Smooth", ""},
3114 {MOD_WVG_MAPPING_ROOT, "ROOT", ICON_ROOTCURVE, "Root", ""},
3115 {MOD_WVG_MAPPING_SPHERE, "ICON_SPHERECURVE", ICON_SPHERECURVE, "Sphere", ""},
3116 {MOD_WVG_MAPPING_RANDOM, "RANDOM", ICON_RNDCURVE, "Random", ""},
3117 {MOD_WVG_MAPPING_STEP, "STEP", ICON_NOCURVE /* Would need a better icon... */, "Median Step",
3118 "Map all values below 0.5 to 0.0, and all others to 1.0"},
3119 {0, NULL, 0, NULL, NULL}
3125 srna = RNA_def_struct(brna, "VertexWeightProximityModifier", "Modifier");
3126 RNA_def_struct_ui_text(srna, "WeightVG Proximity Modifier",
3127 "Set the weights of vertices in a group from a target object's "
3129 RNA_def_struct_sdna(srna, "WeightVGProximityModifierData");
3130 RNA_def_struct_ui_icon(srna, ICON_MOD_VERTEX_WEIGHT);
3132 prop = RNA_def_property(srna, "vertex_group", PROP_STRING, PROP_NONE);
3133 RNA_def_property_string_sdna(prop, NULL, "defgrp_name");
3134 RNA_def_property_ui_text(prop, "Vertex Group", "Vertex group name");
3135 RNA_def_property_string_funcs(prop, NULL, NULL, "rna_WeightVGModifier_vgroup_set");
3136 RNA_def_property_update(prop, 0, "rna_Modifier_update");
3138 prop = RNA_def_property(srna, "proximity_mode", PROP_ENUM, PROP_NONE);
3139 RNA_def_property_enum_items(prop, weightvg_proximity_modes_items);
3140 RNA_def_property_enum_default(prop, MOD_WVG_PROXIMITY_GEOMETRY);
3141 RNA_def_property_ui_text(prop, "Proximity Mode", "Which distances to target object to use");
3142 RNA_def_property_update(prop, 0, "rna_Modifier_update");
3144 prop = RNA_def_property(srna, "proximity_geometry", PROP_ENUM, PROP_NONE);
3145 RNA_def_property_enum_sdna(prop, NULL, "proximity_flags");
3146 RNA_def_property_enum_items(prop, proximity_geometry_items);
3147 RNA_def_property_flag(prop, PROP_ENUM_FLAG); /* important to run before default set */
3148 RNA_def_property_enum_default(prop, MOD_WVG_PROXIMITY_GEOM_FACES);
3149 RNA_def_property_ui_text(prop, "Proximity Geometry",
3150 "Use the shortest computed distance to target object's geometry "
3152 RNA_def_property_update(prop, 0, "rna_Modifier_update");
3154 prop = RNA_def_property(srna, "target", PROP_POINTER, PROP_NONE);
3155 RNA_def_property_pointer_sdna(prop, NULL, "proximity_ob_target");
3156 RNA_def_property_ui_text(prop, "Target Object", "Object to calculate vertices distances from");
3157 RNA_def_property_flag(prop, PROP_EDITABLE | PROP_ID_SELF_CHECK);
3158 RNA_def_property_update(prop, 0, "rna_Modifier_dependency_update");
3160 prop = RNA_def_property(srna, "