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 "DNA_armature_types.h"
33 #include "DNA_cachefile_types.h"
34 #include "DNA_mesh_types.h"
35 #include "DNA_modifier_types.h"
36 #include "DNA_object_types.h"
37 #include "DNA_object_force.h"
38 #include "DNA_scene_types.h"
40 #include "MEM_guardedalloc.h"
44 #include "BLT_translation.h"
46 #include "BKE_animsys.h"
47 #include "BKE_data_transfer.h"
48 #include "BKE_DerivedMesh.h"
49 #include "BKE_dynamicpaint.h"
50 #include "BKE_effect.h"
51 #include "BKE_mesh_mapping.h"
52 #include "BKE_mesh_remap.h"
53 #include "BKE_multires.h"
54 #include "BKE_smoke.h" /* For smokeModifier_free & smokeModifier_createType */
56 #include "RNA_access.h"
57 #include "RNA_define.h"
58 #include "RNA_enum_types.h"
60 #include "rna_internal.h"
65 EnumPropertyItem rna_enum_object_modifier_type_items[] = {
66 {0, "", 0, N_("Modify"), ""},
67 {eModifierType_DataTransfer, "DATA_TRANSFER", ICON_MOD_DATA_TRANSFER, "Data Transfer", ""},
68 {eModifierType_MeshCache, "MESH_CACHE", ICON_MOD_MESHDEFORM, "Mesh Cache", ""},
69 {eModifierType_MeshSequenceCache, "MESH_SEQUENCE_CACHE", ICON_MOD_MESHDEFORM, "Mesh Sequence Cache", ""},
70 {eModifierType_NormalEdit, "NORMAL_EDIT", ICON_MOD_NORMALEDIT, "Normal Edit", ""},
71 {eModifierType_UVProject, "UV_PROJECT", ICON_MOD_UVPROJECT, "UV Project", ""},
72 {eModifierType_UVWarp, "UV_WARP", ICON_MOD_UVPROJECT, "UV Warp", ""},
73 {eModifierType_WeightVGEdit, "VERTEX_WEIGHT_EDIT", ICON_MOD_VERTEX_WEIGHT, "Vertex Weight Edit", ""},
74 {eModifierType_WeightVGMix, "VERTEX_WEIGHT_MIX", ICON_MOD_VERTEX_WEIGHT, "Vertex Weight Mix", ""},
75 {eModifierType_WeightVGProximity, "VERTEX_WEIGHT_PROXIMITY", ICON_MOD_VERTEX_WEIGHT,
76 "Vertex Weight Proximity", ""},
77 {0, "", 0, N_("Generate"), ""},
78 {eModifierType_Array, "ARRAY", ICON_MOD_ARRAY, "Array", ""},
79 {eModifierType_Bevel, "BEVEL", ICON_MOD_BEVEL, "Bevel", ""},
80 {eModifierType_Boolean, "BOOLEAN", ICON_MOD_BOOLEAN, "Boolean", ""},
81 {eModifierType_Build, "BUILD", ICON_MOD_BUILD, "Build", ""},
82 {eModifierType_Decimate, "DECIMATE", ICON_MOD_DECIM, "Decimate", ""},
83 {eModifierType_EdgeSplit, "EDGE_SPLIT", ICON_MOD_EDGESPLIT, "Edge Split", ""},
84 {eModifierType_Mask, "MASK", ICON_MOD_MASK, "Mask", ""},
85 {eModifierType_Mirror, "MIRROR", ICON_MOD_MIRROR, "Mirror", ""},
86 {eModifierType_Multires, "MULTIRES", ICON_MOD_MULTIRES, "Multiresolution", ""},
87 {eModifierType_Remesh, "REMESH", ICON_MOD_REMESH, "Remesh", ""},
88 {eModifierType_Screw, "SCREW", ICON_MOD_SCREW, "Screw", ""},
89 {eModifierType_Skin, "SKIN", ICON_MOD_SKIN, "Skin", ""},
90 {eModifierType_Solidify, "SOLIDIFY", ICON_MOD_SOLIDIFY, "Solidify", ""},
91 {eModifierType_Subsurf, "SUBSURF", ICON_MOD_SUBSURF, "Subdivision Surface", ""},
92 {eModifierType_Triangulate, "TRIANGULATE", ICON_MOD_TRIANGULATE, "Triangulate", ""},
93 {eModifierType_Wireframe, "WIREFRAME", ICON_MOD_WIREFRAME, "Wireframe", "Generate a wireframe on the edges of a mesh"},
94 {0, "", 0, N_("Deform"), ""},
95 {eModifierType_Armature, "ARMATURE", ICON_MOD_ARMATURE, "Armature", ""},
96 {eModifierType_Cast, "CAST", ICON_MOD_CAST, "Cast", ""},
97 {eModifierType_CorrectiveSmooth, "CORRECTIVE_SMOOTH", ICON_MOD_SMOOTH, "Corrective Smooth", ""},
98 {eModifierType_Curve, "CURVE", ICON_MOD_CURVE, "Curve", ""},
99 {eModifierType_Displace, "DISPLACE", ICON_MOD_DISPLACE, "Displace", ""},
100 {eModifierType_Hook, "HOOK", ICON_HOOK, "Hook", ""},
101 {eModifierType_LaplacianSmooth, "LAPLACIANSMOOTH", ICON_MOD_SMOOTH, "Laplacian Smooth", ""},
102 {eModifierType_LaplacianDeform, "LAPLACIANDEFORM", ICON_MOD_MESHDEFORM, "Laplacian Deform", ""},
103 {eModifierType_Lattice, "LATTICE", ICON_MOD_LATTICE, "Lattice", ""},
104 {eModifierType_MeshDeform, "MESH_DEFORM", ICON_MOD_MESHDEFORM, "Mesh Deform", ""},
105 {eModifierType_Shrinkwrap, "SHRINKWRAP", ICON_MOD_SHRINKWRAP, "Shrinkwrap", ""},
106 {eModifierType_SimpleDeform, "SIMPLE_DEFORM", ICON_MOD_SIMPLEDEFORM, "Simple Deform", ""},
107 {eModifierType_Smooth, "SMOOTH", ICON_MOD_SMOOTH, "Smooth", ""},
108 {eModifierType_Warp, "WARP", ICON_MOD_WARP, "Warp", ""},
109 {eModifierType_Wave, "WAVE", ICON_MOD_WAVE, "Wave", ""},
110 {0, "", 0, N_("Simulate"), ""},
111 {eModifierType_Cloth, "CLOTH", ICON_MOD_CLOTH, "Cloth", ""},
112 {eModifierType_Collision, "COLLISION", ICON_MOD_PHYSICS, "Collision", ""},
113 {eModifierType_DynamicPaint, "DYNAMIC_PAINT", ICON_MOD_DYNAMICPAINT, "Dynamic Paint", ""},
114 {eModifierType_Explode, "EXPLODE", ICON_MOD_EXPLODE, "Explode", ""},
115 {eModifierType_Fluidsim, "FLUID_SIMULATION", ICON_MOD_FLUIDSIM, "Fluid Simulation", ""},
116 {eModifierType_Ocean, "OCEAN", ICON_MOD_OCEAN, "Ocean", ""},
117 {eModifierType_Smoke, "SMOKE", ICON_MOD_SMOKE, "Smoke", ""},
118 {eModifierType_Softbody, "SOFT_BODY", ICON_MOD_SOFT, "Soft Body", ""},
119 {eModifierType_Surface, "SURFACE", ICON_MOD_PHYSICS, "Surface", ""},
120 {0, NULL, 0, NULL, NULL}
123 EnumPropertyItem rna_enum_modifier_triangulate_quad_method_items[] = {
124 {MOD_TRIANGULATE_QUAD_BEAUTY, "BEAUTY", 0, "Beauty ", "Split the quads in nice triangles, slower method"},
125 {MOD_TRIANGULATE_QUAD_FIXED, "FIXED", 0, "Fixed", "Split the quads on the first and third vertices"},
126 {MOD_TRIANGULATE_QUAD_ALTERNATE, "FIXED_ALTERNATE", 0, "Fixed Alternate",
127 "Split the quads on the 2nd and 4th vertices"},
128 {MOD_TRIANGULATE_QUAD_SHORTEDGE, "SHORTEST_DIAGONAL", 0, "Shortest Diagonal",
129 "Split the quads based on the distance between the vertices"},
130 {0, NULL, 0, NULL, NULL}
133 EnumPropertyItem rna_enum_modifier_triangulate_ngon_method_items[] = {
134 {MOD_TRIANGULATE_NGON_BEAUTY, "BEAUTY", 0, "Beauty", "Arrange the new triangles evenly (slow)"},
135 {MOD_TRIANGULATE_NGON_EARCLIP, "CLIP", 0, "Clip", "Split the polygons with an ear clipping algorithm"},
136 {0, NULL, 0, NULL, NULL}
140 /* use eWarp_Falloff_*** & eHook_Falloff_***, they're in sync */
141 static EnumPropertyItem modifier_warp_falloff_items[] = {
142 {eWarp_Falloff_None, "NONE", 0, "No Falloff", ""},
143 {eWarp_Falloff_Curve, "CURVE", 0, "Curve", ""},
144 {eWarp_Falloff_Smooth, "SMOOTH", ICON_SMOOTHCURVE, "Smooth", ""},
145 {eWarp_Falloff_Sphere, "SPHERE", ICON_SPHERECURVE, "Sphere", ""},
146 {eWarp_Falloff_Root, "ROOT", ICON_ROOTCURVE, "Root", ""},
147 {eWarp_Falloff_InvSquare, "INVERSE_SQUARE", ICON_ROOTCURVE, "Inverse Square", ""},
148 {eWarp_Falloff_Sharp, "SHARP", ICON_SHARPCURVE, "Sharp", ""},
149 {eWarp_Falloff_Linear, "LINEAR", ICON_LINCURVE, "Linear", ""},
150 {eWarp_Falloff_Const, "CONSTANT", ICON_NOCURVE, "Constant", ""},
151 {0, NULL, 0, NULL, NULL}
155 /* ***** Data Transfer ***** */
157 EnumPropertyItem rna_enum_dt_method_vertex_items[] = {
158 {MREMAP_MODE_TOPOLOGY, "TOPOLOGY", 0, "Topology",
159 "Copy from identical topology meshes"},
160 {MREMAP_MODE_VERT_NEAREST, "NEAREST", 0, "Nearest vertex",
161 "Copy from closest vertex"},
162 {MREMAP_MODE_VERT_EDGE_NEAREST, "EDGE_NEAREST", 0, "Nearest Edge Vertex",
163 "Copy from closest vertex of closest edge"},
164 {MREMAP_MODE_VERT_EDGEINTERP_NEAREST, "EDGEINTERP_NEAREST", 0, "Nearest Edge Interpolated",
165 "Copy from interpolated values of vertices from closest point on closest edge"},
166 {MREMAP_MODE_VERT_POLY_NEAREST, "POLY_NEAREST", 0, "Nearest Face Vertex",
167 "Copy from closest vertex of closest face"},
168 {MREMAP_MODE_VERT_POLYINTERP_NEAREST, "POLYINTERP_NEAREST", 0, "Nearest Face Interpolated",
169 "Copy from interpolated values of vertices from closest point on closest face"},
170 {MREMAP_MODE_VERT_POLYINTERP_VNORPROJ, "POLYINTERP_VNORPROJ", 0, "Projected Face Interpolated",
171 "Copy from interpolated values of vertices from point on closest face hit by normal-projection"},
172 {0, NULL, 0, NULL, NULL}
175 EnumPropertyItem rna_enum_dt_method_edge_items[] = {
176 {MREMAP_MODE_TOPOLOGY, "TOPOLOGY", 0, "Topology",
177 "Copy from identical topology meshes"},
178 {MREMAP_MODE_EDGE_VERT_NEAREST, "VERT_NEAREST", 0, "Nearest Vertices",
179 "Copy from most similar edge (edge which vertices are the closest of destination edge's ones)"},
180 {MREMAP_MODE_EDGE_NEAREST, "NEAREST", 0, "Nearest Edge",
181 "Copy from closest edge (using midpoints)"},
182 {MREMAP_MODE_EDGE_POLY_NEAREST, "POLY_NEAREST", 0, "Nearest Face Edge",
183 "Copy from closest edge of closest face (using midpoints)"},
184 {MREMAP_MODE_EDGE_EDGEINTERP_VNORPROJ, "EDGEINTERP_VNORPROJ", 0, "Projected Edge Interpolated",
185 "Interpolate all source edges hit by the projection of destination one along its own normal (from vertices)"},
186 {0, NULL, 0, NULL, NULL}
189 EnumPropertyItem rna_enum_dt_method_loop_items[] = {
190 {MREMAP_MODE_TOPOLOGY, "TOPOLOGY", 0, "Topology",
191 "Copy from identical topology meshes"},
192 {MREMAP_MODE_LOOP_NEAREST_LOOPNOR, "NEAREST_NORMAL", 0, "Nearest Corner And Best Matching Normal",
193 "Copy from nearest corner which has the best matching normal"},
194 {MREMAP_MODE_LOOP_NEAREST_POLYNOR, "NEAREST_POLYNOR", 0, "Nearest Corner And Best Matching Face Normal",
195 "Copy from nearest corner which has the face with the best matching normal to destination corner's face one"},
196 {MREMAP_MODE_LOOP_POLY_NEAREST, "NEAREST_POLY", 0, "Nearest Corner Of Nearest Face",
197 "Copy from nearest corner of nearest polygon"},
198 {MREMAP_MODE_LOOP_POLYINTERP_NEAREST, "POLYINTERP_NEAREST", 0, "Nearest Face Interpolated",
199 "Copy from interpolated corners of the nearest source polygon"},
200 {MREMAP_MODE_LOOP_POLYINTERP_LNORPROJ, "POLYINTERP_LNORPROJ", 0, "Projected Face Interpolated",
201 "Copy from interpolated corners of the source polygon hit by corner normal projection"},
202 {0, NULL, 0, NULL, NULL}
205 EnumPropertyItem rna_enum_dt_method_poly_items[] = {
206 {MREMAP_MODE_TOPOLOGY, "TOPOLOGY", 0, "Topology",
207 "Copy from identical topology meshes"},
208 {MREMAP_MODE_POLY_NEAREST, "NEAREST", 0, "Nearest Face",
209 "Copy from nearest polygon (using center points)"},
210 {MREMAP_MODE_POLY_NOR, "NORMAL", 0, "Best Normal-Matching",
211 "Copy from source polygon which normal is the closest to destination one"},
212 {MREMAP_MODE_POLY_POLYINTERP_PNORPROJ, "POLYINTERP_PNORPROJ", 0, "Projected Face Interpolated",
213 "Interpolate all source polygons intersected by the projection of destination one along its own normal"},
214 {0, NULL, 0, NULL, NULL}
217 EnumPropertyItem rna_enum_dt_mix_mode_items[] = {
218 {CDT_MIX_TRANSFER, "REPLACE", 0, "Replace",
219 "Overwrite all elements' data"},
220 {CDT_MIX_REPLACE_ABOVE_THRESHOLD, "ABOVE_THRESHOLD", 0, "Above Threshold",
221 "Only replace destination elements where data is above given threshold (exact behavior depends on data type)"},
222 {CDT_MIX_REPLACE_BELOW_THRESHOLD, "BELOW_THRESHOLD", 0, "Below Threshold",
223 "Only replace destination elements where data is below given threshold (exact behavior depends on data type)"},
224 {CDT_MIX_MIX, "MIX", 0, "Mix",
225 "Mix source value into destination one, using given threshold as factor"},
226 {CDT_MIX_ADD, "ADD", 0, "Add",
227 "Add source value to destination one, using given threshold as factor"},
228 {CDT_MIX_SUB, "SUB", 0, "Subtract",
229 "Subtract source value to destination one, using given threshold as factor"},
230 {CDT_MIX_MUL, "MUL", 0, "Multiply",
231 "Multiply source value to destination one, using given threshold as factor"},
233 {0, NULL, 0, NULL, NULL}
236 EnumPropertyItem rna_enum_dt_layers_select_src_items[] = {
237 {DT_LAYERS_ACTIVE_SRC, "ACTIVE", 0, "Active Layer",
238 "Only transfer active data layer"},
239 {DT_LAYERS_ALL_SRC, "ALL", 0, "All Layers",
240 "Transfer all data layers"},
241 {DT_LAYERS_VGROUP_SRC_BONE_SELECT, "BONE_SELECT", 0, "Selected Pose Bones",
242 "Transfer all vertex groups used by selected pose bones"},
243 {DT_LAYERS_VGROUP_SRC_BONE_DEFORM, "BONE_DEFORM", 0, "Deform Pose Bones",
244 "Transfer all vertex groups used by deform bones"},
245 {0, NULL, 0, NULL, NULL}
248 EnumPropertyItem rna_enum_dt_layers_select_dst_items[] = {
249 {DT_LAYERS_ACTIVE_DST, "ACTIVE", 0, "Active Layer",
250 "Affect active data layer of all targets"},
251 {DT_LAYERS_NAME_DST, "NAME", 0, "By Name",
252 "Match target data layers to affect by name"},
253 {DT_LAYERS_INDEX_DST, "INDEX", 0, "By Order",
254 "Match target data layers to affect by order (indices)"},
255 {0, NULL, 0, NULL, NULL}
258 EnumPropertyItem rna_enum_axis_xy_items[] = {
259 {0, "X", 0, "X", ""},
260 {1, "Y", 0, "Y", ""},
261 {0, NULL, 0, NULL, NULL}
264 EnumPropertyItem rna_enum_axis_xyz_items[] = {
265 {0, "X", 0, "X", ""},
266 {1, "Y", 0, "Y", ""},
267 {2, "Z", 0, "Z", ""},
268 {0, NULL, 0, NULL, NULL}
271 EnumPropertyItem rna_enum_axis_flag_xyz_items[] = {
272 {(1 << 0), "X", 0, "X", ""},
273 {(1 << 1), "Y", 0, "Y", ""},
274 {(1 << 2), "Z", 0, "Z", ""},
275 {0, NULL, 0, NULL, NULL}
280 #include "DNA_curve_types.h"
281 #include "DNA_smoke_types.h"
283 #include "BKE_cachefile.h"
284 #include "BKE_context.h"
285 #include "BKE_depsgraph.h"
286 #include "BKE_library.h"
287 #include "BKE_modifier.h"
288 #include "BKE_object.h"
291 # include "ABC_alembic.h"
294 static void rna_UVProject_projectors_begin(CollectionPropertyIterator *iter, PointerRNA *ptr)
296 UVProjectModifierData *uvp = (UVProjectModifierData *)ptr->data;
297 rna_iterator_array_begin(iter, (void *)uvp->projectors, sizeof(Object *), uvp->num_projectors, 0, NULL);
300 static StructRNA *rna_Modifier_refine(struct PointerRNA *ptr)
302 ModifierData *md = (ModifierData *)ptr->data;
304 switch ((ModifierType)md->type) {
305 case eModifierType_Subsurf:
306 return &RNA_SubsurfModifier;
307 case eModifierType_Lattice:
308 return &RNA_LatticeModifier;
309 case eModifierType_Curve:
310 return &RNA_CurveModifier;
311 case eModifierType_Build:
312 return &RNA_BuildModifier;
313 case eModifierType_Mirror:
314 return &RNA_MirrorModifier;
315 case eModifierType_Decimate:
316 return &RNA_DecimateModifier;
317 case eModifierType_Wave:
318 return &RNA_WaveModifier;
319 case eModifierType_Armature:
320 return &RNA_ArmatureModifier;
321 case eModifierType_Hook:
322 return &RNA_HookModifier;
323 case eModifierType_Softbody:
324 return &RNA_SoftBodyModifier;
325 case eModifierType_Boolean:
326 return &RNA_BooleanModifier;
327 case eModifierType_Array:
328 return &RNA_ArrayModifier;
329 case eModifierType_EdgeSplit:
330 return &RNA_EdgeSplitModifier;
331 case eModifierType_Displace:
332 return &RNA_DisplaceModifier;
333 case eModifierType_UVProject:
334 return &RNA_UVProjectModifier;
335 case eModifierType_Smooth:
336 return &RNA_SmoothModifier;
337 case eModifierType_Cast:
338 return &RNA_CastModifier;
339 case eModifierType_MeshDeform:
340 return &RNA_MeshDeformModifier;
341 case eModifierType_Explode:
342 return &RNA_ExplodeModifier;
343 case eModifierType_Cloth:
344 return &RNA_ClothModifier;
345 case eModifierType_Collision:
346 return &RNA_CollisionModifier;
347 case eModifierType_Bevel:
348 return &RNA_BevelModifier;
349 case eModifierType_Shrinkwrap:
350 return &RNA_ShrinkwrapModifier;
351 case eModifierType_Fluidsim:
352 return &RNA_FluidSimulationModifier;
353 case eModifierType_Mask:
354 return &RNA_MaskModifier;
355 case eModifierType_SimpleDeform:
356 return &RNA_SimpleDeformModifier;
357 case eModifierType_Multires:
358 return &RNA_MultiresModifier;
359 case eModifierType_Surface:
360 return &RNA_SurfaceModifier;
361 case eModifierType_Smoke:
362 return &RNA_SmokeModifier;
363 case eModifierType_Solidify:
364 return &RNA_SolidifyModifier;
365 case eModifierType_Screw:
366 return &RNA_ScrewModifier;
367 case eModifierType_Ocean:
368 return &RNA_OceanModifier;
369 case eModifierType_Warp:
370 return &RNA_WarpModifier;
371 case eModifierType_WeightVGEdit:
372 return &RNA_VertexWeightEditModifier;
373 case eModifierType_WeightVGMix:
374 return &RNA_VertexWeightMixModifier;
375 case eModifierType_WeightVGProximity:
376 return &RNA_VertexWeightProximityModifier;
377 case eModifierType_DynamicPaint:
378 return &RNA_DynamicPaintModifier;
379 case eModifierType_Remesh:
380 return &RNA_RemeshModifier;
381 case eModifierType_Skin:
382 return &RNA_SkinModifier;
383 case eModifierType_LaplacianSmooth:
384 return &RNA_LaplacianSmoothModifier;
385 case eModifierType_Triangulate:
386 return &RNA_TriangulateModifier;
387 case eModifierType_UVWarp:
388 return &RNA_UVWarpModifier;
389 case eModifierType_MeshCache:
390 return &RNA_MeshCacheModifier;
391 case eModifierType_LaplacianDeform:
392 return &RNA_LaplacianDeformModifier;
393 case eModifierType_Wireframe:
394 return &RNA_WireframeModifier;
395 case eModifierType_DataTransfer:
396 return &RNA_DataTransferModifier;
397 case eModifierType_NormalEdit:
398 return &RNA_NormalEditModifier;
399 case eModifierType_CorrectiveSmooth:
400 return &RNA_CorrectiveSmoothModifier;
401 case eModifierType_MeshSequenceCache:
402 return &RNA_MeshSequenceCacheModifier;
404 case eModifierType_None:
405 case eModifierType_ShapeKey:
406 case NUM_MODIFIER_TYPES:
407 return &RNA_Modifier;
410 return &RNA_Modifier;
413 static void rna_Modifier_name_set(PointerRNA *ptr, const char *value)
415 ModifierData *md = ptr->data;
416 char oldname[sizeof(md->name)];
418 /* make a copy of the old name first */
419 BLI_strncpy(oldname, md->name, sizeof(md->name));
421 /* copy the new name into the name slot */
422 BLI_strncpy_utf8(md->name, value, sizeof(md->name));
424 /* make sure the name is truly unique */
426 Object *ob = ptr->id.data;
427 modifier_unique_name(&ob->modifiers, md);
430 /* fix all the animation data which may link to this */
431 BKE_animdata_fix_paths_rename_all(NULL, "modifiers", oldname, md->name);
434 static char *rna_Modifier_path(PointerRNA *ptr)
436 ModifierData *md = ptr->data;
437 char name_esc[sizeof(md->name) * 2];
439 BLI_strescape(name_esc, md->name, sizeof(name_esc));
440 return BLI_sprintfN("modifiers[\"%s\"]", name_esc);
443 static void rna_Modifier_update(Main *UNUSED(bmain), Scene *UNUSED(scene), PointerRNA *ptr)
445 DAG_id_tag_update(ptr->id.data, OB_RECALC_DATA);
446 WM_main_add_notifier(NC_OBJECT | ND_MODIFIER, ptr->id.data);
449 static void rna_Modifier_dependency_update(Main *bmain, Scene *scene, PointerRNA *ptr)
451 rna_Modifier_update(bmain, scene, ptr);
452 DAG_relations_tag_update(bmain);
457 #define RNA_MOD_VGROUP_NAME_SET(_type, _prop) \
458 static void rna_##_type##Modifier_##_prop##_set(PointerRNA *ptr, const char *value) \
460 _type##ModifierData *tmd = (_type##ModifierData *)ptr->data; \
461 rna_object_vgroup_name_set(ptr, value, tmd->_prop, sizeof(tmd->_prop)); \
464 RNA_MOD_VGROUP_NAME_SET(Armature, defgrp_name);
465 RNA_MOD_VGROUP_NAME_SET(Bevel, defgrp_name);
466 RNA_MOD_VGROUP_NAME_SET(Cast, defgrp_name);
467 RNA_MOD_VGROUP_NAME_SET(Curve, name);
468 RNA_MOD_VGROUP_NAME_SET(DataTransfer, defgrp_name);
469 RNA_MOD_VGROUP_NAME_SET(Decimate, defgrp_name);
470 RNA_MOD_VGROUP_NAME_SET(CorrectiveSmooth, defgrp_name);
471 RNA_MOD_VGROUP_NAME_SET(Displace, defgrp_name);
472 RNA_MOD_VGROUP_NAME_SET(Hook, name);
473 RNA_MOD_VGROUP_NAME_SET(LaplacianDeform, anchor_grp_name);
474 RNA_MOD_VGROUP_NAME_SET(LaplacianSmooth, defgrp_name);
475 RNA_MOD_VGROUP_NAME_SET(Lattice, name);
476 RNA_MOD_VGROUP_NAME_SET(Mask, vgroup);
477 RNA_MOD_VGROUP_NAME_SET(MeshDeform, defgrp_name);
478 RNA_MOD_VGROUP_NAME_SET(NormalEdit, defgrp_name);
479 RNA_MOD_VGROUP_NAME_SET(Shrinkwrap, vgroup_name);
480 RNA_MOD_VGROUP_NAME_SET(SimpleDeform, vgroup_name);
481 RNA_MOD_VGROUP_NAME_SET(Smooth, defgrp_name);
482 RNA_MOD_VGROUP_NAME_SET(Solidify, defgrp_name);
483 RNA_MOD_VGROUP_NAME_SET(UVWarp, vgroup_name);
484 RNA_MOD_VGROUP_NAME_SET(Warp, defgrp_name);
485 RNA_MOD_VGROUP_NAME_SET(Wave, defgrp_name);
486 RNA_MOD_VGROUP_NAME_SET(WeightVGEdit, defgrp_name);
487 RNA_MOD_VGROUP_NAME_SET(WeightVGEdit, mask_defgrp_name);
488 RNA_MOD_VGROUP_NAME_SET(WeightVGMix, defgrp_name_a);
489 RNA_MOD_VGROUP_NAME_SET(WeightVGMix, defgrp_name_b);
490 RNA_MOD_VGROUP_NAME_SET(WeightVGMix, mask_defgrp_name);
491 RNA_MOD_VGROUP_NAME_SET(WeightVGProximity, defgrp_name);
492 RNA_MOD_VGROUP_NAME_SET(WeightVGProximity, mask_defgrp_name);
493 RNA_MOD_VGROUP_NAME_SET(Wireframe, defgrp_name);
495 static void rna_ExplodeModifier_vgroup_get(PointerRNA *ptr, char *value)
497 ExplodeModifierData *emd = (ExplodeModifierData *)ptr->data;
498 rna_object_vgroup_name_index_get(ptr, value, emd->vgroup);
501 static int rna_ExplodeModifier_vgroup_length(PointerRNA *ptr)
503 ExplodeModifierData *emd = (ExplodeModifierData *)ptr->data;
504 return rna_object_vgroup_name_index_length(ptr, emd->vgroup);
507 static void rna_ExplodeModifier_vgroup_set(PointerRNA *ptr, const char *value)
509 ExplodeModifierData *emd = (ExplodeModifierData *)ptr->data;
510 rna_object_vgroup_name_index_set(ptr, value, &emd->vgroup);
513 #undef RNA_MOD_VGROUP_NAME_SET
517 #define RNA_MOD_UVLAYER_NAME_SET(_type, _prop) \
518 static void rna_##_type##Modifier_##_prop##_set(PointerRNA *ptr, const char *value) \
520 _type##ModifierData *tmd = (_type##ModifierData *)ptr->data; \
521 rna_object_uvlayer_name_set(ptr, value, tmd->_prop, sizeof(tmd->_prop)); \
524 RNA_MOD_UVLAYER_NAME_SET(MappingInfo, uvlayer_name);
525 RNA_MOD_UVLAYER_NAME_SET(UVProject, uvlayer_name);
526 RNA_MOD_UVLAYER_NAME_SET(UVWarp, uvlayer_name);
527 RNA_MOD_UVLAYER_NAME_SET(WeightVGEdit, mask_tex_uvlayer_name);
528 RNA_MOD_UVLAYER_NAME_SET(WeightVGMix, mask_tex_uvlayer_name);
529 RNA_MOD_UVLAYER_NAME_SET(WeightVGProximity, mask_tex_uvlayer_name);
531 #undef RNA_MOD_UVLAYER_NAME_SET
535 static void modifier_object_set(Object *self, Object **ob_p, int type, PointerRNA value)
537 Object *ob = value.data;
539 if (!self || ob != self) {
540 if (!ob || type == OB_EMPTY || ob->type == type) {
541 id_lib_extern((ID *)ob);
547 #define RNA_MOD_OBJECT_SET(_type, _prop, _obtype) \
548 static void rna_##_type##Modifier_##_prop##_set(PointerRNA *ptr, PointerRNA value) \
550 _type##ModifierData *tmd = (_type##ModifierData *)ptr->data; \
551 modifier_object_set(ptr->id.data, &tmd->_prop, _obtype, value); \
554 RNA_MOD_OBJECT_SET(Armature, object, OB_ARMATURE);
555 RNA_MOD_OBJECT_SET(Array, start_cap, OB_MESH);
556 RNA_MOD_OBJECT_SET(Array, end_cap, OB_MESH);
557 RNA_MOD_OBJECT_SET(Array, curve_ob, OB_CURVE);
558 RNA_MOD_OBJECT_SET(Boolean, object, OB_MESH);
559 RNA_MOD_OBJECT_SET(Cast, object, OB_EMPTY);
560 RNA_MOD_OBJECT_SET(Curve, object, OB_CURVE);
561 RNA_MOD_OBJECT_SET(DataTransfer, ob_source, OB_MESH);
562 RNA_MOD_OBJECT_SET(Lattice, object, OB_LATTICE);
563 RNA_MOD_OBJECT_SET(Mask, ob_arm, OB_ARMATURE);
564 RNA_MOD_OBJECT_SET(MeshDeform, object, OB_MESH);
565 RNA_MOD_OBJECT_SET(NormalEdit, target, OB_EMPTY);
566 RNA_MOD_OBJECT_SET(Shrinkwrap, target, OB_MESH);
567 RNA_MOD_OBJECT_SET(Shrinkwrap, auxTarget, OB_MESH);
569 static void rna_HookModifier_object_set(PointerRNA *ptr, PointerRNA value)
571 HookModifierData *hmd = ptr->data;
572 Object *ob = (Object *)value.data;
575 id_lib_extern((ID *)ob);
576 BKE_object_modifier_hook_reset(ob, hmd);
579 static PointerRNA rna_UVProjector_object_get(PointerRNA *ptr)
581 Object **ob = (Object **)ptr->data;
582 return rna_pointer_inherit_refine(ptr, &RNA_Object, *ob);
585 static void rna_UVProjector_object_set(PointerRNA *ptr, PointerRNA value)
587 Object **ob_p = (Object **)ptr->data;
588 Object *ob = (Object *)value.data;
589 id_lib_extern((ID *)ob);
593 #undef RNA_MOD_OBJECT_SET
595 /* Other rna callbacks */
597 static void rna_Smoke_set_type(Main *bmain, Scene *scene, PointerRNA *ptr)
599 SmokeModifierData *smd = (SmokeModifierData *)ptr->data;
600 Object *ob = (Object *)ptr->id.data;
602 /* nothing changed */
603 if ((smd->type & MOD_SMOKE_TYPE_DOMAIN) && smd->domain)
606 smokeModifier_free(smd); /* XXX TODO: completely free all 3 pointers */
607 smokeModifier_createType(smd); /* create regarding of selected type */
610 case MOD_SMOKE_TYPE_DOMAIN:
613 case MOD_SMOKE_TYPE_FLOW:
614 case MOD_SMOKE_TYPE_COLL:
620 /* update dependency since a domain - other type switch could have happened */
621 rna_Modifier_dependency_update(bmain, scene, ptr);
624 static void rna_MultiresModifier_type_set(PointerRNA *ptr, int value)
626 Object *ob = (Object *)ptr->id.data;
627 MultiresModifierData *mmd = (MultiresModifierData *)ptr->data;
629 multires_force_update(ob);
633 static void rna_MultiresModifier_level_range(PointerRNA *ptr, int *min, int *max,
634 int *UNUSED(softmin), int *UNUSED(softmax))
636 MultiresModifierData *mmd = (MultiresModifierData *)ptr->data;
639 *max = max_ii(0, mmd->totlvl); /* intentionally _not_ -1 */
642 static int rna_MultiresModifier_external_get(PointerRNA *ptr)
644 Object *ob = (Object *)ptr->id.data;
647 return CustomData_external_test(&me->ldata, CD_MDISPS);
650 static void rna_MultiresModifier_filepath_get(PointerRNA *ptr, char *value)
652 Object *ob = (Object *)ptr->id.data;
653 CustomDataExternal *external = ((Mesh *)ob->data)->ldata.external;
655 BLI_strncpy(value, (external) ? external->filename : "", sizeof(external->filename));
658 static void rna_MultiresModifier_filepath_set(PointerRNA *ptr, const char *value)
660 Object *ob = (Object *)ptr->id.data;
661 CustomDataExternal *external = ((Mesh *)ob->data)->ldata.external;
663 if (external && !STREQ(external->filename, value)) {
664 BLI_strncpy(external->filename, value, sizeof(external->filename));
665 multires_force_external_reload(ob);
669 static int rna_MultiresModifier_filepath_length(PointerRNA *ptr)
671 Object *ob = (Object *)ptr->id.data;
672 CustomDataExternal *external = ((Mesh *)ob->data)->ldata.external;
674 return strlen((external) ? external->filename : "");
677 static int rna_ShrinkwrapModifier_face_cull_get(PointerRNA *ptr)
679 ShrinkwrapModifierData *swm = (ShrinkwrapModifierData *)ptr->data;
680 return swm->shrinkOpts & (MOD_SHRINKWRAP_CULL_TARGET_FRONTFACE | MOD_SHRINKWRAP_CULL_TARGET_BACKFACE);
683 static void rna_ShrinkwrapModifier_face_cull_set(struct PointerRNA *ptr, int value)
685 ShrinkwrapModifierData *swm = (ShrinkwrapModifierData *)ptr->data;
688 (swm->shrinkOpts & ~(MOD_SHRINKWRAP_CULL_TARGET_FRONTFACE | MOD_SHRINKWRAP_CULL_TARGET_BACKFACE)) | value;
691 static int rna_MeshDeformModifier_is_bound_get(PointerRNA *ptr)
693 return (((MeshDeformModifierData *)ptr->data)->bindcagecos != NULL);
696 static PointerRNA rna_SoftBodyModifier_settings_get(PointerRNA *ptr)
698 Object *ob = (Object *)ptr->id.data;
699 return rna_pointer_inherit_refine(ptr, &RNA_SoftBodySettings, ob->soft);
702 static PointerRNA rna_CollisionModifier_settings_get(PointerRNA *ptr)
704 Object *ob = (Object *)ptr->id.data;
705 return rna_pointer_inherit_refine(ptr, &RNA_CollisionSettings, ob->pd);
708 static void rna_UVProjectModifier_num_projectors_set(PointerRNA *ptr, int value)
710 UVProjectModifierData *md = (UVProjectModifierData *)ptr->data;
713 md->num_projectors = CLAMPIS(value, 1, MOD_UVPROJECT_MAXPROJECTORS);
714 for (a = md->num_projectors; a < MOD_UVPROJECT_MAXPROJECTORS; a++)
715 md->projectors[a] = NULL;
718 static void rna_OceanModifier_init_update(Main *bmain, Scene *scene, PointerRNA *ptr)
720 OceanModifierData *omd = (OceanModifierData *)ptr->data;
722 omd->refresh |= (MOD_OCEAN_REFRESH_RESET | MOD_OCEAN_REFRESH_SIM | MOD_OCEAN_REFRESH_CLEAR_CACHE);
724 rna_Modifier_update(bmain, scene, ptr);
727 static void rna_OceanModifier_sim_update(Main *bmain, Scene *scene, PointerRNA *ptr)
729 OceanModifierData *omd = (OceanModifierData *)ptr->data;
731 omd->refresh |= MOD_OCEAN_REFRESH_SIM;
733 rna_Modifier_update(bmain, scene, ptr);
736 static void rna_OceanModifier_topology_update(Main *bmain, Scene *scene, PointerRNA *ptr)
738 OceanModifierData *omd = (OceanModifierData *)ptr->data;
740 omd->refresh |= MOD_OCEAN_REFRESH_TOPOLOGY;
742 rna_Modifier_update(bmain, scene, ptr);
745 static void rna_OceanModifier_ocean_chop_set(PointerRNA *ptr, float value)
747 OceanModifierData *omd = (OceanModifierData *)ptr->data;
748 float old_value = omd->chop_amount;
750 omd->chop_amount = value;
752 if ((old_value == 0.0f && value > 0.0f) ||
753 (old_value > 0.0f && value == 0.0f))
755 omd->refresh |= MOD_OCEAN_REFRESH_RESET;
756 omd->refresh |= MOD_OCEAN_REFRESH_CLEAR_CACHE;
760 static int rna_LaplacianDeformModifier_is_bind_get(PointerRNA *ptr)
762 LaplacianDeformModifierData *lmd = (LaplacianDeformModifierData *)ptr->data;
763 return ((lmd->flag & MOD_LAPLACIANDEFORM_BIND) && (lmd->cache_system != NULL));
766 /* NOTE: Curve and array modifiers requires curve path to be evaluated,
767 * dependency graph will make sure that curve eval would create such a path,
768 * but if curve was already evaluated we might miss path.
770 * So what we do here is: if path was not calculated for target curve we
774 static void rna_CurveModifier_dependency_update(Main *bmain, Scene *scene, PointerRNA *ptr)
776 CurveModifierData *cmd = (CurveModifierData *)ptr->data;
777 rna_Modifier_update(bmain, scene, ptr);
778 DAG_relations_tag_update(bmain);
779 if (cmd->object != NULL) {
780 Curve *curve = cmd->object->data;
781 if ((curve->flag & CU_PATH) == 0) {
782 DAG_id_tag_update(&curve->id, OB_RECALC_DATA);
787 static void rna_ArrayModifier_dependency_update(Main *bmain, Scene *scene, PointerRNA *ptr)
789 ArrayModifierData *amd = (ArrayModifierData *)ptr->data;
790 rna_Modifier_update(bmain, scene, ptr);
791 DAG_relations_tag_update(bmain);
792 if (amd->curve_ob != NULL) {
793 Curve *curve = amd->curve_ob->data;
794 if ((curve->flag & CU_PATH) == 0) {
795 DAG_id_tag_update(&curve->id, OB_RECALC_DATA);
801 static void rna_DataTransferModifier_use_data_update(Main *bmain, Scene *scene, PointerRNA *ptr)
803 DataTransferModifierData *dtmd = (DataTransferModifierData *)ptr->data;
805 if (!(dtmd->flags & MOD_DATATRANSFER_USE_VERT)) {
806 dtmd->data_types &= ~DT_TYPE_VERT_ALL;
808 if (!(dtmd->flags & MOD_DATATRANSFER_USE_EDGE)) {
809 dtmd->data_types &= ~DT_TYPE_EDGE_ALL;
811 if (!(dtmd->flags & MOD_DATATRANSFER_USE_LOOP)) {
812 dtmd->data_types &= ~DT_TYPE_LOOP_ALL;
814 if (!(dtmd->flags & MOD_DATATRANSFER_USE_POLY)) {
815 dtmd->data_types &= ~DT_TYPE_POLY_ALL;
818 rna_Modifier_update(bmain, scene, ptr);
821 static void rna_DataTransferModifier_data_types_update(Main *bmain, Scene *scene, PointerRNA *ptr)
823 DataTransferModifierData *dtmd = (DataTransferModifierData *)ptr->data;
824 const int item_types = BKE_object_data_transfer_get_dttypes_item_types(dtmd->data_types);
826 if (item_types & ME_VERT) {
827 dtmd->flags |= MOD_DATATRANSFER_USE_VERT;
829 if (item_types & ME_EDGE) {
830 dtmd->flags |= MOD_DATATRANSFER_USE_EDGE;
832 if (item_types & ME_LOOP) {
833 dtmd->flags |= MOD_DATATRANSFER_USE_LOOP;
835 if (item_types & ME_POLY) {
836 dtmd->flags |= MOD_DATATRANSFER_USE_POLY;
839 rna_Modifier_update(bmain, scene, ptr);
842 static void rna_DataTransferModifier_verts_data_types_set(struct PointerRNA *ptr, int value)
844 DataTransferModifierData *dtmd = (DataTransferModifierData *)ptr->data;
846 dtmd->data_types &= ~DT_TYPE_VERT_ALL;
847 dtmd->data_types |= value;
850 static void rna_DataTransferModifier_edges_data_types_set(struct PointerRNA *ptr, int value)
852 DataTransferModifierData *dtmd = (DataTransferModifierData *)ptr->data;
854 dtmd->data_types &= ~DT_TYPE_EDGE_ALL;
855 dtmd->data_types |= value;
858 static void rna_DataTransferModifier_loops_data_types_set(struct PointerRNA *ptr, int value)
860 DataTransferModifierData *dtmd = (DataTransferModifierData *)ptr->data;
862 dtmd->data_types &= ~DT_TYPE_LOOP_ALL;
863 dtmd->data_types |= value;
866 static void rna_DataTransferModifier_polys_data_types_set(struct PointerRNA *ptr, int value)
868 DataTransferModifierData *dtmd = (DataTransferModifierData *)ptr->data;
870 dtmd->data_types &= ~DT_TYPE_POLY_ALL;
871 dtmd->data_types |= value;
874 static EnumPropertyItem *rna_DataTransferModifier_layers_select_src_itemf(bContext *C, PointerRNA *ptr, PropertyRNA *prop, bool *r_free)
876 DataTransferModifierData *dtmd = (DataTransferModifierData *)ptr->data;
877 EnumPropertyItem *item = NULL, tmp_item = {0};
880 if (!C) { /* needed for docs and i18n tools */
881 return rna_enum_dt_layers_select_src_items;
884 /* No active here! */
885 RNA_enum_items_add_value(&item, &totitem, rna_enum_dt_layers_select_src_items, DT_LAYERS_ALL_SRC);
887 if (STREQ(RNA_property_identifier(prop), "layers_vgroup_select_src")) {
888 Object *ob_src = dtmd->ob_source;
890 #if 0 /* XXX Don't think we want this in modifier version... */
891 if (BKE_object_pose_armature_get(ob_src)) {
892 RNA_enum_items_add_value(&item, &totitem, rna_enum_dt_layers_select_src_items, DT_LAYERS_VGROUP_SRC_BONE_SELECT);
893 RNA_enum_items_add_value(&item, &totitem, rna_enum_dt_layers_select_src_items, DT_LAYERS_VGROUP_SRC_BONE_DEFORM);
901 RNA_enum_item_add_separator(&item, &totitem);
903 for (i = 0, dg = ob_src->defbase.first; dg; i++, dg = dg->next) {
905 tmp_item.identifier = tmp_item.name = dg->name;
906 RNA_enum_item_add(&item, &totitem, &tmp_item);
910 else if (STREQ(RNA_property_identifier(prop), "layers_shapekey_select_src")) {
913 else if (STREQ(RNA_property_identifier(prop), "layers_uv_select_src")) {
914 Object *ob_src = dtmd->ob_source;
921 dm_src = object_get_derived_final(ob_src, false);
922 if (dm_src != NULL) {
923 pdata = dm_src->getPolyDataLayout(dm_src);
924 num_data = CustomData_number_of_layers(pdata, CD_MTEXPOLY);
926 RNA_enum_item_add_separator(&item, &totitem);
928 for (i = 0; i < num_data; i++) {
930 tmp_item.identifier = tmp_item.name = CustomData_get_layer_name(pdata, CD_MTEXPOLY, i);
931 RNA_enum_item_add(&item, &totitem, &tmp_item);
936 else if (STREQ(RNA_property_identifier(prop), "layers_vcol_select_src")) {
937 Object *ob_src = dtmd->ob_source;
944 dm_src = object_get_derived_final(ob_src, false);
945 if (dm_src != NULL) {
946 ldata = dm_src->getLoopDataLayout(dm_src);
947 num_data = CustomData_number_of_layers(ldata, CD_MLOOPCOL);
949 RNA_enum_item_add_separator(&item, &totitem);
951 for (i = 0; i < num_data; i++) {
953 tmp_item.identifier = tmp_item.name = CustomData_get_layer_name(ldata, CD_MLOOPCOL, i);
954 RNA_enum_item_add(&item, &totitem, &tmp_item);
960 RNA_enum_item_end(&item, &totitem);
966 static EnumPropertyItem *rna_DataTransferModifier_layers_select_dst_itemf(bContext *C, PointerRNA *ptr, PropertyRNA *prop, bool *r_free)
968 DataTransferModifierData *dtmd = (DataTransferModifierData *)ptr->data;
969 EnumPropertyItem *item = NULL, tmp_item = {0};
972 if (!C) { /* needed for docs and i18n tools */
973 return rna_enum_dt_layers_select_dst_items;
976 /* No active here! */
977 RNA_enum_items_add_value(&item, &totitem, rna_enum_dt_layers_select_dst_items, DT_LAYERS_NAME_DST);
978 RNA_enum_items_add_value(&item, &totitem, rna_enum_dt_layers_select_dst_items, DT_LAYERS_INDEX_DST);
980 if (STREQ(RNA_property_identifier(prop), "layers_vgroup_select_dst")) {
981 /* Only list destination layers if we have a single source! */
982 if (dtmd->layers_select_src[DT_MULTILAYER_INDEX_MDEFORMVERT] >= 0) {
983 Object *ob_dst = CTX_data_active_object(C); /* XXX Is this OK? */
989 RNA_enum_item_add_separator(&item, &totitem);
991 for (i = 0, dg = ob_dst->defbase.first; dg; i++, dg = dg->next) {
993 tmp_item.identifier = tmp_item.name = dg->name;
994 RNA_enum_item_add(&item, &totitem, &tmp_item);
999 else if (STREQ(RNA_property_identifier(prop), "layers_shapekey_select_dst")) {
1002 else if (STREQ(RNA_property_identifier(prop), "layers_uv_select_dst")) {
1003 /* Only list destination layers if we have a single source! */
1004 if (dtmd->layers_select_src[DT_MULTILAYER_INDEX_UV] >= 0) {
1005 Object *ob_dst = CTX_data_active_object(C); /* XXX Is this OK? */
1007 if (ob_dst && ob_dst->data) {
1012 me_dst = ob_dst->data;
1013 pdata = &me_dst->pdata;
1014 num_data = CustomData_number_of_layers(pdata, CD_MTEXPOLY);
1016 RNA_enum_item_add_separator(&item, &totitem);
1018 for (i = 0; i < num_data; i++) {
1020 tmp_item.identifier = tmp_item.name = CustomData_get_layer_name(pdata, CD_MTEXPOLY, i);
1021 RNA_enum_item_add(&item, &totitem, &tmp_item);
1026 else if (STREQ(RNA_property_identifier(prop), "layers_vcol_select_dst")) {
1027 /* Only list destination layers if we have a single source! */
1028 if (dtmd->layers_select_src[DT_MULTILAYER_INDEX_VCOL] >= 0) {
1029 Object *ob_dst = CTX_data_active_object(C); /* XXX Is this OK? */
1031 if (ob_dst && ob_dst->data) {
1036 me_dst = ob_dst->data;
1037 ldata = &me_dst->ldata;
1038 num_data = CustomData_number_of_layers(ldata, CD_MLOOPCOL);
1040 RNA_enum_item_add_separator(&item, &totitem);
1042 for (i = 0; i < num_data; i++) {
1044 tmp_item.identifier = tmp_item.name = CustomData_get_layer_name(ldata, CD_MLOOPCOL, i);
1045 RNA_enum_item_add(&item, &totitem, &tmp_item);
1052 RNA_enum_item_end(&item, &totitem);
1058 static EnumPropertyItem *rna_DataTransferModifier_mix_mode_itemf(bContext *C, PointerRNA *ptr, PropertyRNA *UNUSED(prop), bool *r_free)
1060 DataTransferModifierData *dtmd = (DataTransferModifierData *)ptr->data;
1061 EnumPropertyItem *item = NULL;
1064 bool support_advanced_mixing, support_threshold;
1066 if (!C) { /* needed for docs and i18n tools */
1067 return rna_enum_dt_mix_mode_items;
1070 RNA_enum_items_add_value(&item, &totitem, rna_enum_dt_mix_mode_items, CDT_MIX_TRANSFER);
1072 BKE_object_data_transfer_get_dttypes_capacity(dtmd->data_types, &support_advanced_mixing, &support_threshold);
1074 if (support_threshold) {
1075 RNA_enum_items_add_value(&item, &totitem, rna_enum_dt_mix_mode_items, CDT_MIX_REPLACE_ABOVE_THRESHOLD);
1076 RNA_enum_items_add_value(&item, &totitem, rna_enum_dt_mix_mode_items, CDT_MIX_REPLACE_BELOW_THRESHOLD);
1079 if (support_advanced_mixing) {
1080 RNA_enum_item_add_separator(&item, &totitem);
1081 RNA_enum_items_add_value(&item, &totitem, rna_enum_dt_mix_mode_items, CDT_MIX_MIX);
1082 RNA_enum_items_add_value(&item, &totitem, rna_enum_dt_mix_mode_items, CDT_MIX_ADD);
1083 RNA_enum_items_add_value(&item, &totitem, rna_enum_dt_mix_mode_items, CDT_MIX_SUB);
1084 RNA_enum_items_add_value(&item, &totitem, rna_enum_dt_mix_mode_items, CDT_MIX_MUL);
1087 RNA_enum_item_end(&item, &totitem);
1093 static void rna_CorrectiveSmoothModifier_update(Main *bmain, Scene *scene, PointerRNA *ptr)
1095 CorrectiveSmoothModifierData *csmd = (CorrectiveSmoothModifierData *)ptr->data;
1097 MEM_SAFE_FREE(csmd->delta_cache);
1099 rna_Modifier_update(bmain, scene, ptr);
1102 static void rna_CorrectiveSmoothModifier_rest_source_update(Main *bmain, Scene *scene, PointerRNA *ptr)
1104 CorrectiveSmoothModifierData *csmd = (CorrectiveSmoothModifierData *)ptr->data;
1106 if (csmd->rest_source != MOD_CORRECTIVESMOOTH_RESTSOURCE_BIND) {
1107 MEM_SAFE_FREE(csmd->bind_coords);
1108 csmd->bind_coords_num = 0;
1111 rna_CorrectiveSmoothModifier_update(bmain, scene, ptr);
1114 static int rna_CorrectiveSmoothModifier_is_bind_get(PointerRNA *ptr)
1116 CorrectiveSmoothModifierData *csmd = (CorrectiveSmoothModifierData *)ptr->data;
1117 return (csmd->bind_coords != NULL);
1122 static PropertyRNA *rna_def_property_subdivision_common(StructRNA *srna, const char type[])
1124 static EnumPropertyItem prop_subdivision_type_items[] = {
1125 {0, "CATMULL_CLARK", 0, "Catmull-Clark", ""},
1126 {1, "SIMPLE", 0, "Simple", ""},
1127 {0, NULL, 0, NULL, NULL}
1130 PropertyRNA *prop = RNA_def_property(srna, "subdivision_type", PROP_ENUM, PROP_NONE);
1131 RNA_def_property_enum_sdna(prop, NULL, type);
1132 RNA_def_property_enum_items(prop, prop_subdivision_type_items);
1133 RNA_def_property_ui_text(prop, "Subdivision Type", "Select type of subdivision algorithm");
1134 RNA_def_property_update(prop, 0, "rna_Modifier_update");
1139 static void rna_def_modifier_subsurf(BlenderRNA *brna)
1144 srna = RNA_def_struct(brna, "SubsurfModifier", "Modifier");
1145 RNA_def_struct_ui_text(srna, "Subsurf Modifier", "Subdivision surface modifier");
1146 RNA_def_struct_sdna(srna, "SubsurfModifierData");
1147 RNA_def_struct_ui_icon(srna, ICON_MOD_SUBSURF);
1149 rna_def_property_subdivision_common(srna, "subdivType");
1151 /* see CCGSUBSURF_LEVEL_MAX for max limit */
1152 prop = RNA_def_property(srna, "levels", PROP_INT, PROP_UNSIGNED);
1153 RNA_def_property_int_sdna(prop, NULL, "levels");
1154 RNA_def_property_range(prop, 0, 11);
1155 RNA_def_property_ui_range(prop, 0, 6, 1, -1);
1156 RNA_def_property_ui_text(prop, "Levels", "Number of subdivisions to perform");
1157 RNA_def_property_update(prop, 0, "rna_Modifier_update");
1159 prop = RNA_def_property(srna, "render_levels", PROP_INT, PROP_UNSIGNED);
1160 RNA_def_property_int_sdna(prop, NULL, "renderLevels");
1161 RNA_def_property_range(prop, 0, 11);
1162 RNA_def_property_ui_range(prop, 0, 6, 1, -1);
1163 RNA_def_property_ui_text(prop, "Render Levels", "Number of subdivisions to perform when rendering");
1165 prop = RNA_def_property(srna, "show_only_control_edges", PROP_BOOLEAN, PROP_NONE);
1166 RNA_def_property_boolean_sdna(prop, NULL, "flags", eSubsurfModifierFlag_ControlEdges);
1167 RNA_def_property_ui_text(prop, "Optimal Display", "Skip drawing/rendering of interior subdivided edges");
1168 RNA_def_property_update(prop, 0, "rna_Modifier_update");
1170 prop = RNA_def_property(srna, "use_subsurf_uv", PROP_BOOLEAN, PROP_NONE);
1171 RNA_def_property_boolean_sdna(prop, NULL, "flags", eSubsurfModifierFlag_SubsurfUv);
1172 RNA_def_property_ui_text(prop, "Subdivide UVs", "Use subsurf to subdivide UVs");
1173 RNA_def_property_update(prop, 0, "rna_Modifier_update");
1175 #ifdef WITH_OPENSUBDIV
1176 prop = RNA_def_property(srna, "use_opensubdiv", PROP_BOOLEAN, PROP_NONE);
1177 RNA_def_property_boolean_sdna(prop, NULL, "use_opensubdiv", 1);
1178 RNA_def_property_ui_text(prop, "Use OpenSubdiv", "Use OpenSubdiv for the subdivisions (viewport only)");
1179 RNA_def_property_update(prop, 0, "rna_Modifier_update");
1183 static void rna_def_modifier_generic_map_info(StructRNA *srna)
1185 static EnumPropertyItem prop_texture_coordinates_items[] = {
1186 {MOD_DISP_MAP_LOCAL, "LOCAL", 0, "Local", "Use the local coordinate system for the texture coordinates"},
1187 {MOD_DISP_MAP_GLOBAL, "GLOBAL", 0, "Global", "Use the global coordinate system for the texture coordinates"},
1188 {MOD_DISP_MAP_OBJECT, "OBJECT", 0, "Object",
1189 "Use the linked object's local coordinate system for the texture coordinates"},
1190 {MOD_DISP_MAP_UV, "UV", 0, "UV", "Use UV coordinates for the texture coordinates"},
1191 {0, NULL, 0, NULL, NULL}
1196 prop = RNA_def_property(srna, "texture", PROP_POINTER, PROP_NONE);
1197 RNA_def_property_ui_text(prop, "Texture", "");
1198 RNA_def_property_flag(prop, PROP_EDITABLE);
1199 RNA_def_property_update(prop, 0, "rna_Modifier_update");
1201 prop = RNA_def_property(srna, "texture_coords", PROP_ENUM, PROP_NONE);
1202 RNA_def_property_enum_sdna(prop, NULL, "texmapping");
1203 RNA_def_property_enum_items(prop, prop_texture_coordinates_items);
1204 RNA_def_property_ui_text(prop, "Texture Coordinates", "");
1205 RNA_def_property_update(prop, 0, "rna_Modifier_dependency_update");
1207 prop = RNA_def_property(srna, "uv_layer", PROP_STRING, PROP_NONE);
1208 RNA_def_property_string_sdna(prop, NULL, "uvlayer_name");
1209 RNA_def_property_ui_text(prop, "UV Map", "UV map name");
1210 RNA_def_property_string_funcs(prop, NULL, NULL, "rna_MappingInfoModifier_uvlayer_name_set");
1211 RNA_def_property_update(prop, 0, "rna_Modifier_update");
1213 prop = RNA_def_property(srna, "texture_coords_object", PROP_POINTER, PROP_NONE);
1214 RNA_def_property_pointer_sdna(prop, NULL, "map_object");
1215 RNA_def_property_ui_text(prop, "Texture Coordinate Object", "Object to set the texture coordinates");
1216 RNA_def_property_flag(prop, PROP_EDITABLE | PROP_ID_SELF_CHECK);
1217 RNA_def_property_update(prop, 0, "rna_Modifier_dependency_update");
1220 static void rna_def_modifier_warp(BlenderRNA *brna)
1225 srna = RNA_def_struct(brna, "WarpModifier", "Modifier");
1226 RNA_def_struct_ui_text(srna, "Warp Modifier", "Warp modifier");
1227 RNA_def_struct_sdna(srna, "WarpModifierData");
1228 RNA_def_struct_ui_icon(srna, ICON_MOD_WARP);
1230 prop = RNA_def_property(srna, "object_from", PROP_POINTER, PROP_NONE);
1231 RNA_def_property_ui_text(prop, "From", "Object to transform from");
1232 RNA_def_property_flag(prop, PROP_EDITABLE | PROP_ID_SELF_CHECK);
1233 RNA_def_property_update(prop, 0, "rna_Modifier_dependency_update");
1235 prop = RNA_def_property(srna, "object_to", PROP_POINTER, PROP_NONE);
1236 RNA_def_property_ui_text(prop, "To", "Object to transform to");
1237 RNA_def_property_flag(prop, PROP_EDITABLE | PROP_ID_SELF_CHECK);
1238 RNA_def_property_update(prop, 0, "rna_Modifier_dependency_update");
1240 prop = RNA_def_property(srna, "strength", PROP_FLOAT, PROP_NONE);
1241 RNA_def_property_range(prop, -FLT_MAX, FLT_MAX);
1242 RNA_def_property_ui_range(prop, -100, 100, 10, 2);
1243 RNA_def_property_ui_text(prop, "Strength", "");
1244 RNA_def_property_update(prop, 0, "rna_Modifier_update");
1246 prop = RNA_def_property(srna, "falloff_type", PROP_ENUM, PROP_NONE);
1247 RNA_def_property_enum_items(prop, modifier_warp_falloff_items);
1248 RNA_def_property_ui_text(prop, "Falloff Type", "");
1249 RNA_def_property_translation_context(prop, BLT_I18NCONTEXT_ID_CURVE); /* Abusing id_curve :/ */
1250 RNA_def_property_update(prop, 0, "rna_Modifier_update");
1252 prop = RNA_def_property(srna, "falloff_radius", PROP_FLOAT, PROP_UNSIGNED | PROP_DISTANCE);
1253 RNA_def_property_ui_text(prop, "Radius", "Radius to apply");
1254 RNA_def_property_update(prop, 0, "rna_Modifier_update");
1256 prop = RNA_def_property(srna, "falloff_curve", PROP_POINTER, PROP_NONE);
1257 RNA_def_property_pointer_sdna(prop, NULL, "curfalloff");
1258 RNA_def_property_ui_text(prop, "Falloff Curve", "Custom Lamp Falloff Curve");
1259 RNA_def_property_update(prop, 0, "rna_Modifier_update");
1261 prop = RNA_def_property(srna, "use_volume_preserve", PROP_BOOLEAN, PROP_NONE);
1262 RNA_def_property_boolean_sdna(prop, NULL, "flag", MOD_WARP_VOLUME_PRESERVE);
1263 RNA_def_property_ui_text(prop, "Preserve Volume", "Preserve volume when rotations are used");
1264 RNA_def_property_update(prop, 0, "rna_Modifier_update");
1266 prop = RNA_def_property(srna, "vertex_group", PROP_STRING, PROP_NONE);
1267 RNA_def_property_string_sdna(prop, NULL, "defgrp_name");
1268 RNA_def_property_ui_text(prop, "Vertex Group", "Vertex group name for modulating the deform");
1269 RNA_def_property_string_funcs(prop, NULL, NULL, "rna_WarpModifier_defgrp_name_set");
1270 RNA_def_property_update(prop, 0, "rna_Modifier_update");
1272 rna_def_modifier_generic_map_info(srna);
1275 static void rna_def_modifier_multires(BlenderRNA *brna)
1280 srna = RNA_def_struct(brna, "MultiresModifier", "Modifier");
1281 RNA_def_struct_ui_text(srna, "Multires Modifier", "Multiresolution mesh modifier");
1282 RNA_def_struct_sdna(srna, "MultiresModifierData");
1283 RNA_def_struct_ui_icon(srna, ICON_MOD_MULTIRES);
1285 prop = rna_def_property_subdivision_common(srna, "simple");
1286 RNA_def_property_enum_funcs(prop, NULL, "rna_MultiresModifier_type_set", NULL);
1288 prop = RNA_def_property(srna, "levels", PROP_INT, PROP_UNSIGNED);
1289 RNA_def_property_int_sdna(prop, NULL, "lvl");
1290 RNA_def_property_ui_text(prop, "Levels", "Number of subdivisions to use in the viewport");
1291 RNA_def_property_int_funcs(prop, NULL, NULL, "rna_MultiresModifier_level_range");
1292 RNA_def_property_update(prop, 0, "rna_Modifier_update");
1294 prop = RNA_def_property(srna, "sculpt_levels", PROP_INT, PROP_UNSIGNED);
1295 RNA_def_property_int_sdna(prop, NULL, "sculptlvl");
1296 RNA_def_property_ui_text(prop, "Sculpt Levels", "Number of subdivisions to use in sculpt mode");
1297 RNA_def_property_int_funcs(prop, NULL, NULL, "rna_MultiresModifier_level_range");
1298 RNA_def_property_update(prop, 0, "rna_Modifier_update");
1300 prop = RNA_def_property(srna, "render_levels", PROP_INT, PROP_UNSIGNED);
1301 RNA_def_property_int_sdna(prop, NULL, "renderlvl");
1302 RNA_def_property_ui_text(prop, "Render Levels", "The subdivision level visible at render time");
1303 RNA_def_property_int_funcs(prop, NULL, NULL, "rna_MultiresModifier_level_range");
1305 prop = RNA_def_property(srna, "total_levels", PROP_INT, PROP_UNSIGNED);
1306 RNA_def_property_int_sdna(prop, NULL, "totlvl");
1307 RNA_def_property_clear_flag(prop, PROP_EDITABLE);
1308 RNA_def_property_ui_text(prop, "Total Levels", "Number of subdivisions for which displacements are stored");
1310 prop = RNA_def_property(srna, "is_external", PROP_BOOLEAN, PROP_NONE);
1311 RNA_def_property_clear_flag(prop, PROP_EDITABLE);
1312 RNA_def_property_boolean_funcs(prop, "rna_MultiresModifier_external_get", NULL);
1313 RNA_def_property_ui_text(prop, "External",
1314 "Store multires displacements outside the .blend file, to save memory");
1316 prop = RNA_def_property(srna, "filepath", PROP_STRING, PROP_FILEPATH);
1317 RNA_def_property_string_funcs(prop, "rna_MultiresModifier_filepath_get", "rna_MultiresModifier_filepath_length",
1318 "rna_MultiresModifier_filepath_set");
1319 RNA_def_property_ui_text(prop, "File Path", "Path to external displacements file");
1320 RNA_def_property_update(prop, 0, "rna_Modifier_update");
1322 prop = RNA_def_property(srna, "show_only_control_edges", PROP_BOOLEAN, PROP_NONE);
1323 RNA_def_property_boolean_sdna(prop, NULL, "flags", eMultiresModifierFlag_ControlEdges);
1324 RNA_def_property_ui_text(prop, "Optimal Display", "Skip drawing/rendering of interior subdivided edges");
1325 RNA_def_property_update(prop, 0, "rna_Modifier_update");
1327 prop = RNA_def_property(srna, "use_subsurf_uv", PROP_BOOLEAN, PROP_NONE);
1328 RNA_def_property_boolean_negative_sdna(prop, NULL, "flags", eMultiresModifierFlag_PlainUv);
1329 RNA_def_property_ui_text(prop, "Subdivide UVs", "Use subsurf to subdivide UVs");
1330 RNA_def_property_update(prop, 0, "rna_Modifier_update");
1333 static void rna_def_modifier_lattice(BlenderRNA *brna)
1338 srna = RNA_def_struct(brna, "LatticeModifier", "Modifier");
1339 RNA_def_struct_ui_text(srna, "Lattice Modifier", "Lattice deformation modifier");
1340 RNA_def_struct_sdna(srna, "LatticeModifierData");
1341 RNA_def_struct_ui_icon(srna, ICON_MOD_LATTICE);
1343 prop = RNA_def_property(srna, "object", PROP_POINTER, PROP_NONE);
1344 RNA_def_property_ui_text(prop, "Object", "Lattice object to deform with");
1345 RNA_def_property_pointer_funcs(prop, NULL, "rna_LatticeModifier_object_set", NULL, "rna_Lattice_object_poll");
1346 RNA_def_property_flag(prop, PROP_EDITABLE | PROP_ID_SELF_CHECK);
1347 RNA_def_property_update(prop, 0, "rna_Modifier_dependency_update");
1349 prop = RNA_def_property(srna, "vertex_group", PROP_STRING, PROP_NONE);
1350 RNA_def_property_string_sdna(prop, NULL, "name");
1351 RNA_def_property_ui_text(prop, "Vertex Group",
1352 "Name of Vertex Group which determines influence of modifier per point");
1353 RNA_def_property_string_funcs(prop, NULL, NULL, "rna_LatticeModifier_name_set");
1354 RNA_def_property_update(prop, 0, "rna_Modifier_update");
1356 prop = RNA_def_property(srna, "strength", PROP_FLOAT, PROP_NONE);
1357 RNA_def_property_range(prop, -FLT_MAX, FLT_MAX);
1358 RNA_def_property_ui_range(prop, 0, 1, 10, 2);
1359 RNA_def_property_ui_text(prop, "Strength", "Strength of modifier effect");
1360 RNA_def_property_update(prop, 0, "rna_Modifier_update");
1363 static void rna_def_modifier_curve(BlenderRNA *brna)
1368 static EnumPropertyItem prop_deform_axis_items[] = {
1369 {MOD_CURVE_POSX, "POS_X", 0, "X", ""},
1370 {MOD_CURVE_POSY, "POS_Y", 0, "Y", ""},
1371 {MOD_CURVE_POSZ, "POS_Z", 0, "Z", ""},
1372 {MOD_CURVE_NEGX, "NEG_X", 0, "-X", ""},
1373 {MOD_CURVE_NEGY, "NEG_Y", 0, "-Y", ""},
1374 {MOD_CURVE_NEGZ, "NEG_Z", 0, "-Z", ""},
1375 {0, NULL, 0, NULL, NULL}
1378 srna = RNA_def_struct(brna, "CurveModifier", "Modifier");
1379 RNA_def_struct_ui_text(srna, "Curve Modifier", "Curve deformation modifier");
1380 RNA_def_struct_sdna(srna, "CurveModifierData");
1381 RNA_def_struct_ui_icon(srna, ICON_MOD_CURVE);
1383 prop = RNA_def_property(srna, "object", PROP_POINTER, PROP_NONE);
1384 RNA_def_property_ui_text(prop, "Object", "Curve object to deform with");
1385 RNA_def_property_pointer_funcs(prop, NULL, "rna_CurveModifier_object_set", NULL, "rna_Curve_object_poll");
1386 RNA_def_property_flag(prop, PROP_EDITABLE | PROP_ID_SELF_CHECK);
1387 RNA_def_property_update(prop, 0, "rna_CurveModifier_dependency_update");
1389 prop = RNA_def_property(srna, "vertex_group", PROP_STRING, PROP_NONE);
1390 RNA_def_property_string_sdna(prop, NULL, "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_CurveModifier_name_set");
1394 RNA_def_property_update(prop, 0, "rna_Modifier_update");
1396 prop = RNA_def_property(srna, "deform_axis", PROP_ENUM, PROP_NONE);
1397 RNA_def_property_enum_sdna(prop, NULL, "defaxis");
1398 RNA_def_property_enum_items(prop, prop_deform_axis_items);
1399 RNA_def_property_ui_text(prop, "Deform Axis", "The axis that the curve deforms along");
1400 RNA_def_property_update(prop, 0, "rna_Modifier_update");
1403 static void rna_def_modifier_build(BlenderRNA *brna)
1408 srna = RNA_def_struct(brna, "BuildModifier", "Modifier");
1409 RNA_def_struct_ui_text(srna, "Build Modifier", "Build effect modifier");
1410 RNA_def_struct_sdna(srna, "BuildModifierData");
1411 RNA_def_struct_ui_icon(srna, ICON_MOD_BUILD);
1413 prop = RNA_def_property(srna, "frame_start", PROP_FLOAT, PROP_TIME);
1414 RNA_def_property_float_sdna(prop, NULL, "start");
1415 RNA_def_property_range(prop, MINAFRAMEF, MAXFRAMEF);
1416 RNA_def_property_ui_text(prop, "Start", "Start frame of the effect");
1417 RNA_def_property_update(prop, 0, "rna_Modifier_update");
1419 prop = RNA_def_property(srna, "frame_duration", PROP_FLOAT, PROP_TIME);
1420 RNA_def_property_float_sdna(prop, NULL, "length");
1421 RNA_def_property_range(prop, 1, MAXFRAMEF);
1422 RNA_def_property_ui_text(prop, "Length", "Total time the build effect requires");
1423 RNA_def_property_update(prop, 0, "rna_Modifier_update");
1425 prop = RNA_def_property(srna, "use_reverse", PROP_BOOLEAN, PROP_NONE);
1426 RNA_def_property_boolean_sdna(prop, NULL, "flag", MOD_BUILD_FLAG_REVERSE);
1427 RNA_def_property_ui_text(prop, "Reversed", "Deconstruct the mesh instead of building it");
1428 RNA_def_property_update(prop, 0, "rna_Modifier_update");
1430 prop = RNA_def_property(srna, "use_random_order", PROP_BOOLEAN, PROP_NONE);
1431 RNA_def_property_boolean_sdna(prop, NULL, "flag", MOD_BUILD_FLAG_RANDOMIZE);
1432 RNA_def_property_ui_text(prop, "Randomize", "Randomize the faces or edges during build");
1433 RNA_def_property_update(prop, 0, "rna_Modifier_update");
1435 prop = RNA_def_property(srna, "seed", PROP_INT, PROP_NONE);
1436 RNA_def_property_range(prop, 1, MAXFRAMEF);
1437 RNA_def_property_ui_text(prop, "Seed", "Seed for random if used");
1438 RNA_def_property_update(prop, 0, "rna_Modifier_update");
1441 static void rna_def_modifier_mirror(BlenderRNA *brna)
1446 srna = RNA_def_struct(brna, "MirrorModifier", "Modifier");
1447 RNA_def_struct_ui_text(srna, "Mirror Modifier", "Mirroring modifier");
1448 RNA_def_struct_sdna(srna, "MirrorModifierData");
1449 RNA_def_struct_ui_icon(srna, ICON_MOD_MIRROR);
1451 prop = RNA_def_property(srna, "use_x", PROP_BOOLEAN, PROP_NONE);
1452 RNA_def_property_boolean_sdna(prop, NULL, "flag", MOD_MIR_AXIS_X);
1453 RNA_def_property_ui_text(prop, "X", "Enable X axis mirror");
1454 RNA_def_property_update(prop, 0, "rna_Modifier_update");
1456 prop = RNA_def_property(srna, "use_y", PROP_BOOLEAN, PROP_NONE);
1457 RNA_def_property_boolean_sdna(prop, NULL, "flag", MOD_MIR_AXIS_Y);
1458 RNA_def_property_ui_text(prop, "Y", "Enable Y axis mirror");
1459 RNA_def_property_update(prop, 0, "rna_Modifier_update");
1461 prop = RNA_def_property(srna, "use_z", PROP_BOOLEAN, PROP_NONE);
1462 RNA_def_property_boolean_sdna(prop, NULL, "flag", MOD_MIR_AXIS_Z);
1463 RNA_def_property_ui_text(prop, "Z", "Enable Z axis mirror");
1464 RNA_def_property_update(prop, 0, "rna_Modifier_update");
1466 prop = RNA_def_property(srna, "use_clip", PROP_BOOLEAN, PROP_NONE);
1467 RNA_def_property_boolean_sdna(prop, NULL, "flag", MOD_MIR_CLIPPING);
1468 RNA_def_property_ui_text(prop, "Clip", "Prevent vertices from going through the mirror during transform");
1469 RNA_def_property_update(prop, 0, "rna_Modifier_update");
1471 prop = RNA_def_property(srna, "use_mirror_vertex_groups", PROP_BOOLEAN, PROP_NONE);
1472 RNA_def_property_boolean_sdna(prop, NULL, "flag", MOD_MIR_VGROUP);
1473 RNA_def_property_ui_text(prop, "Mirror Vertex Groups", "Mirror vertex groups (e.g. .R->.L)");
1474 RNA_def_property_update(prop, 0, "rna_Modifier_update");
1476 prop = RNA_def_property(srna, "use_mirror_merge", PROP_BOOLEAN, PROP_NONE);
1477 RNA_def_property_boolean_negative_sdna(prop, NULL, "flag", MOD_MIR_NO_MERGE);
1478 RNA_def_property_ui_text(prop, "Merge Vertices", "Merge vertices within the merge threshold");
1479 RNA_def_property_update(prop, 0, "rna_Modifier_update");
1481 prop = RNA_def_property(srna, "use_mirror_u", PROP_BOOLEAN, PROP_NONE);
1482 RNA_def_property_boolean_sdna(prop, NULL, "flag", MOD_MIR_MIRROR_U);
1483 RNA_def_property_ui_text(prop, "Mirror U", "Mirror the U texture coordinate around the 0.5 point");
1484 RNA_def_property_update(prop, 0, "rna_Modifier_update");
1486 prop = RNA_def_property(srna, "use_mirror_v", PROP_BOOLEAN, PROP_NONE);
1487 RNA_def_property_boolean_sdna(prop, NULL, "flag", MOD_MIR_MIRROR_V);
1488 RNA_def_property_ui_text(prop, "Mirror V", "Mirror the V texture coordinate around the 0.5 point");
1489 RNA_def_property_update(prop, 0, "rna_Modifier_update");
1491 prop = RNA_def_property(srna, "merge_threshold", PROP_FLOAT, PROP_DISTANCE);
1492 RNA_def_property_float_sdna(prop, NULL, "tolerance");
1493 RNA_def_property_range(prop, 0, FLT_MAX);
1494 RNA_def_property_ui_range(prop, 0, 1, 0.01, 6);
1495 RNA_def_property_ui_text(prop, "Merge Limit", "Distance within which mirrored vertices are merged");
1496 RNA_def_property_update(prop, 0, "rna_Modifier_update");
1498 prop = RNA_def_property(srna, "mirror_object", PROP_POINTER, PROP_NONE);
1499 RNA_def_property_pointer_sdna(prop, NULL, "mirror_ob");
1500 RNA_def_property_ui_text(prop, "Mirror Object", "Object to use as mirror");
1501 RNA_def_property_flag(prop, PROP_EDITABLE | PROP_ID_SELF_CHECK);
1502 RNA_def_property_update(prop, 0, "rna_Modifier_dependency_update");
1505 static void rna_def_modifier_decimate(BlenderRNA *brna)
1507 static EnumPropertyItem modifier_decim_mode_items[] = {
1508 {MOD_DECIM_MODE_COLLAPSE, "COLLAPSE", 0, "Collapse", "Use edge collapsing"},
1509 {MOD_DECIM_MODE_UNSUBDIV, "UNSUBDIV", 0, "Un-Subdivide", "Use un-subdivide face reduction"},
1510 {MOD_DECIM_MODE_DISSOLVE, "DISSOLVE", 0, "Planar", "Dissolve geometry to form planar polygons"},
1511 {0, NULL, 0, NULL, NULL}
1514 /* Note, keep in sync with operator 'MESH_OT_decimate' */
1519 srna = RNA_def_struct(brna, "DecimateModifier", "Modifier");
1520 RNA_def_struct_ui_text(srna, "Decimate Modifier", "Decimation modifier");
1521 RNA_def_struct_sdna(srna, "DecimateModifierData");
1522 RNA_def_struct_ui_icon(srna, ICON_MOD_DECIM);
1524 prop = RNA_def_property(srna, "decimate_type", PROP_ENUM, PROP_NONE);
1525 RNA_def_property_enum_sdna(prop, NULL, "mode");
1526 RNA_def_property_enum_items(prop, modifier_decim_mode_items);
1527 RNA_def_property_ui_text(prop, "Mode", "");
1528 RNA_def_property_update(prop, 0, "rna_Modifier_update");
1530 /* (mode == MOD_DECIM_MODE_COLLAPSE) */
1531 prop = RNA_def_property(srna, "ratio", PROP_FLOAT, PROP_FACTOR);
1532 RNA_def_property_float_sdna(prop, NULL, "percent");
1533 RNA_def_property_range(prop, 0, 1);
1534 RNA_def_property_ui_range(prop, 0, 1, 1, 4);
1535 RNA_def_property_ui_text(prop, "Ratio", "Ratio of triangles to reduce to (collapse only)");
1536 RNA_def_property_update(prop, 0, "rna_Modifier_update");
1538 /* (mode == MOD_DECIM_MODE_UNSUBDIV) */
1539 prop = RNA_def_property(srna, "iterations", PROP_INT, PROP_UNSIGNED);
1540 RNA_def_property_int_sdna(prop, NULL, "iter");
1541 RNA_def_property_range(prop, 0, SHRT_MAX);
1542 RNA_def_property_ui_range(prop, 0, 100, 1, -1);
1543 RNA_def_property_ui_text(prop, "Iterations", "Number of times reduce the geometry (unsubdivide only)");
1544 RNA_def_property_update(prop, 0, "rna_Modifier_update");
1546 /* (mode == MOD_DECIM_MODE_DISSOLVE) */
1547 prop = RNA_def_property(srna, "angle_limit", PROP_FLOAT, PROP_ANGLE);
1548 RNA_def_property_float_sdna(prop, NULL, "angle");
1549 RNA_def_property_range(prop, 0, DEG2RAD(180));
1550 RNA_def_property_ui_range(prop, 0, DEG2RAD(180), 10, 2);
1551 RNA_def_property_ui_text(prop, "Angle Limit", "Only dissolve angles below this (planar only)");
1552 RNA_def_property_update(prop, 0, "rna_Modifier_update");
1554 /* (mode == MOD_DECIM_MODE_COLLAPSE) */
1555 prop = RNA_def_property(srna, "vertex_group", PROP_STRING, PROP_NONE);
1556 RNA_def_property_string_sdna(prop, NULL, "defgrp_name");
1557 RNA_def_property_ui_text(prop, "Vertex Group", "Vertex group name (collapse only)");
1558 RNA_def_property_string_funcs(prop, NULL, NULL, "rna_DecimateModifier_defgrp_name_set");
1559 RNA_def_property_update(prop, 0, "rna_Modifier_update");
1561 prop = RNA_def_property(srna, "invert_vertex_group", PROP_BOOLEAN, PROP_NONE);
1562 RNA_def_property_boolean_sdna(prop, NULL, "flag", MOD_DECIM_FLAG_INVERT_VGROUP);
1563 RNA_def_property_ui_text(prop, "Invert", "Invert vertex group influence (collapse only)");
1564 RNA_def_property_update(prop, 0, "rna_Modifier_update");
1566 prop = RNA_def_property(srna, "use_collapse_triangulate", PROP_BOOLEAN, PROP_NONE);
1567 RNA_def_property_boolean_sdna(prop, NULL, "flag", MOD_DECIM_FLAG_TRIANGULATE);
1568 RNA_def_property_ui_text(prop, "Triangulate", "Keep triangulated faces resulting from decimation (collapse only)");
1569 RNA_def_property_update(prop, 0, "rna_Modifier_update");
1571 prop = RNA_def_property(srna, "use_symmetry", PROP_BOOLEAN, PROP_NONE);
1572 RNA_def_property_boolean_sdna(prop, NULL, "flag", MOD_DECIM_FLAG_SYMMETRY);
1573 RNA_def_property_ui_text(prop, "Symmetry", "Maintain symmetry on an axis");
1574 RNA_def_property_update(prop, 0, "rna_Modifier_update");
1576 prop = RNA_def_property(srna, "symmetry_axis", PROP_ENUM, PROP_NONE);
1577 RNA_def_property_enum_sdna(prop, NULL, "symmetry_axis");
1578 RNA_def_property_enum_items(prop, rna_enum_axis_xyz_items);
1579 RNA_def_property_ui_text(prop, "Axis", "Axis of symmetry");
1580 RNA_def_property_update(prop, 0, "rna_Modifier_update");
1582 prop = RNA_def_property(srna, "vertex_group_factor", PROP_FLOAT, PROP_NONE);
1583 RNA_def_property_float_sdna(prop, NULL, "defgrp_factor");
1584 RNA_def_property_range(prop, 0, 1000);
1585 RNA_def_property_ui_range(prop, 0, 10, 1, 4);
1586 RNA_def_property_ui_text(prop, "Factor", "Vertex group strength");
1587 RNA_def_property_update(prop, 0, "rna_Modifier_update");
1588 /* end collapse-only option */
1590 /* (mode == MOD_DECIM_MODE_DISSOLVE) */
1591 prop = RNA_def_property(srna, "use_dissolve_boundaries", PROP_BOOLEAN, PROP_NONE);
1592 RNA_def_property_boolean_sdna(prop, NULL, "flag", MOD_DECIM_FLAG_ALL_BOUNDARY_VERTS);
1593 RNA_def_property_ui_text(prop, "All Boundaries", "Dissolve all vertices inbetween face boundaries (planar only)");
1594 RNA_def_property_update(prop, 0, "rna_Modifier_update");
1596 prop = RNA_def_property(srna, "delimit", PROP_ENUM, PROP_NONE);
1597 RNA_def_property_flag(prop, PROP_ENUM_FLAG); /* important to run before default set */
1598 RNA_def_property_enum_items(prop, rna_enum_mesh_delimit_mode_items);
1599 RNA_def_property_ui_text(prop, "Delimit", "Limit merging geometry");
1600 RNA_def_property_update(prop, 0, "rna_Modifier_update");
1602 /* end dissolve-only option */
1606 /* all modes use this */
1607 prop = RNA_def_property(srna, "face_count", PROP_INT, PROP_NONE);
1608 RNA_def_property_clear_flag(prop, PROP_EDITABLE);
1609 RNA_def_property_ui_text(prop, "Face Count", "The current number of faces in the decimated mesh");
1612 static void rna_def_modifier_wave(BlenderRNA *brna)
1617 srna = RNA_def_struct(brna, "WaveModifier", "Modifier");
1618 RNA_def_struct_ui_text(srna, "Wave Modifier", "Wave effect modifier");
1619 RNA_def_struct_sdna(srna, "WaveModifierData");
1620 RNA_def_struct_ui_icon(srna, ICON_MOD_WAVE);
1622 prop = RNA_def_property(srna, "use_x", PROP_BOOLEAN, PROP_NONE);
1623 RNA_def_property_boolean_sdna(prop, NULL, "flag", MOD_WAVE_X);
1624 RNA_def_property_ui_text(prop, "X", "X axis motion");
1625 RNA_def_property_update(prop, 0, "rna_Modifier_update");
1627 prop = RNA_def_property(srna, "use_y", PROP_BOOLEAN, PROP_NONE);
1628 RNA_def_property_boolean_sdna(prop, NULL, "flag", MOD_WAVE_Y);
1629 RNA_def_property_ui_text(prop, "Y", "Y axis motion");
1630 RNA_def_property_update(prop, 0, "rna_Modifier_update");
1632 prop = RNA_def_property(srna, "use_cyclic", PROP_BOOLEAN, PROP_NONE);
1633 RNA_def_property_boolean_sdna(prop, NULL, "flag", MOD_WAVE_CYCL);
1634 RNA_def_property_ui_text(prop, "Cyclic", "Cyclic wave effect");
1635 RNA_def_property_update(prop, 0, "rna_Modifier_update");
1637 prop = RNA_def_property(srna, "use_normal", PROP_BOOLEAN, PROP_NONE);
1638 RNA_def_property_boolean_sdna(prop, NULL, "flag", MOD_WAVE_NORM);
1639 RNA_def_property_ui_text(prop, "Normals", "Displace along normals");
1640 RNA_def_property_update(prop, 0, "rna_Modifier_update");
1642 prop = RNA_def_property(srna, "use_normal_x", PROP_BOOLEAN, PROP_NONE);
1643 RNA_def_property_boolean_sdna(prop, NULL, "flag", MOD_WAVE_NORM_X);
1644 RNA_def_property_ui_text(prop, "X Normal", "Enable displacement along the X normal");
1645 RNA_def_property_update(prop, 0, "rna_Modifier_update");
1647 prop = RNA_def_property(srna, "use_normal_y", PROP_BOOLEAN, PROP_NONE);
1648 RNA_def_property_boolean_sdna(prop, NULL, "flag", MOD_WAVE_NORM_Y);
1649 RNA_def_property_ui_text(prop, "Y Normal", "Enable displacement along the Y normal");
1650 RNA_def_property_update(prop, 0, "rna_Modifier_update");
1652 prop = RNA_def_property(srna, "use_normal_z", PROP_BOOLEAN, PROP_NONE);
1653 RNA_def_property_boolean_sdna(prop, NULL, "flag", MOD_WAVE_NORM_Z);
1654 RNA_def_property_ui_text(prop, "Z Normal", "Enable displacement along the Z normal");
1655 RNA_def_property_update(prop, 0, "rna_Modifier_update");
1657 prop = RNA_def_property(srna, "time_offset", PROP_FLOAT, PROP_NONE);
1658 RNA_def_property_float_sdna(prop, NULL, "timeoffs");
1659 RNA_def_property_range(prop, MINAFRAMEF, MAXFRAMEF);
1660 RNA_def_property_ui_text(prop, "Time Offset",
1661 "Either the starting frame (for positive speed) or ending frame (for negative speed.)");
1662 RNA_def_property_update(prop, 0, "rna_Modifier_update");
1664 prop = RNA_def_property(srna, "lifetime", PROP_FLOAT, PROP_TIME);
1665 RNA_def_property_float_sdna(prop, NULL, "lifetime");
1666 RNA_def_property_range(prop, MINAFRAMEF, MAXFRAMEF);
1667 RNA_def_property_ui_text(prop, "Lifetime", "Lifetime of the wave in frames, zero means infinite");
1668 RNA_def_property_update(prop, 0, "rna_Modifier_update");
1670 prop = RNA_def_property(srna, "damping_time", PROP_FLOAT, PROP_TIME);
1671 RNA_def_property_float_sdna(prop, NULL, "damp");
1672 RNA_def_property_range(prop, MINAFRAMEF, MAXFRAMEF);
1673 RNA_def_property_ui_text(prop, "Damping Time", "Number of frames in which the wave damps out after it dies");
1674 RNA_def_property_update(prop, 0, "rna_Modifier_update");
1676 prop = RNA_def_property(srna, "falloff_radius", PROP_FLOAT, PROP_DISTANCE);
1677 RNA_def_property_float_sdna(prop, NULL, "falloff");
1678 RNA_def_property_range(prop, 0, FLT_MAX);
1679 RNA_def_property_ui_range(prop, 0, 100, 100, 2);
1680 RNA_def_property_ui_text(prop, "Falloff Radius", "Distance after which it fades out");
1681 RNA_def_property_update(prop, 0, "rna_Modifier_update");
1683 prop = RNA_def_property(srna, "start_position_x", PROP_FLOAT, PROP_DISTANCE);
1684 RNA_def_property_float_sdna(prop, NULL, "startx");
1685 RNA_def_property_range(prop, -FLT_MAX, FLT_MAX);
1686 RNA_def_property_ui_range(prop, -100, 100, 100, 2);
1687 RNA_def_property_ui_text(prop, "Start Position X", "X coordinate of the start position");
1688 RNA_def_property_update(prop, 0, "rna_Modifier_update");
1690 prop = RNA_def_property(srna, "start_position_y", PROP_FLOAT, PROP_DISTANCE);
1691 RNA_def_property_float_sdna(prop, NULL, "starty");
1692 RNA_def_property_range(prop, -FLT_MAX, FLT_MAX);
1693 RNA_def_property_ui_range(prop, -100, 100, 100, 2);
1694 RNA_def_property_ui_text(prop, "Start Position Y", "Y coordinate of the start position");
1695 RNA_def_property_update(prop, 0, "rna_Modifier_update");
1697 prop = RNA_def_property(srna, "start_position_object", PROP_POINTER, PROP_NONE);
1698 RNA_def_property_pointer_sdna(prop, NULL, "objectcenter");
1699 RNA_def_property_ui_text(prop, "Start Position Object", "Object which defines the wave center");
1700 RNA_def_property_flag(prop, PROP_EDITABLE | PROP_ID_SELF_CHECK);
1701 RNA_def_property_update(prop, 0, "rna_Modifier_dependency_update");
1703 prop = RNA_def_property(srna, "vertex_group", PROP_STRING, PROP_NONE);
1704 RNA_def_property_string_sdna(prop, NULL, "defgrp_name");
1705 RNA_def_property_ui_text(prop, "Vertex Group", "Vertex group name for modulating the wave");
1706 RNA_def_property_string_funcs(prop, NULL, NULL, "rna_WaveModifier_defgrp_name_set");
1707 RNA_def_property_update(prop, 0, "rna_Modifier_update");
1709 prop = RNA_def_property(srna, "speed", PROP_FLOAT, PROP_NONE);
1710 RNA_def_property_range(prop, -FLT_MAX, FLT_MAX);
1711 RNA_def_property_ui_range(prop, -1, 1, 10, 2);
1712 RNA_def_property_ui_text(prop, "Speed", "Speed of the wave, towards the starting point when negative");
1713 RNA_def_property_update(prop, 0, "rna_Modifier_update");
1715 prop = RNA_def_property(srna, "height", PROP_FLOAT, PROP_DISTANCE);
1716 RNA_def_property_range(prop, -FLT_MAX, FLT_MAX);
1717 RNA_def_property_ui_range(prop, -2, 2, 10, 2);
1718 RNA_def_property_ui_text(prop, "Height", "Height of the wave");
1719 RNA_def_property_update(prop, 0, "rna_Modifier_update");
1721 prop = RNA_def_property(srna, "width", PROP_FLOAT, PROP_DISTANCE);
1722 RNA_def_property_range(prop, 0, FLT_MAX);
1723 RNA_def_property_ui_range(prop, 0, 5, 10, 2);
1724 RNA_def_property_ui_text(prop, "Width", "Distance between the waves");
1725 RNA_def_property_update(prop, 0, "rna_Modifier_update");
1727 prop = RNA_def_property(srna, "narrowness", PROP_FLOAT, PROP_DISTANCE);
1728 RNA_def_property_float_sdna(prop, NULL, "narrow");
1729 RNA_def_property_range(prop, 0, FLT_MAX);
1730 RNA_def_property_ui_range(prop, 0, 10, 10, 2);
1731 RNA_def_property_ui_text(prop, "Narrowness",
1732 "Distance between the top and the base of a wave, the higher the value, "
1733 "the more narrow the wave");
1734 RNA_def_property_update(prop, 0, "rna_Modifier_update");
1736 rna_def_modifier_generic_map_info(srna);
1739 static void rna_def_modifier_armature(BlenderRNA *brna)
1744 srna = RNA_def_struct(brna, "ArmatureModifier", "Modifier");
1745 RNA_def_struct_ui_text(srna, "Armature Modifier", "Armature deformation modifier");
1746 RNA_def_struct_sdna(srna, "ArmatureModifierData");
1747 RNA_def_struct_ui_icon(srna, ICON_MOD_ARMATURE);
1749 prop = RNA_def_property(srna, "object", PROP_POINTER, PROP_NONE);
1750 RNA_def_property_ui_text(prop, "Object", "Armature object to deform with");
1751 RNA_def_property_pointer_funcs(prop, NULL, "rna_ArmatureModifier_object_set", NULL, "rna_Armature_object_poll");
1752 RNA_def_property_flag(prop, PROP_EDITABLE | PROP_ID_SELF_CHECK);
1753 RNA_def_property_update(prop, 0, "rna_Modifier_dependency_update");
1755 prop = RNA_def_property(srna, "use_bone_envelopes", PROP_BOOLEAN, PROP_NONE);
1756 RNA_def_property_boolean_sdna(prop, NULL, "deformflag", ARM_DEF_ENVELOPE);
1757 RNA_def_property_ui_text(prop, "Use Bone Envelopes", "Bind Bone envelopes to armature modifier");
1758 RNA_def_property_update(prop, 0, "rna_Modifier_update");
1760 prop = RNA_def_property(srna, "use_vertex_groups", PROP_BOOLEAN, PROP_NONE);
1761 RNA_def_property_boolean_sdna(prop, NULL, "deformflag", ARM_DEF_VGROUP);
1762 RNA_def_property_ui_text(prop, "Use Vertex Groups", "Bind vertex groups to armature modifier");
1763 RNA_def_property_update(prop, 0, "rna_Modifier_update");
1765 prop = RNA_def_property(srna, "use_deform_preserve_volume", PROP_BOOLEAN, PROP_NONE);
1766 RNA_def_property_boolean_sdna(prop, NULL, "deformflag", ARM_DEF_QUATERNION);
1767 RNA_def_property_ui_text(prop, "Preserve Volume", "Deform rotation interpolation with quaternions");
1768 RNA_def_property_update(prop, 0, "rna_Modifier_update");
1770 prop = RNA_def_property(srna, "use_multi_modifier", PROP_BOOLEAN, PROP_NONE);
1771 RNA_def_property_boolean_sdna(prop, NULL, "multi", 0);
1772 RNA_def_property_ui_text(prop, "Multi Modifier",
1773 "Use same input as previous modifier, and mix results using overall vgroup");
1774 RNA_def_property_update(prop, 0, "rna_Modifier_update");
1776 prop = RNA_def_property(srna, "vertex_group", PROP_STRING, PROP_NONE);
1777 RNA_def_property_string_sdna(prop, NULL, "defgrp_name");
1778 RNA_def_property_ui_text(prop, "Vertex Group",
1779 "Name of Vertex Group which determines influence of modifier per point");
1780 RNA_def_property_string_funcs(prop, NULL, NULL, "rna_ArmatureModifier_defgrp_name_set");
1781 RNA_def_property_update(prop, 0, "rna_Modifier_update");
1783 prop = RNA_def_property(srna, "invert_vertex_group", PROP_BOOLEAN, PROP_NONE);
1784 RNA_def_property_boolean_sdna(prop, NULL, "deformflag", ARM_DEF_INVERT_VGROUP);
1785 RNA_def_property_ui_text(prop, "Invert", "Invert vertex group influence");
1786 RNA_def_property_update(prop, 0, "rna_Modifier_update");
1789 static void rna_def_modifier_hook(BlenderRNA *brna)
1794 srna = RNA_def_struct(brna, "HookModifier", "Modifier");
1795 RNA_def_struct_ui_text(srna, "Hook Modifier", "Hook modifier to modify the location of vertices");
1796 RNA_def_struct_sdna(srna, "HookModifierData");
1797 RNA_def_struct_ui_icon(srna, ICON_HOOK);
1799 prop = RNA_def_property(srna, "strength", PROP_FLOAT, PROP_NONE);
1800 RNA_def_property_float_sdna(prop, NULL, "force");
1801 RNA_def_property_range(prop, 0, 1);
1802 RNA_def_property_ui_text(prop, "Strength", "Relative force of the hook");
1803 RNA_def_property_update(prop, 0, "rna_Modifier_update");
1805 prop = RNA_def_property(srna, "falloff_type", PROP_ENUM, PROP_NONE);
1806 RNA_def_property_enum_items(prop, modifier_warp_falloff_items); /* share the enum */
1807 RNA_def_property_ui_text(prop, "Falloff Type", "");
1808 RNA_def_property_translation_context(prop, BLT_I18NCONTEXT_ID_CURVE); /* Abusing id_curve :/ */
1809 RNA_def_property_update(prop, 0, "rna_Modifier_update");
1811 prop = RNA_def_property(srna, "falloff_radius", PROP_FLOAT, PROP_DISTANCE);
1812 RNA_def_property_float_sdna(prop, NULL, "falloff");
1813 RNA_def_property_range(prop, 0, FLT_MAX);
1814 RNA_def_property_ui_range(prop, 0, 100, 100, 2);
1815 RNA_def_property_ui_text(prop, "Radius", "If not zero, the distance from the hook where influence ends");
1816 RNA_def_property_update(prop, 0, "rna_Modifier_update");
1818 prop = RNA_def_property(srna, "falloff_curve", PROP_POINTER, PROP_NONE);
1819 RNA_def_property_pointer_sdna(prop, NULL, "curfalloff");
1820 RNA_def_property_ui_text(prop, "Falloff Curve", "Custom Lamp Falloff Curve");
1821 RNA_def_property_update(prop, 0, "rna_Modifier_update");
1823 prop = RNA_def_property(srna, "center", PROP_FLOAT, PROP_NONE);
1824 RNA_def_property_float_sdna(prop, NULL, "cent");
1825 RNA_def_property_ui_text(prop, "Hook Center", "");
1826 RNA_def_property_update(prop, 0, "rna_Modifier_update");
1828 prop = RNA_def_property(srna, "matrix_inverse", PROP_FLOAT, PROP_MATRIX);
1829 RNA_def_property_float_sdna(prop, NULL, "parentinv");
1830 RNA_def_property_multi_array(prop, 2, rna_matrix_dimsize_4x4);
1831 RNA_def_property_ui_text(prop, "Matrix", "Reverse the transformation between this object and its target");
1832 RNA_def_property_update(prop, NC_OBJECT | ND_TRANSFORM, "rna_Modifier_update");
1834 prop = RNA_def_property(srna, "object", PROP_POINTER, PROP_NONE);
1835 RNA_def_property_ui_text(prop, "Object", "Parent Object for hook, also recalculates and clears offset");
1836 RNA_def_property_flag(prop, PROP_EDITABLE | PROP_ID_SELF_CHECK);
1837 RNA_def_property_pointer_funcs(prop, NULL, "rna_HookModifier_object_set", NULL, NULL);
1838 RNA_def_property_update(prop, 0, "rna_Modifier_dependency_update");
1840 prop = RNA_def_property(srna, "subtarget", PROP_STRING, PROP_NONE);
1841 RNA_def_property_string_sdna(prop, NULL, "subtarget");
1842 RNA_def_property_ui_text(prop, "Sub-Target",
1843 "Name of Parent Bone for hook (if applicable), also recalculates and clears offset");
1844 RNA_def_property_update(prop, 0, "rna_Modifier_dependency_update");
1846 prop = RNA_def_property(srna, "use_falloff_uniform", PROP_BOOLEAN, PROP_NONE);
1847 RNA_def_property_boolean_sdna(prop, NULL, "flag", MOD_HOOK_UNIFORM_SPACE);
1848 RNA_def_property_ui_text(prop, "Uniform Falloff", "Compensate for non-uniform object scale");
1849 RNA_def_property_update(prop, 0, "rna_Modifier_update");
1851 prop = RNA_def_property(srna, "vertex_group", PROP_STRING, PROP_NONE);
1852 RNA_def_property_string_sdna(prop, NULL, "name");
1853 RNA_def_property_ui_text(prop, "Vertex Group",
1854 "Name of Vertex Group which determines influence of modifier per point");
1855 RNA_def_property_string_funcs(prop, NULL, NULL, "rna_HookModifier_name_set");
1856 RNA_def_property_update(prop, 0, "rna_Modifier_update");
1859 static void rna_def_modifier_softbody(BlenderRNA *brna)
1864 srna = RNA_def_struct(brna, "SoftBodyModifier", "Modifier");
1865 RNA_def_struct_ui_text(srna, "Soft Body Modifier", "Soft body simulation modifier");
1866 RNA_def_struct_sdna(srna, "SoftbodyModifierData");
1867 RNA_def_struct_ui_icon(srna, ICON_MOD_SOFT);
1869 prop = RNA_def_property(srna, "settings", PROP_POINTER, PROP_NONE);
1870 RNA_def_property_flag(prop, PROP_NEVER_NULL);
1871 RNA_def_property_struct_type(prop, "SoftBodySettings");
1872 RNA_def_property_pointer_funcs(prop, "rna_SoftBodyModifier_settings_get", NULL, NULL, NULL);
1873 RNA_def_property_ui_text(prop, "Soft Body Settings", "");
1876 static void rna_def_modifier_boolean(BlenderRNA *brna)
1881 static EnumPropertyItem prop_operation_items[] = {
1882 {eBooleanModifierOp_Intersect, "INTERSECT", 0, "Intersect",
1883 "Keep the part of the mesh that intersects with the other selected object"},
1884 {eBooleanModifierOp_Union, "UNION", 0, "Union", "Combine two meshes in an additive way"},
1885 {eBooleanModifierOp_Difference, "DIFFERENCE", 0, "Difference", "Combine two meshes in a subtractive way"},
1886 {0, NULL, 0, NULL, NULL}
1889 static EnumPropertyItem prop_solver_items[] = {
1890 {eBooleanModifierSolver_BMesh, "BMESH", 0, "BMesh", "Use the BMesh boolean solver"},
1891 {eBooleanModifierSolver_Carve, "CARVE", 0, "Carve", "Use the Carve boolean solver"},
1892 {0, NULL, 0, NULL, NULL}
1895 srna = RNA_def_struct(brna, "BooleanModifier", "Modifier");
1896 RNA_def_struct_ui_text(srna, "Boolean Modifier", "Boolean operations modifier");
1897 RNA_def_struct_sdna(srna, "BooleanModifierData");
1898 RNA_def_struct_ui_icon(srna, ICON_MOD_BOOLEAN);
1900 prop = RNA_def_property(srna, "object", PROP_POINTER, PROP_NONE);
1901 RNA_def_property_ui_text(prop, "Object", "Mesh object to use for Boolean operation");
1902 RNA_def_property_pointer_funcs(prop, NULL, "rna_BooleanModifier_object_set", NULL, "rna_Mesh_object_poll");
1903 RNA_def_property_flag(prop, PROP_EDITABLE | PROP_ID_SELF_CHECK);
1904 RNA_def_property_update(prop, 0, "rna_Modifier_dependency_update");
1906 prop = RNA_def_property(srna, "operation", PROP_ENUM, PROP_NONE);
1907 RNA_def_property_enum_items(prop, prop_operation_items);
1908 RNA_def_property_ui_text(prop, "Operation", "");
1909 RNA_def_property_update(prop, 0, "rna_Modifier_update");
1911 prop = RNA_def_property(srna, "solver", PROP_ENUM, PROP_NONE);
1912 RNA_def_property_enum_items(prop, prop_solver_items);
1913 RNA_def_property_ui_text(prop, "Solver", "");
1914 RNA_def_property_update(prop, 0, "rna_Modifier_update");
1916 prop = RNA_def_property(srna, "double_threshold", PROP_FLOAT, PROP_DISTANCE);
1917 RNA_def_property_float_sdna(prop, NULL, "double_threshold");
1918 RNA_def_property_range(prop, 0, 1.0f);
1919 RNA_def_property_ui_range(prop, 0, 1, 0.0001, 7);
1920 RNA_def_property_ui_text(prop, "Overlap Threshold", "Threshold for checking overlapping geometry");
1921 RNA_def_property_update(prop, 0, "rna_Modifier_update");
1924 static void rna_def_modifier_array(BlenderRNA *brna)
1929 static EnumPropertyItem prop_fit_type_items[] = {
1930 {MOD_ARR_FIXEDCOUNT, "FIXED_COUNT", 0, "Fixed Count", "Duplicate the object a certain number of times"},
1931 {MOD_ARR_FITLENGTH, "FIT_LENGTH", 0, "Fit Length",
1932 "Duplicate the object as many times as fits in a certain length"},
1933 {MOD_ARR_FITCURVE, "FIT_CURVE", 0, "Fit Curve", "Fit the duplicated objects to a curve"},
1934 {0, NULL, 0, NULL, NULL}
1937 srna = RNA_def_struct(brna, "ArrayModifier", "Modifier");
1938 RNA_def_struct_ui_text(srna, "Array Modifier", "Array duplication modifier");
1939 RNA_def_struct_sdna(srna, "ArrayModifierData");
1940 RNA_def_struct_ui_icon(srna, ICON_MOD_ARRAY);
1942 /* Length parameters */
1943 prop = RNA_def_property(srna, "fit_type", PROP_ENUM, PROP_NONE);
1944 RNA_def_property_enum_items(prop, prop_fit_type_items);
1945 RNA_def_property_ui_text(prop, "Fit Type", "Array length calculation method");
1946 RNA_def_property_update(prop, 0, "rna_Modifier_update");
1948 prop = RNA_def_property(srna, "count", PROP_INT, PROP_NONE);
1949 RNA_def_property_range(prop, 1, INT_MAX);
1950 RNA_def_property_ui_range(prop, 1, 1000, 1, -1);
1951 RNA_def_property_ui_text(prop, "Count", "Number of duplicates to make");
1952 RNA_def_property_update(prop, 0, "rna_Modifier_update");
1954 prop = RNA_def_property(srna, "fit_length", PROP_FLOAT, PROP_DISTANCE);
1955 RNA_def_property_float_sdna(prop, NULL, "length");
1956 RNA_def_property_range(prop, 0, INT_MAX);
1957 RNA_def_property_ui_range(prop, 0, 10000, 10, 2);
1958 RNA_def_property_ui_text(prop, "Length", "Length to fit array within");
1959 RNA_def_property_update(prop, 0, "rna_Modifier_update");
1961 prop = RNA_def_property(srna, "curve", PROP_POINTER, PROP_NONE);
1962 RNA_def_property_pointer_sdna(prop, NULL, "curve_ob");
1963 RNA_def_property_ui_text(prop, "Curve", "Curve object to fit array length to");
1964 RNA_def_property_pointer_funcs(prop, NULL, "rna_ArrayModifier_curve_ob_set", NULL, "rna_Curve_object_poll");
1965 RNA_def_property_flag(prop, PROP_EDITABLE | PROP_ID_SELF_CHECK);
1966 RNA_def_property_update(prop, 0, "rna_ArrayModifier_dependency_update");
1968 /* Offset parameters */
1969 prop = RNA_def_property(srna, "use_constant_offset", PROP_BOOLEAN, PROP_NONE);
1970 RNA_def_property_boolean_sdna(prop, NULL, "offset_type", MOD_ARR_OFF_CONST);
1971 RNA_def_property_ui_text(prop, "Constant Offset", "Add a constant offset");
1972 RNA_def_property_update(prop, 0, "rna_Modifier_update");
1974 prop = RNA_def_property(srna, "constant_offset_displace", PROP_FLOAT, PROP_TRANSLATION);
1975 RNA_def_property_float_sdna(prop, NULL, "offset");
1976 RNA_def_property_ui_text(prop, "Constant Offset Displacement", "Value for the distance between arrayed items");
1977 RNA_def_property_ui_range(prop, -FLT_MAX, FLT_MAX, 1, RNA_TRANSLATION_PREC_DEFAULT);
1978 RNA_def_property_update(prop, 0, "rna_Modifier_update");
1980 prop = RNA_def_property(srna, "use_relative_offset", PROP_BOOLEAN, PROP_NONE);
1981 RNA_def_property_boolean_sdna(prop, NULL, "offset_type", MOD_ARR_OFF_RELATIVE);
1982 RNA_def_property_ui_text(prop, "Relative Offset", "Add an offset relative to the object's bounding box");
1983 RNA_def_property_update(prop, 0, "rna_Modifier_update");
1985 /* PROP_TRANSLATION causes units to be used which we don't want */
1986 prop = RNA_def_property(srna, "relative_offset_displace", PROP_FLOAT, PROP_NONE);
1987 RNA_def_property_float_sdna(prop, NULL, "scale");
1988 RNA_def_property_ui_text(prop, "Relative Offset Displacement",
1989 "The size of the geometry will determine the distance between arrayed items");
1990 RNA_def_property_update(prop, 0, "rna_Modifier_update");
1992 /* Vertex merging parameters */
1993 prop = RNA_def_property(srna, "use_merge_vertices", PROP_BOOLEAN, PROP_NONE);
1994 RNA_def_property_boolean_sdna(prop, NULL, "flags", MOD_ARR_MERGE);
1995 RNA_def_property_ui_text(prop, "Merge Vertices", "Merge vertices in adjacent duplicates");
1996 RNA_def_property_update(prop, 0, "rna_Modifier_update");
1998 prop = RNA_def_property(srna, "use_merge_vertices_cap", PROP_BOOLEAN, PROP_NONE);
1999 RNA_def_property_boolean_sdna(prop, NULL, "flags", MOD_ARR_MERGEFINAL);
2000 RNA_def_property_ui_text(prop, "Merge Vertices", "Merge vertices in first and last duplicates");
2001 RNA_def_property_update(prop, 0, "rna_Modifier_update");
2003 prop = RNA_def_property(srna, "merge_threshold", PROP_FLOAT, PROP_DISTANCE);
2004 RNA_def_property_float_sdna(prop, NULL, "merge_dist");
2005 RNA_def_property_range(prop, 0, FLT_MAX);
2006 RNA_def_property_ui_range(prop, 0, 1, 1, 4);
2007 RNA_def_property_ui_text(prop, "Merge Distance", "Limit below which to merge vertices");
2008 RNA_def_property_update(prop, 0, "rna_Modifier_update");
2011 prop = RNA_def_property(srna, "use_object_offset", PROP_BOOLEAN, PROP_NONE);
2012 RNA_def_property_boolean_sdna(prop, NULL, "offset_type", MOD_ARR_OFF_OBJ);
2013 RNA_def_property_ui_text(prop, "Object Offset", "Add another object's transformation to the total offset");
2014 RNA_def_property_update(prop, 0, "rna_Modifier_update");
2016 prop = RNA_def_property(srna, "offset_object", PROP_POINTER, PROP_NONE);
2017 RNA_def_property_pointer_sdna(prop, NULL, "offset_ob");
2018 RNA_def_property_ui_text(prop, "Object Offset",
2019 "Use the location and rotation of another object to determine the distance and "
2020 "rotational change between arrayed items");
2021 RNA_def_property_flag(prop, PROP_EDITABLE | PROP_ID_SELF_CHECK);
2022 RNA_def_property_update(prop, 0, "rna_Modifier_dependency_update");
2025 prop = RNA_def_property(srna, "start_cap", PROP_POINTER, PROP_NONE);
2026 RNA_def_property_ui_text(prop, "Start Cap", "Mesh object to use as a start cap");
2027 RNA_def_property_pointer_funcs(prop, NULL, "rna_ArrayModifier_start_cap_set", NULL, "rna_Mesh_object_poll");
2028 RNA_def_property_flag(prop, PROP_EDITABLE | PROP_ID_SELF_CHECK);
2029 RNA_def_property_update(prop, 0, "rna_Modifier_update");
2031 prop = RNA_def_property(srna, "end_cap", PROP_POINTER, PROP_NONE);
2032 RNA_def_property_ui_text(prop, "End Cap", "Mesh object to use as an end cap");
2033 RNA_def_property_pointer_funcs(prop, NULL, "rna_ArrayModifier_end_cap_set", NULL, "rna_Mesh_object_poll");
2034 RNA_def_property_flag(prop, PROP_EDITABLE | PROP_ID_SELF_CHECK);
2035 RNA_def_property_update(prop, 0, "rna_Modifier_dependency_update");
2038 static void rna_def_modifier_edgesplit(BlenderRNA *brna)
2043 srna = RNA_def_struct(brna, "EdgeSplitModifier", "Modifier");
2044 RNA_def_struct_ui_text(srna, "EdgeSplit Modifier", "Edge splitting modifier to create sharp edges");
2045 RNA_def_struct_sdna(srna, "EdgeSplitModifierData");
2046 RNA_def_struct_ui_icon(srna, ICON_MOD_EDGESPLIT);
2048 prop = RNA_def_property(srna, "split_angle", PROP_FLOAT, PROP_ANGLE);
2049 RNA_def_property_range(prop, 0.0f, DEG2RADF(180.0f));
2050 RNA_def_property_ui_range(prop, 0.0f, DEG2RADF(180.0f), 10, 2);
2051 RNA_def_property_ui_text(prop, "Split Angle", "Angle above which to split edges");
2052 RNA_def_property_update(prop, 0, "rna_Modifier_update");
2054 prop = RNA_def_property(srna, "use_edge_angle", PROP_BOOLEAN, PROP_NONE);
2055 RNA_def_property_boolean_sdna(prop, NULL, "flags", MOD_EDGESPLIT_FROMANGLE);
2056 RNA_def_property_ui_text(prop, "Use Edge Angle", "Split edges with high angle between faces");
2057 RNA_def_property_update(prop, 0, "rna_Modifier_update");
2059 prop = RNA_def_property(srna, "use_edge_sharp", PROP_BOOLEAN, PROP_NONE);
2060 RNA_def_property_boolean_sdna(prop, NULL, "flags", MOD_EDGESPLIT_FROMFLAG);
2061 RNA_def_property_ui_text(prop, "Use Sharp Edges", "Split edges that are marked as sharp");
2062 RNA_def_property_update(prop, 0, "rna_Modifier_update");
2065 static void rna_def_modifier_displace(BlenderRNA *brna)
2070 static EnumPropertyItem prop_direction_items[] = {
2071 {MOD_DISP_DIR_X, "X", 0, "X", "Use the texture's intensity value to displace in the X direction"},
2072 {MOD_DISP_DIR_Y, "Y", 0, "Y", "Use the texture's intensity value to displace in the Y direction"},
2073 {MOD_DISP_DIR_Z, "Z", 0, "Z", "Use the texture's intensity value to displace in the Z direction"},
2074 {MOD_DISP_DIR_NOR, "NORMAL", 0, "Normal",
2075 "Use the texture's intensity value to displace along the vertex normal"},
2076 {MOD_DISP_DIR_CLNOR, "CUSTOM_NORMAL", 0, "Custom Normal",
2077 "Use the texture's intensity value to displace along the (averaged) custom normal (falls back to vertex)"},
2078 {MOD_DISP_DIR_RGB_XYZ, "RGB_TO_XYZ", 0, "RGB to XYZ",
2079 "Use the texture's RGB values to displace the mesh in the XYZ direction"},
2080 {0, NULL, 0, NULL, NULL}
2083 static EnumPropertyItem prop_space_items[] = {
2084 {MOD_DISP_SPACE_LOCAL, "LOCAL", 0, "Local", "Direction is defined in local coordinates"},
2085 {MOD_DISP_SPACE_GLOBAL, "GLOBAL", 0, "Global", "Direction is defined in global coordinates"},
2086 {0, NULL, 0, NULL, NULL}
2089 srna = RNA_def_struct(brna, "DisplaceModifier", "Modifier");
2090 RNA_def_struct_ui_text(srna, "Displace Modifier", "Displacement modifier");
2091 RNA_def_struct_sdna(srna, "DisplaceModifierData");
2092 RNA_def_struct_ui_icon(srna, ICON_MOD_DISPLACE);
2094 prop = RNA_def_property(srna, "vertex_group", PROP_STRING, PROP_NONE);
2095 RNA_def_property_string_sdna(prop, NULL, "defgrp_name");
2096 RNA_def_property_ui_text(prop, "Vertex Group",
2097 "Name of Vertex Group which determines influence of modifier per point");
2098 RNA_def_property_string_funcs(prop, NULL, NULL, "rna_DisplaceModifier_defgrp_name_set");
2099 RNA_def_property_update(prop, 0, "rna_Modifier_update");
2101 prop = RNA_def_property(srna, "mid_level", PROP_FLOAT, PROP_FACTOR);
2102 RNA_def_property_float_sdna(prop, NULL, "midlevel");
2103 RNA_def_property_range(prop, -FLT_MAX, FLT_MAX);
2104 RNA_def_property_ui_range(prop, 0, 1, 10, 3);
2105 RNA_def_property_ui_text(prop, "Midlevel", "Material value that gives no displacement");
2106 RNA_def_property_update(prop, 0, "rna_Modifier_update");
2108 prop = RNA_def_property(srna, "strength", PROP_FLOAT, PROP_NONE);
2109 RNA_def_property_range(prop, -FLT_MAX, FLT_MAX);
2110 RNA_def_property_ui_range(prop, -100, 100, 10, 3);
2111 RNA_def_property_ui_text(prop, "Strength", "Amount to displace geometry");
2112 RNA_def_property_update(prop, 0, "rna_Modifier_update");
2114 prop = RNA_def_property(srna, "direction", PROP_ENUM, PROP_NONE);
2115 RNA_def_property_enum_items(prop, prop_direction_items);
2116 RNA_def_property_ui_text(prop, "Direction", "");
2117 RNA_def_property_update(prop, 0, "rna_Modifier_update");
2119 prop = RNA_def_property(srna, "space", PROP_ENUM, PROP_NONE);
2120 RNA_def_property_enum_items(prop, prop_space_items);
2121 RNA_def_property_ui_text(prop, "Space", "");
2122 RNA_def_property_update(prop, 0, "rna_Modifier_dependency_update");
2124 rna_def_modifier_generic_map_info(srna);
2127 static void rna_def_modifier_uvproject(BlenderRNA *brna)
2132 srna = RNA_def_struct(brna, "UVProjectModifier", "Modifier");
2133 RNA_def_struct_ui_text(srna, "UV Project Modifier", "UV projection modifier to set UVs from a projector");
2134 RNA_def_struct_sdna(srna, "UVProjectModifierData");
2135 RNA_def_struct_ui_icon(srna, ICON_MOD_UVPROJECT);
2137 prop = RNA_def_property(srna, "uv_layer", PROP_STRING, PROP_NONE);
2138 RNA_def_property_string_sdna(prop, NULL, "uvlayer_name");
2139 RNA_def_property_ui_text(prop, "UV Map", "UV map name");
2140 RNA_def_property_string_funcs(prop, NULL, NULL, "rna_UVProjectModifier_uvlayer_name_set");
2141 RNA_def_property_update(prop, 0, "rna_Modifier_update");
2143 prop = RNA_def_property(srna, "projector_count", PROP_INT, PROP_NONE);
2144 RNA_def_property_int_sdna(prop, NULL, "num_projectors");
2145 RNA_def_property_ui_text(prop, "Number of Projectors", "Number of projectors to use");
2146 RNA_def_property_int_funcs(prop, NULL, "rna_UVProjectModifier_num_projectors_set", NULL);
2147 RNA_def_property_range(prop, 1, MOD_UVPROJECT_MAXPROJECTORS);
2148 RNA_def_property_update(prop, 0, "rna_Modifier_update");
2150 prop = RNA_def_property(srna, "projectors", PROP_COLLECTION, PROP_NONE);
2151 RNA_def_property_struct_type(prop, "UVProjector");
2152 RNA_def_property_collection_funcs(prop, "rna_UVProject_projectors_begin", "rna_iterator_array_next",
2153 "rna_iterator_array_end", "rna_iterator_array_get", NULL, NULL, NULL, NULL);
2154 RNA_def_property_ui_text(prop, "Projectors", "");
2156 prop = RNA_def_property(srna, "image", PROP_POINTER, PROP_NONE);
2157 RNA_def_property_ui_text(prop, "Image", "");
2158 RNA_def_property_flag(prop, PROP_EDITABLE);
2159 RNA_def_property_update(prop, 0, "rna_Modifier_update");
2161 prop = RNA_def_property(srna, "aspect_x", PROP_FLOAT, PROP_NONE);
2162 RNA_def_property_float_sdna(prop, NULL, "aspectx");
2163 RNA_def_property_flag(prop, PROP_PROPORTIONAL);
2164 RNA_def_property_range(prop, 1, FLT_MAX);
2165 RNA_def_property_ui_range(prop, 1, 1000, 1, 3);
2166 RNA_def_property_ui_text(prop, "Horizontal Aspect Ratio", "");
2167 RNA_def_property_update(prop, 0, "rna_Modifier_update");
2169 prop = RNA_def_property(srna, "aspect_y", PROP_FLOAT, PROP_NONE);
2170 RNA_def_property_float_sdna(prop, NULL, "aspecty");
2171 RNA_def_property_flag(prop, PROP_PROPORTIONAL);
2172 RNA_def_property_range(prop, 1, FLT_MAX);
2173 RNA_def_property_ui_range(prop, 1, 1000, 1, 3);
2174 RNA_def_property_ui_text(prop, "Vertical Aspect Ratio", "");
2175 RNA_def_property_update(prop, 0, "rna_Modifier_update");
2177 prop = RNA_def_property(srna, "scale_x", PROP_FLOAT, PROP_NONE);
2178 RNA_def_property_float_sdna(prop, NULL, "scalex");
2179 RNA_def_property_flag(prop, PROP_PROPORTIONAL);
2180 RNA_def_property_range(prop, 0, FLT_MAX);
2181 RNA_def_property_ui_range(prop, 0, 1000, 1, 3);
2182 RNA_def_property_ui_text(prop, "Horizontal Scale", "");
2183 RNA_def_property_update(prop, 0, "rna_Modifier_update");
2185 prop = RNA_def_property(srna, "scale_y", PROP_FLOAT, PROP_NONE);
2186 RNA_def_property_float_sdna(prop, NULL, "scaley");
2187 RNA_def_property_flag(prop, PROP_PROPORTIONAL);
2188 RNA_def_property_range(prop, 0, FLT_MAX);
2189 RNA_def_property_ui_range(prop, 0, 1000, 1, 3);
2190 RNA_def_property_ui_text(prop, "Vertical Scale", "");
2191 RNA_def_property_update(prop, 0, "rna_Modifier_update");
2193 prop = RNA_def_property(srna, "use_image_override", PROP_BOOLEAN, PROP_NONE);
2194 RNA_def_property_boolean_sdna(prop, NULL, "flags", MOD_UVPROJECT_OVERRIDEIMAGE);
2195 RNA_def_property_ui_text(prop, "Override Image", "Override faces' current images with the given image");
2196 RNA_def_property_update(prop, 0, "rna_Modifier_update");
2198 srna = RNA_def_struct(brna, "UVProjector", NULL);
2199 RNA_def_struct_ui_text(srna, "UVProjector", "UV projector used by the UV project modifier");
2201 prop = RNA_def_property(srna, "object", PROP_POINTER, PROP_NONE);
2202 RNA_def_property_struct_type(prop, "Object");
2203 RNA_def_property_pointer_funcs(prop, "rna_UVProjector_object_get", "rna_UVProjector_object_set", NULL, NULL);
2204 RNA_def_property_flag(prop, PROP_EDITABLE | PROP_ID_SELF_CHECK);
2205 RNA_def_property_ui_text(prop, "Object", "Object to use as projector transform");
2206 RNA_def_property_update(prop, 0, "rna_Modifier_dependency_update");
2209 static void rna_def_modifier_smooth(BlenderRNA *brna)
2214 srna = RNA_def_struct(brna, "SmoothModifier", "Modifier");
2215 RNA_def_struct_ui_text(srna, "Smooth Modifier", "Smoothing effect modifier");
2216 RNA_def_struct_sdna(srna, "SmoothModifierData");
2217 RNA_def_struct_ui_icon(srna, ICON_MOD_SMOOTH);
2219 prop = RNA_def_property(srna, "use_x", PROP_BOOLEAN, PROP_NONE);
2220 RNA_def_property_boolean_sdna(prop, NULL, "flag", MOD_SMOOTH_X);
2221 RNA_def_property_ui_text(prop, "X", "Smooth object along X axis");
2222 RNA_def_property_update(prop, 0, "rna_Modifier_update");
2224 prop = RNA_def_property(srna, "use_y", PROP_BOOLEAN, PROP_NONE);
2225 RNA_def_property_boolean_sdna(prop, NULL, "flag", MOD_SMOOTH_Y);
2226 RNA_def_property_ui_text(prop, "Y", "Smooth object along Y axis");
2227 RNA_def_property_update(prop, 0, "rna_Modifier_update");
2229 prop = RNA_def_property(srna, "use_z", PROP_BOOLEAN, PROP_NONE);
2230 RNA_def_property_boolean_sdna(prop, NULL, "flag", MOD_SMOOTH_Z);
2231 RNA_def_property_ui_text(prop, "Z", "Smooth object along Z axis");
2232 RNA_def_property_update(prop, 0, "rna_Modifier_update");
2234 prop = RNA_def_property(srna, "factor", PROP_FLOAT, PROP_NONE);
2235 RNA_def_property_float_sdna(prop, NULL, "fac");
2236 RNA_def_property_range(prop, -FLT_MAX, FLT_MAX);
2237 RNA_def_property_ui_range(prop, -10, 10, 1, 3);
2238 RNA_def_property_ui_text(prop, "Factor", "Strength of modifier effect");
2239 RNA_def_property_update(prop, 0, "rna_Modifier_update");
2241 prop = RNA_def_property(srna, "iterations", PROP_INT, PROP_NONE);
2242 RNA_def_property_int_sdna(prop, NULL, "repeat");
2243 RNA_def_property_ui_range(prop, 0, 30, 1, -1);
2244 RNA_def_property_ui_text(prop, "Repeat", "");
2245 RNA_def_property_update(prop, 0, "rna_Modifier_update");
2247 prop = RNA_def_property(srna, "vertex_group", PROP_STRING, PROP_NONE);
2248 RNA_def_property_string_sdna(prop, NULL, "defgrp_name");
2249 RNA_def_property_ui_text(prop, "Vertex Group",
2250 "Name of Vertex Group which determines influence of modifier per point");
2251 RNA_def_property_string_funcs(prop, NULL, NULL, "rna_SmoothModifier_defgrp_name_set");
2252 RNA_def_property_update(prop, 0, "rna_Modifier_update");
2256 static void rna_def_modifier_correctivesmooth(BlenderRNA *brna)
2261 static EnumPropertyItem modifier_smooth_type_items[] = {
2262 {MOD_CORRECTIVESMOOTH_SMOOTH_SIMPLE, "SIMPLE", 0, "Simple",
2263 "Use the average of adjacent edge-vertices"},
2264 {MOD_CORRECTIVESMOOTH_SMOOTH_LENGTH_WEIGHT, "LENGTH_WEIGHTED", 0, "Length Weight",
2265 "Use the average of adjacent edge-vertices weighted by their length"},
2266 {0, NULL, 0, NULL, NULL}
2269 static EnumPropertyItem modifier_rest_source_items[] = {
2270 {MOD_CORRECTIVESMOOTH_RESTSOURCE_ORCO, "ORCO", 0, "Original Coords",
2271 "Use base mesh vert coords as the rest position"},
2272 {MOD_CORRECTIVESMOOTH_RESTSOURCE_BIND, "BIND", 0, "Bind Coords",
2273 "Use bind vert coords for rest position"},
2274 {0, NULL, 0, NULL, NULL}
2277 srna = RNA_def_struct(brna, "CorrectiveSmoothModifier", "Modifier");
2278 RNA_def_struct_ui_text(srna, "Corrective Smooth Modifier", "Correct distortion caused by deformation");
2279 RNA_def_struct_sdna(srna, "CorrectiveSmoothModifierData");
2280 RNA_def_struct_ui_icon(srna, ICON_MOD_SMOOTH);
2282 prop = RNA_def_property(srna, "factor", PROP_FLOAT, PROP_NONE);
2283 RNA_def_property_float_sdna(prop, NULL, "lambda");
2284 RNA_def_property_range(prop, -FLT_MAX, FLT_MAX);
2285 RNA_def_property_ui_range(prop, 0.0, 1.0, 5, 3);
2286 RNA_def_property_ui_text(prop, "Lambda Factor", "Smooth factor effect");
2287 RNA_def_property_update(prop, 0, "rna_CorrectiveSmoothModifier_update");
2289 prop = RNA_def_property(srna, "iterations", PROP_INT, PROP_NONE);
2290 RNA_def_property_int_sdna(prop, NULL, "repeat");
2291 RNA_def_property_ui_range(prop, 0, 200, 1, -1);
2292 RNA_def_property_ui_text(prop, "Repeat", "");
2293 RNA_def_property_update(prop, 0, "rna_CorrectiveSmoothModifier_update");
2295 prop = RNA_def_property(srna, "rest_source", PROP_ENUM, PROP_NONE);
2296 RNA_def_property_enum_sdna(prop, NULL, "rest_source");
2297 RNA_def_property_enum_items(prop, modifier_rest_source_items);
2298 RNA_def_property_ui_text(prop, "Rest Source", "Select the source of rest positions");
2299 RNA_def_property_update(prop, 0, "rna_CorrectiveSmoothModifier_rest_source_update");
2301 prop = RNA_def_property(srna, "smooth_type", PROP_ENUM, PROP_NONE);
2302 RNA_def_property_enum_sdna(prop, NULL, "smooth_type");
2303 RNA_def_property_enum_items(prop, modifier_smooth_type_items);
2304 RNA_def_property_ui_text(prop, "Smooth Type", "Method used for smoothing");
2305 RNA_def_property_update(prop, 0, "rna_CorrectiveSmoothModifier_update");
2307 prop = RNA_def_property(srna, "invert_vertex_group", PROP_BOOLEAN, PROP_NONE);
2308 RNA_def_property_boolean_sdna(prop, NULL, "flag", MOD_CORRECTIVESMOOTH_INVERT_VGROUP);
2309 RNA_def_property_ui_text(prop, "Invert", "Invert vertex group influence");
2310 RNA_def_property_update(prop, 0, "rna_CorrectiveSmoothModifier_update");
2312 prop = RNA_def_property(srna, "vertex_group", PROP_STRING, PROP_NONE);
2313 RNA_def_property_string_sdna(prop, NULL, "defgrp_name");
2314 RNA_def_property_ui_text(prop, "Vertex Group",
2315 "Name of Vertex Group which determines influence of modifier per point");
2316 RNA_def_property_string_funcs(prop, NULL, NULL, "rna_CorrectiveSmoothModifier_defgrp_name_set");
2317 RNA_def_property_update(prop, 0, "rna_CorrectiveSmoothModifier_update");
2319 prop = RNA_def_property(srna, "is_bind", PROP_BOOLEAN, PROP_NONE);
2320 RNA_def_property_ui_text(prop, "Bind current shape", "");
2321 RNA_def_property_boolean_funcs(prop, "rna_CorrectiveSmoothModifier_is_bind_get", NULL);
2322 RNA_def_property_clear_flag(prop, PROP_EDITABLE);
2323 RNA_def_property_update(prop, 0, "rna_Modifier_update");
2325 prop = RNA_def_property(srna, "use_only_smooth", PROP_BOOLEAN, PROP_NONE);
2326 RNA_def_property_boolean_sdna(prop, NULL, "flag", MOD_CORRECTIVESMOOTH_ONLY_SMOOTH);
2327 RNA_def_property_ui_text(prop, "Only Smooth",
2328 "Apply smoothing without reconstructing the surface");
2329 RNA_def_property_update(prop, 0, "rna_Modifier_update");
2331 prop = RNA_def_property(srna, "use_pin_boundary", PROP_BOOLEAN, PROP_NONE);
2332 RNA_def_property_boolean_sdna(prop, NULL, "flag", MOD_CORRECTIVESMOOTH_PIN_BOUNDARY);
2333 RNA_def_property_ui_text(prop, "Pin Boundaries",
2334 "Excludes boundary vertices from being smoothed");
2335 RNA_def_property_update(prop, 0, "rna_CorrectiveSmoothModifier_update");
2339 static void rna_def_modifier_laplaciansmooth(BlenderRNA *brna)
2344 srna = RNA_def_struct(brna, "LaplacianSmoothModifier", "Modifier");
2345 RNA_def_struct_ui_text(srna, "Laplacian Smooth Modifier", "Smoothing effect modifier");
2346 RNA_def_struct_sdna(srna, "LaplacianSmoothModifierData");
2347 RNA_def_struct_ui_icon(srna, ICON_MOD_SMOOTH);
2349 prop = RNA_def_property(srna, "use_x", PROP_BOOLEAN, PROP_NONE);
2350 RNA_def_property_boolean_sdna(prop, NULL, "flag", MOD_LAPLACIANSMOOTH_X);
2351 RNA_def_property_ui_text(prop, "X", "Smooth object along X axis");
2352 RNA_def_property_update(prop, 0, "rna_Modifier_update");
2354 prop = RNA_def_property(srna, "use_y", PROP_BOOLEAN, PROP_NONE);
2355 RNA_def_property_boolean_sdna(prop, NULL, "flag", MOD_LAPLACIANSMOOTH_Y);
2356 RNA_def_property_ui_text(prop, "Y", "Smooth object along Y axis");
2357 RNA_def_property_update(prop, 0, "rna_Modifier_update");
2359 prop = RNA_def_property(srna, "use_z", PROP_BOOLEAN, PROP_NONE);
2360 RNA_def_property_boolean_sdna(prop, NULL, "flag", MOD_LAPLACIANSMOOTH_Z);
2361 RNA_def_property_ui_text(prop, "Z", "Smooth object along Z axis");
2362 RNA_def_property_update(prop, 0, "rna_Modifier_update");
2364 prop = RNA_def_property(srna, "use_volume_preserve", PROP_BOOLEAN, PROP_NONE);
2365 RNA_def_property_boolean_sdna(prop, NULL, "flag", MOD_LAPLACIANSMOOTH_PRESERVE_VOLUME);
2366 RNA_def_property_ui_text(prop, "Preserve Volume", "Apply volume preservation after smooth");
2367 RNA_def_property_update(prop, 0, "rna_Modifier_update");
2369 prop = RNA_def_property(srna, "use_normalized", PROP_BOOLEAN, PROP_NONE);
2370 RNA_def_property_boolean_sdna(prop, NULL, "flag", MOD_LAPLACIANSMOOTH_NORMALIZED);
2371 RNA_def_property_ui_text(prop, "Normalized", "Improve and stabilize the enhanced shape");
2372 RNA_def_property_update(prop, 0, "rna_Modifier_update");
2374 prop = RNA_def_property(srna, "lambda_factor", PROP_FLOAT, PROP_NONE);
2375 RNA_def_property_float_sdna(prop, NULL, "lambda");
2376 RNA_def_property_range(prop, -FLT_MAX, FLT_MAX);
2377 RNA_def_property_ui_range(prop, -1000.0, 1000.0, 5, 3);
2378 RNA_def_property_ui_text(prop, "Lambda Factor", "Smooth factor effect");
2379 RNA_def_property_update(prop, 0, "rna_Modifier_update");
2381 prop = RNA_def_property(srna, "lambda_border", PROP_FLOAT, PROP_NONE);
2382 RNA_def_property_float_sdna(prop, NULL, "lambda_border");
2383 RNA_def_property_range(prop, -FLT_MAX, FLT_MAX);
2384 RNA_def_property_ui_range(prop, -1000.0, 1000.0, 5, 3);
2385 RNA_def_property_ui_text(prop, "Lambda Border", "Lambda factor in border");
2386 RNA_def_property_update(prop, 0, "rna_Modifier_update");
2388 prop = RNA_def_property(srna, "iterations", PROP_INT, PROP_NONE);
2389 RNA_def_property_int_sdna(prop, NULL, "repeat");
2390 RNA_def_property_ui_range(prop, 0, 200, 1, -1);
2391 RNA_def_property_ui_text(prop, "Repeat", "");
2392 RNA_def_property_update(prop, 0, "rna_Modifier_update");
2394 prop = RNA_def_property(srna, "vertex_group", PROP_STRING, PROP_NONE);
2395 RNA_def_property_string_sdna(prop, NULL, "defgrp_name");
2396 RNA_def_property_ui_text(prop, "Vertex Group",
2397 "Name of Vertex Group which determines influence of modifier per point");
2398 RNA_def_property_string_funcs(prop, NULL, NULL, "rna_LaplacianSmoothModifier_defgrp_name_set");
2399 RNA_def_property_update(prop, 0, "rna_Modifier_update");
2402 static void rna_def_modifier_cast(BlenderRNA *brna)
2407 static EnumPropertyItem prop_cast_type_items[] = {
2408 {MOD_CAST_TYPE_SPHERE, "SPHERE", 0, "Sphere", ""},
2409 {MOD_CAST_TYPE_CYLINDER, "CYLINDER", 0, "Cylinder", ""},
2410 {MOD_CAST_TYPE_CUBOID, "CUBOID", 0, "Cuboid", ""},
2411 {0, NULL, 0, NULL, NULL}
2414 srna = RNA_def_struct(brna, "CastModifier", "Modifier");
2415 RNA_def_struct_ui_text(srna, "Cast Modifier", "Modifier to cast to other shapes");
2416 RNA_def_struct_sdna(srna, "CastModifierData");
2417 RNA_def_struct_ui_icon(srna, ICON_MOD_CAST);
2419 prop = RNA_def_property(srna, "cast_type", PROP_ENUM, PROP_NONE);
2420 RNA_def_property_enum_sdna(prop, NULL, "type");
2421 RNA_def_property_enum_items(prop, prop_cast_type_items);
2422 RNA_def_property_ui_text(prop, "Cast Type", "Target object shape");
2423 RNA_def_property_update(prop, 0, "rna_Modifier_update");
2425 prop = RNA_def_property(srna, "object", PROP_POINTER, PROP_NONE);
2426 RNA_def_property_ui_text(prop, "Object",
2427 "Control object: if available, its location determines the center of the effect");
2428 RNA_def_property_pointer_funcs(prop, NULL, "rna_CastModifier_object_set", NULL, NULL);
2429 RNA_def_property_flag(prop, PROP_EDITABLE | PROP_ID_SELF_CHECK);
2430 RNA_def_property_update(prop, 0, "rna_Modifier_dependency_update");
2432 prop = RNA_def_property(srna, "use_x", PROP_BOOLEAN, PROP_NONE);
2433 RNA_def_property_boolean_sdna(prop, NULL, "flag", MOD_CAST_X);
2434 RNA_def_property_ui_text(prop, "X", "");
2435 RNA_def_property_update(prop, 0, "rna_Modifier_update");
2437 prop = RNA_def_property(srna, "use_y", PROP_BOOLEAN, PROP_NONE);
2438 RNA_def_property_boolean_sdna(prop, NULL, "flag", MOD_CAST_Y);
2439 RNA_def_property_ui_text(prop, "Y", "");
2440 RNA_def_property_update(prop, 0, "rna_Modifier_update");
2442 prop = RNA_def_property(srna, "use_z", PROP_BOOLEAN, PROP_NONE);
2443 RNA_def_property_boolean_sdna(prop, NULL, "flag", MOD_CAST_Z);
2444 RNA_def_property_ui_text(prop, "Z", "");
2445 RNA_def_property_update(prop, 0, "rna_Modifier_update");
2447 prop = RNA_def_property(srna, "use_radius_as_size", PROP_BOOLEAN, PROP_NONE);
2448 RNA_def_property_boolean_sdna(prop, NULL, "flag", MOD_CAST_SIZE_FROM_RADIUS);
2449 RNA_def_property_ui_text(prop, "From Radius", "Use radius as size of projection shape (0 = auto)");
2450 RNA_def_property_update(prop, 0, "rna_Modifier_update");
2452 prop = RNA_def_property(srna, "use_transform", PROP_BOOLEAN, PROP_NONE);
2453 RNA_def_property_boolean_sdna(prop, NULL, "flag", MOD_CAST_USE_OB_TRANSFORM);
2454 RNA_def_property_ui_text(prop, "Use transform", "Use object transform to control projection shape");
2455 RNA_def_property_update(prop, 0, "rna_Modifier_update");
2457 prop = RNA_def_property(srna, "factor", PROP_FLOAT, PROP_NONE);
2458 RNA_def_property_float_sdna(prop, NULL, "fac");
2459 RNA_def_property_range(prop, -FLT_MAX, FLT_MAX);
2460 RNA_def_property_ui_range(prop, -10, 10, 5, 2);
2461 RNA_def_property_ui_text(prop, "Factor", "");
2462 RNA_def_property_update(prop, 0, "rna_Modifier_update");
2464 prop = RNA_def_property(srna, "radius", PROP_FLOAT, PROP_DISTANCE);
2465 RNA_def_property_range(prop, 0, FLT_MAX);
2466 RNA_def_property_ui_range(prop, 0, 100, 5, 2);
2467 RNA_def_property_ui_text(prop, "Radius",
2468 "Only deform vertices within this distance from the center of the effect "
2469 "(leave as 0 for infinite.)");
2470 RNA_def_property_update(prop, 0, "rna_Modifier_update");
2472 prop = RNA_def_property(srna, "size", PROP_FLOAT, PROP_NONE);
2473 RNA_def_property_range(prop, 0, FLT_MAX);
2474 RNA_def_property_ui_range(prop, 0, 100, 5, 2);
2475 RNA_def_property_ui_text(prop, "Size", "Size of projection shape (leave as 0 for auto)");
2476 RNA_def_property_update(prop, 0, "rna_Modifier_update");
2478 prop = RNA_def_property(srna, "vertex_group", PROP_STRING, PROP_NONE);
2479 RNA_def_property_string_sdna(prop, NULL, "defgrp_name");
2480 RNA_def_property_ui_text(prop, "Vertex Group", "Vertex group name");
2481 RNA_def_property_string_funcs(prop, NULL, NULL, "rna_CastModifier_defgrp_name_set");
2482 RNA_def_property_update(prop, 0, "rna_Modifier_update");
2485 static void rna_def_modifier_meshdeform(BlenderRNA *brna)
2490 static EnumPropertyItem prop_mode_items[] = {
2491 {0, "VOLUME", 0, "Volume", "Bind to volume inside cage mesh"},
2492 {1, "SURFACE", 0, "Surface", "Bind to surface of cage mesh"},
2493 {0, NULL, 0, NULL, NULL}
2497 srna = RNA_def_struct(brna, "MeshDeformModifier", "Modifier");
2498 RNA_def_struct_ui_text(srna, "MeshDeform Modifier", "Mesh deformation modifier to deform with other meshes");
2499 RNA_def_struct_sdna(srna, "MeshDeformModifierData");
2500 RNA_def_struct_ui_icon(srna, ICON_MOD_MESHDEFORM);
2502 prop = RNA_def_property(srna, "object", PROP_POINTER, PROP_NONE);
2503 RNA_def_property_ui_text(prop, "Object", "Mesh object to deform with");
2504 RNA_def_property_pointer_funcs(prop, NULL, "rna_MeshDeformModifier_object_set", NULL, "rna_Mesh_object_poll");
2505 RNA_def_property_flag(prop, PROP_EDITABLE | PROP_ID_SELF_CHECK);
2506 RNA_def_property_update(prop, 0, "rna_Modifier_dependency_update");
2508 prop = RNA_def_property(srna, "is_bound", PROP_BOOLEAN, PROP_NONE);
2509 RNA_def_property_boolean_funcs(prop, "rna_MeshDeformModifier_is_bound_get", NULL);
2510 RNA_def_property_ui_text(prop, "Bound", "Whether geometry has been bound to control cage");
2511 RNA_def_property_clear_flag(prop, PROP_EDITABLE);
2513 prop = RNA_def_property(srna, "invert_vertex_group", PROP_BOOLEAN, PROP_NONE);
2514 RNA_def_property_boolean_sdna(prop, NULL, "flag", MOD_MDEF_INVERT_VGROUP);
2515 RNA_def_property_ui_text(prop, "Invert", "Invert vertex group influence");
2516 RNA_def_property_update(prop, 0, "rna_Modifier_update");
2518 prop = RNA_def_property(srna, "vertex_group", PROP_STRING, PROP_NONE);
2519 RNA_def_property_string_sdna(prop, NULL, "defgrp_name");
2520 RNA_def_property_ui_text(prop, "Vertex Group", "Vertex group name");
2521 RNA_def_property_string_funcs(prop, NULL, NULL, "rna_MeshDeformModifier_defgrp_name_set");
2522 RNA_def_property_update(prop, 0, "rna_Modifier_update");
2524 prop = RNA_def_property(srna, "precision", PROP_INT, PROP_NONE);
2525 RNA_def_property_int_sdna(prop, NULL, "gridsize");
2526 RNA_def_property_range(prop, 2, 10);
2527 RNA_def_property_ui_text(prop, "Precision", "The grid size for binding");
2528 RNA_def_property_update(prop, 0, "rna_Modifier_update");
2530 prop = RNA_def_property(srna, "use_dynamic_bind", PROP_BOOLEAN, PROP_NONE);
2531 RNA_def_property_boolean_sdna(prop, NULL, "flag", MOD_MDEF_DYNAMIC_BIND);
2532 RNA_def_property_ui_text(prop, "Dynamic",
2533 "Recompute binding dynamically on top of other deformers "
2534 "(slower and more memory consuming)");
2535 RNA_def_property_update(prop, 0, "rna_Modifier_update");
2538 prop = RNA_def_property(srna, "mode", PROP_ENUM, PROP_NONE);
2539 RNA_def_property_enum_items(prop, prop_mode_items);
2540 RNA_def_property_ui_text(prop, "Mode", "Method of binding vertices are bound to cage mesh");
2541 RNA_def_property_update(prop, 0, "rna_Modifier_update");
2545 static void rna_def_modifier_explode(BlenderRNA *brna)
2550 srna = RNA_def_struct(brna, "ExplodeModifier", "Modifier");
2551 RNA_def_struct_ui_text(srna, "Explode Modifier", "Explosion effect modifier based on a particle system");
2552 RNA_def_struct_sdna(srna, "ExplodeModifierData");
2553 RNA_def_struct_ui_icon(srna, ICON_MOD_EXPLODE);
2555 prop = RNA_def_property(srna, "vertex_group", PROP_STRING, PROP_NONE);
2556 RNA_def_property_string_funcs(prop, "rna_ExplodeModifier_vgroup_get", "rna_ExplodeModifier_vgroup_length",
2557 "rna_ExplodeModifier_vgroup_set");
2558 RNA_def_property_ui_text(prop, "Vertex Group", "");
2560 prop = RNA_def_property(srna, "protect", PROP_FLOAT, PROP_NONE);
2561 RNA_def_property_range(prop, 0, 1);
2562 RNA_def_property_ui_text(prop, "Protect", "Clean vertex group edges");
2563 RNA_def_property_update(prop, 0, "rna_Modifier_update");
2565 prop = RNA_def_property(srna, "use_edge_cut", PROP_BOOLEAN, PROP_NONE);
2566 RNA_def_property_boolean_sdna(prop, NULL, "flag", eExplodeFlag_EdgeCut);
2567 RNA_def_property_ui_text(prop, "Cut Edges", "Cut face edges for nicer shrapnel");
2568 RNA_def_property_update(prop, 0, "rna_Modifier_update");
2570 prop = RNA_def_property(srna, "show_unborn", PROP_BOOLEAN, PROP_NONE);
2571 RNA_def_property_boolean_sdna(prop, NULL, "flag", eExplodeFlag_Unborn);
2572 RNA_def_property_ui_text(prop, "Unborn", "Show mesh when particles are unborn");
2573 RNA_def_property_update(prop, 0, "rna_Modifier_update");
2575 prop = RNA_def_property(srna, "show_alive", PROP_BOOLEAN, PROP_NONE);
2576 RNA_def_property_boolean_sdna(prop, NULL, "flag", eExplodeFlag_Alive);
2577 RNA_def_property_ui_text(prop, "Alive", "Show mesh when particles are alive");
2578 RNA_def_property_update(prop, 0, "rna_Modifier_update");
2580 prop = RNA_def_property(srna, "show_dead", PROP_BOOLEAN, PROP_NONE);
2581 RNA_def_property_boolean_sdna(prop, NULL, "flag", eExplodeFlag_Dead);
2582 RNA_def_property_ui_text(prop, "Dead", "Show mesh when particles are dead");
2583 RNA_def_property_update(prop, 0, "rna_Modifier_update");
2585 prop = RNA_def_property(srna, "use_size", PROP_BOOLEAN, PROP_NONE);
2586 RNA_def_property_boolean_sdna(prop, NULL, "flag", eExplodeFlag_PaSize);
2587 RNA_def_property_ui_text(prop, "Size", "Use particle size for the shrapnel");
2588 RNA_def_property_update(prop, 0, "rna_Modifier_update");
2590 prop = RNA_def_property(srna, "particle_uv", PROP_STRING, PROP_NONE);
2591 RNA_def_property_string_sdna(prop, NULL, "uvname");
2592 RNA_def_property_string_maxlength(prop, MAX_CUSTOMDATA_LAYER_NAME);
2593 RNA_def_property_ui_text(prop, "Particle UV", "UV map to change with particle age");
2594 RNA_def_property_update(prop, 0, "rna_Modifier_update");
2597 static void rna_def_modifier_cloth(BlenderRNA *brna)
2602 srna = RNA_def_struct(brna, "ClothModifier", "Modifier");
2603 RNA_def_struct_ui_text(srna, "Cloth Modifier", "Cloth simulation modifier");
2604 RNA_def_struct_sdna(srna, "ClothModifierData");
2605 RNA_def_struct_ui_icon(srna, ICON_MOD_CLOTH);
2607 prop = RNA_def_property(srna, "settings", PROP_POINTER, PROP_NONE);
2608 RNA_def_property_flag(prop, PROP_NEVER_NULL);
2609 RNA_def_property_pointer_sdna(prop, NULL, "sim_parms");
2610 RNA_def_property_ui_text(prop, "Cloth Settings", "");
2612 prop = RNA_def_property(srna, "collision_settings", PROP_POINTER, PROP_NONE);
2613 RNA_def_property_flag(prop, PROP_NEVER_NULL);
2614 RNA_def_property_pointer_sdna(prop, NULL, "coll_parms");
2615 RNA_def_property_ui_text(prop, "Cloth Collision Settings", "");
2617 prop = RNA_def_property(srna, "solver_result", PROP_POINTER, PROP_NONE);
2618 RNA_def_property_struct_type(prop, "ClothSolverResult");
2619 RNA_def_property_pointer_sdna(prop, NULL, "solver_result");
2620 RNA_def_property_ui_text(prop, "Solver Result", "");
2622 prop = RNA_def_property(srna, "hair_grid_min", PROP_FLOAT, PROP_NONE);
2623 RNA_def_property_float_sdna(prop, NULL, "hair_grid_min");
2624 RNA_def_property_clear_flag(prop, PROP_EDITABLE);
2625 RNA_def_property_ui_text(prop, "Hair Grid Minimum", "");
2627 prop = RNA_def_property(srna, "hair_grid_max", PROP_FLOAT, PROP_NONE);
2628 RNA_def_property_float_sdna(prop, NULL, "hair_grid_max");
2629 RNA_def_property_clear_flag(prop, PROP_EDITABLE);
2630 RNA_def_property_ui_text(prop, "Hair Grid Maximum", "");
2632 prop = RNA_def_property(srna, "hair_grid_resolution", PROP_INT, PROP_NONE);
2633 RNA_def_property_int_sdna(prop, NULL, "hair_grid_res");
2634 RNA_def_property_clear_flag(prop, PROP_EDITABLE);
2635 RNA_def_property_ui_text(prop, "Hair Grid Resolution", "");
2638 static void rna_def_modifier_smoke(BlenderRNA *brna)
2643 static EnumPropertyItem prop_smoke_type_items[] = {
2644 {0, "NONE", 0, "None", ""},
2645 {MOD_SMOKE_TYPE_DOMAIN, "DOMAIN", 0, "Domain", ""},
2646 {MOD_SMOKE_TYPE_FLOW, "FLOW", 0, "Flow", "Inflow/Outflow"},
2647 {MOD_SMOKE_TYPE_COLL, "COLLISION", 0, "Collision", ""},
2648 {0, NULL, 0, NULL, NULL}
2651 srna = RNA_def_struct(brna, "SmokeModifier", "Modifier");
2652 RNA_def_struct_ui_text(srna, "Smoke Modifier", "Smoke simulation modifier");
2653 RNA_def_struct_sdna(srna, "SmokeModifierData");
2654 RNA_def_struct_ui_icon(srna, ICON_MOD_SMOKE);
2656 prop = RNA_def_property(srna, "domain_settings", PROP_POINTER, PROP_NONE);
2657 RNA_def_property_pointer_sdna(prop, NULL, "domain");
2658 RNA_def_property_ui_text(prop, "Domain Settings", "");
2660 prop = RNA_def_property(srna, "flow_settings", PROP_POINTER, PROP_NONE);
2661 RNA_def_property_pointer_sdna(prop, NULL, "flow");
2662 RNA_def_property_ui_text(prop, "Flow Settings", "");
2664 prop = RNA_def_property(srna, "coll_settings", PROP_POINTER, PROP_NONE);
2665 RNA_def_property_pointer_sdna(prop, NULL, "coll");
2666 RNA_def_property_ui_text(prop, "Collision Settings", "");
2668 prop = RNA_def_property(srna, "smoke_type", PROP_ENUM, PROP_NONE);
2669 RNA_def_property_enum_sdna(prop, NULL, "type");
2670 RNA_def_property_enum_items(prop, prop_smoke_type_items);
2671 RNA_def_property_ui_text(prop, "Type", "");
2672 RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
2673 RNA_def_property_update(prop, 0, "rna_Smoke_set_type");
2676 static void rna_def_modifier_dynamic_paint(BlenderRNA *brna)
2681 srna = RNA_def_struct(brna, "DynamicPaintModifier", "Modifier");
2682 RNA_def_struct_ui_text(srna, "Dynamic Paint Modifier", "Dynamic Paint modifier");
2683 RNA_def_struct_sdna(srna, "DynamicPaintModifierData");
2684 RNA_def_struct_ui_icon(srna, ICON_MOD_DYNAMICPAINT);
2686 prop = RNA_def_property(srna, "canvas_settings", PROP_POINTER, PROP_NONE);
2687 RNA_def_property_pointer_sdna(prop, NULL, "canvas");
2688 RNA_def_property_ui_text(prop, "Canvas Settings", "");
2690 prop = RNA_def_property(srna, "brush_settings", PROP_POINTER, PROP_NONE);
2691 RNA_def_property_pointer_sdna(prop, NULL, "brush");
2692 RNA_def_property_ui_text(prop, "Brush Settings", "");
2694 prop = RNA_def_property(srna, "ui_type", PROP_ENUM, PROP_NONE);
2695 RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
2696 RNA_def_property_enum_sdna(prop, NULL, "type");
2697 RNA_def_property_enum_items(prop, rna_enum_prop_dynamicpaint_type_items);
2698 RNA_def_property_ui_text(prop, "Type", "");
2701 static void rna_def_modifier_collision(BlenderRNA *brna)
2706 srna = RNA_def_struct(brna, "CollisionModifier", "Modifier");
2707 RNA_def_struct_ui_text(srna, "Collision Modifier",
2708 "Collision modifier defining modifier stack position used for collision");
2709 RNA_def_struct_sdna(srna, "CollisionModifierData");
2710 RNA_def_struct_ui_icon(srna, ICON_MOD_PHYSICS);
2712 prop = RNA_def_property(srna, "settings", PROP_POINTER, PROP_NONE);
2713 RNA_def_property_flag(prop, PROP_NEVER_NULL);
2714 RNA_def_property_struct_type(prop, "CollisionSettings");
2715 RNA_def_property_pointer_funcs(prop, "rna_CollisionModifier_settings_get", NULL, NULL, NULL);
2716 RNA_def_property_ui_text(prop, "Settings", "");
2719 static void rna_def_modifier_bevel(BlenderRNA *brna)
2724 static EnumPropertyItem prop_limit_method_items[] = {
2725 {0, "NONE", 0, "None", "Bevel the entire mesh by a constant amount"},
2726 {MOD_BEVEL_ANGLE, "ANGLE", 0, "Angle", "Only bevel edges with sharp enough angles between faces"},
2727 {MOD_BEVEL_WEIGHT, "WEIGHT", 0, "Weight",
2728 "Use bevel weights to determine how much bevel is applied in edge mode"},
2729 {MOD_BEVEL_VGROUP, "VGROUP", 0, "Vertex Group",
2730 "Use vertex group weights to select whether vertex or edge is beveled"},
2731 {0, NULL, 0, NULL, NULL}
2734 static EnumPropertyItem prop_val_type_items[] = {
2735 {MOD_BEVEL_AMT_OFFSET, "OFFSET", 0, "Offset", "Amount is offset of new edges from original"},
2736 {MOD_BEVEL_AMT_WIDTH, "WIDTH", 0, "Width", "Amount is width of new face"},
2737 {MOD_BEVEL_AMT_DEPTH, "DEPTH", 0, "Depth", "Amount is perpendicular distance from original edge to bevel face"},
2738 {MOD_BEVEL_AMT_PERCENT, "PERCENT", 0, "Percent", "Amount is percent of adjacent edge length"},
2739 {0, NULL, 0, NULL, NULL}
2742 /* TO BE DEPRECATED */
2743 static EnumPropertyItem prop_edge_weight_method_items[] = {
2744 {0, "AVERAGE", 0, "Average", ""},
2745 {MOD_BEVEL_EMIN, "SHARPEST", 0, "Sharpest", ""},
2746 {MOD_BEVEL_EMAX, "LARGEST", 0, "Largest", ""},
2747 {0, NULL, 0, NULL, NULL}
2750 srna = RNA_def_struct(brna, "BevelModifier", "Modifier");
2751 RNA_def_struct_ui_text(srna, "Bevel Modifier", "Bevel modifier to make edges and vertices more rounded");
2752 RNA_def_struct_sdna(srna, "BevelModifierData");
2753 RNA_def_struct_ui_icon(srna, ICON_MOD_BEVEL);
2755 prop = RNA_def_property(srna, "width", PROP_FLOAT, PROP_DISTANCE);
2756 RNA_def_property_float_sdna(prop, NULL, "value");
2757 RNA_def_property_range(prop, 0, FLT_MAX);
2758 RNA_def_property_ui_range(prop, 0.0f, 100.0f, 0.1, 4);
2759 RNA_def_property_ui_text(prop, "Width", "Bevel value/amount");
2760 RNA_def_property_update(prop, 0, "rna_Modifier_update");
2762 prop = RNA_def_property(srna, "segments", PROP_INT, PROP_NONE);
2763 RNA_def_property_int_sdna(prop, NULL, "res");
2764 RNA_def_property_range(prop, 1, 100);
2765 RNA_def_property_ui_text(prop, "Segments", "Number of segments for round edges/verts");
2766 RNA_def_property_update(prop, 0, "rna_Modifier_update");
2768 prop = RNA_def_property(srna, "use_only_vertices", PROP_BOOLEAN, PROP_NONE);
2769 RNA_def_property_boolean_sdna(prop, NULL, "flags", MOD_BEVEL_VERT);
2770 RNA_def_property_ui_text(prop, "Only Vertices", "Bevel verts/corners, not edges");
2771 RNA_def_property_update(prop, 0, "rna_Modifier_update");
2773 prop = RNA_def_property(srna, "limit_method", PROP_ENUM, PROP_NONE);
2774 RNA_def_property_enum_sdna(prop, NULL, "lim_flags");
2775 RNA_def_property_enum_items(prop, prop_limit_method_items);
2776 RNA_def_property_ui_text(prop, "Limit Method", "");
2777 RNA_def_property_update(prop, 0, "rna_Modifier_update");
2779 /* TO BE DEPRECATED */
2780 prop = RNA_def_property(srna, "edge_weight_method", PROP_ENUM, PROP_NONE);
2781 RNA_def_property_enum_sdna(prop, NULL, "e_flags");
2782 RNA_def_property_enum_items(prop, prop_edge_weight_method_items);
2783 RNA_def_property_ui_text(prop, "Edge Weight Method", "What edge weight to use for weighting a vertex");
2784 RNA_def_property_update(prop, 0, "rna_Modifier_update");
2786 prop = RNA_def_property(srna, "angle_limit", PROP_FLOAT, PROP_ANGLE);
2787 RNA_def_property_float_sdna(prop, NULL, "bevel_angle");
2788 RNA_def_property_range(prop, 0.0f, DEG2RADF(180.0f));
2789 RNA_def_property_ui_range(prop, 0.0f, DEG2RADF(180.0f), 10, 2);
2790 RNA_def_property_ui_text(prop, "Angle", "Angle above which to bevel edges");
2791 RNA_def_property_update(prop, 0, "rna_Modifier_update");
2793 prop = RNA_def_property(srna, "vertex_group", PROP_STRING, PROP_NONE);
2794 RNA_def_property_string_sdna(prop, NULL, "defgrp_name");
2795 RNA_def_property_ui_text(prop, "Vertex Group", "Vertex group name");
2796 RNA_def_property_string_funcs(prop, NULL, NULL, "rna_BevelModifier_defgrp_name_set");
2797 RNA_def_property_update(prop, 0, "rna_Modifier_update");
2799 prop = RNA_def_property(srna, "use_clamp_overlap", PROP_BOOLEAN, PROP_NONE);
2800 RNA_def_property_boolean_negative_sdna(prop, NULL, "flags", MOD_BEVEL_OVERLAP_OK);
2801 RNA_def_property_ui_text(prop, "Clamp Overlap", "Clamp the width to avoid overlap");
2802 RNA_def_property_update(prop, 0, "rna_Modifier_update");
2804 prop = RNA_def_property(srna, "offset_type", PROP_ENUM, PROP_NONE);
2805 RNA_def_property_enum_sdna(prop, NULL, "val_flags");
2806 RNA_def_property_enum_items(prop, prop_val_type_items);
2807 RNA_def_property_ui_text(prop, "Amount Type", "What distance Width measures");
2808 RNA_def_property_update(prop, 0, "rna_Modifier_update");
2810 prop = RNA_def_property(srna, "profile", PROP_FLOAT, PROP_FACTOR);
2811 RNA_def_property_range(prop, 0.0f, 1.0f);
2812 RNA_def_property_ui_range(prop, 0.15f, 1.0f, 0.05, 2);
2813 RNA_def_property_ui_text(prop, "Profile", "The profile shape (0.5 = round)");
2814 RNA_def_property_update(prop, 0, "rna_Modifier_update");
2816 prop = RNA_def_property(srna, "material", PROP_INT, PROP_NONE);
2817 RNA_def_property_int_sdna(prop, NULL, "mat");
2818 RNA_def_property_range(prop, -1, SHRT_MAX);
2819 RNA_def_property_ui_text(prop, "Material", "Material index of generated faces, -1 for automatic");
2820 RNA_def_property_update(prop, 0, "rna_Modifier_update");
2822 prop = RNA_def_property(srna, "loop_slide", PROP_BOOLEAN, PROP_NONE);
2823 RNA_def_property_boolean_negative_sdna(prop, NULL, "flags", MOD_BEVEL_EVEN_WIDTHS);
2824 RNA_def_property_ui_text(prop, "Loop Slide", "Prefer sliding along edges to having even widths");
2825 RNA_def_property_update(prop, 0, "rna_Modifier_update");
2828 static void rna_def_modifier_shrinkwrap(BlenderRNA *brna)
2833 static EnumPropertyItem shrink_type_items[] = {
2834 {MOD_SHRINKWRAP_NEAREST_SURFACE, "NEAREST_SURFACEPOINT", 0, "Nearest Surface Point",
2835 "Shrink the mesh to the nearest target surface"},
2836 {MOD_SHRINKWRAP_PROJECT, "PROJECT", 0, "Project",
2837 "Shrink the mesh to the nearest target surface along a given axis"},
2838 {MOD_SHRINKWRAP_NEAREST_VERTEX, "NEAREST_VERTEX", 0, "Nearest Vertex",
2839 "Shrink the mesh to the nearest target vertex"},
2840 {0, NULL, 0, NULL, NULL}
2843 static EnumPropertyItem shrink_face_cull_items[] = {
2844 {0, "OFF", 0, "Off", "No culling"},
2845 {MOD_SHRINKWRAP_CULL_TARGET_FRONTFACE, "FRONT", 0, "Front", "No projection when in front of the face"},
2846 {MOD_SHRINKWRAP_CULL_TARGET_BACKFACE, "BACK", 0, "Back", "No projection when behind the face"},
2847 {0, NULL, 0, NULL, NULL}
2850 srna = RNA_def_struct(brna, "ShrinkwrapModifier", "Modifier");
2851 RNA_def_struct_ui_text(srna, "Shrinkwrap Modifier",
2852 "Shrink wrapping modifier to shrink wrap and object to a target");
2853 RNA_def_struct_sdna(srna, "ShrinkwrapModifierData");
2854 RNA_def_struct_ui_icon(srna, ICON_MOD_SHRINKWRAP);
2856 prop = RNA_def_property(srna, "wrap_method", PROP_ENUM, PROP_NONE);
2857 RNA_def_property_enum_sdna(prop, NULL, "shrinkType");
2858 RNA_def_property_enum_items(prop, shrink_type_items);
2859 RNA_def_property_ui_text(prop, "Mode", "");
2860 RNA_def_property_update(prop, 0, "rna_Modifier_update");
2862 prop = RNA_def_property(srna, "cull_face", PROP_ENUM, PROP_NONE);
2863 RNA_def_property_enum_sdna(prop, NULL, "shrinkOpts");
2864 RNA_def_property_enum_items(prop, shrink_face_cull_items);
2865 RNA_def_property_enum_funcs(prop, "rna_ShrinkwrapModifier_face_cull_get",
2866 "rna_ShrinkwrapModifier_face_cull_set", NULL);
2867 RNA_def_property_ui_text(prop, "Face Cull",
2868 "Stop vertices from projecting to a face on the target when facing towards/away");
2869 RNA_def_property_update(prop, 0, "rna_Modifier_update");
2871 prop = RNA_def_property(srna, "target", PROP_POINTER, PROP_NONE);
2872 RNA_def_property_ui_text(prop, "Target", "Mesh target to shrink to");
2873 RNA_def_property_pointer_funcs(prop, NULL, "rna_ShrinkwrapModifier_target_set", NULL, "rna_Mesh_object_poll");
2874 RNA_def_property_flag(prop, PROP_EDITABLE | PROP_ID_SELF_CHECK);
2875 RNA_def_property_update(prop, 0, "rna_Modifier_dependency_update");
2877 prop = RNA_def_property(srna, "auxiliary_target", PROP_POINTER, PROP_NONE);
2878 RNA_def_property_pointer_sdna(prop, NULL, "auxTarget");
2879 RNA_def_property_ui_text(prop, "Auxiliary Target", "Additional mesh target to shrink to");
2880 RNA_def_property_pointer_funcs(prop, NULL, "rna_ShrinkwrapModifier_auxTarget_set", NULL, "rna_Mesh_object_poll");
2881 RNA_def_property_flag(prop, PROP_EDITABLE | PROP_ID_SELF_CHECK);
2882 RNA_def_property_update(prop, 0, "rna_Modifier_dependency_update");
2884 prop = RNA_def_property(srna, "vertex_group", PROP_STRING, PROP_NONE);
2885 RNA_def_property_string_sdna(prop, NULL, "vgroup_name");
2886 RNA_def_property_ui_text(prop, "Vertex Group", "Vertex group name");
2887 RNA_def_property_string_funcs(prop, NULL, NULL, "rna_ShrinkwrapModifier_vgroup_name_set");
2888 RNA_def_property_update(prop, 0, "rna_Modifier_update");
2890 prop = RNA_def_property(srna, "offset", PROP_FLOAT, PROP_NONE);
2891 RNA_def_property_float_sdna(prop, NULL, "keepDist");
2892 RNA_def_property_range(prop, -FLT_MAX, FLT_MAX);
2893 RNA_def_property_ui_range(prop, -100, 100, 1, 2);
2894 RNA_def_property_ui_text(prop, "Offset", "Distance to keep from the target");
2895 RNA_def_property_update(prop, 0, "rna_Modifier_update");
2897 prop = RNA_def_property(srna, "project_limit", PROP_FLOAT, PROP_NONE);
2898 RNA_def_property_float_sdna(prop, NULL, "projLimit");
2899 RNA_def_property_range(prop, 0.0, FLT_MAX);
2900 RNA_def_property_ui_range(prop, 0, 100, 1, 2);
2901 RNA_def_property_ui_text(prop, "Project Limit", "Limit the distance used for projection (zero disables)");
2902 RNA_def_property_update(prop, 0, "rna_Modifier_update");
2904 prop = RNA_def_property(srna, "use_project_x", PROP_BOOLEAN, PROP_NONE);
2905 RNA_def_property_boolean_sdna(prop, NULL, "projAxis", MOD_SHRINKWRAP_PROJECT_OVER_X_AXIS);
2906 RNA_def_property_ui_text(prop, "X", "");
2907 RNA_def_property_update(prop, 0, "rna_Modifier_update");
2909 prop = RNA_def_property(srna, "use_project_y", PROP_BOOLEAN, PROP_NONE);
2910 RNA_def_property_boolean_sdna(prop, NULL, "projAxis", MOD_SHRINKWRAP_PROJECT_OVER_Y_AXIS);
2911 RNA_def_property_ui_text(prop, "Y", "");
2912 RNA_def_property_update(prop, 0, "rna_Modifier_update");
2914 prop = RNA_def_property(srna, "use_project_z", PROP_BOOLEAN, PROP_NONE);
2915 RNA_def_property_boolean_sdna(prop, NULL, "projAxis", MOD_SHRINKWRAP_PROJECT_OVER_Z_AXIS);
2916 RNA_def_property_ui_text(prop, "Z", "");
2917 RNA_def_property_update(prop, 0, "rna_Modifier_update");
2919 prop = RNA_def_property(srna, "subsurf_levels", PROP_INT, PROP_NONE);
2920 RNA_def_property_int_sdna(prop, NULL, "subsurfLevels");
2921 RNA_def_property_range(prop, 0, 6);
2922 RNA_def_property_ui_range(prop, 0, 6, 1, -1);
2923 RNA_def_property_ui_text(prop, "Subsurf Levels",
2924 "Number of subdivisions that must be performed before extracting vertices' "
2925 "positions and normals");
2926 RNA_def_property_update(prop, 0, "rna_Modifier_update");
2928 prop = RNA_def_property(srna, "use_negative_direction", PROP_BOOLEAN, PROP_NONE);
2929 RNA_def_property_boolean_sdna(prop, NULL, "shrinkOpts", MOD_SHRINKWRAP_PROJECT_ALLOW_NEG_DIR);
2930 RNA_def_property_ui_text(prop, "Negative", "Allow vertices to move in the negative direction of axis");
2931 RNA_def_property_update(prop, 0, "rna_Modifier_update");
2933 prop = RNA_def_property(srna, "use_positive_direction", PROP_BOOLEAN, PROP_NONE);
2934 RNA_def_property_boolean_sdna(prop, NULL, "shrinkOpts", MOD_SHRINKWRAP_PROJECT_ALLOW_POS_DIR);
2935 RNA_def_property_ui_text(prop, "Positive", "Allow vertices to move in the positive direction of axis");
2936 RNA_def_property_update(prop, 0, "rna_Modifier_update");
2938 prop = RNA_def_property(srna, "use_keep_above_surface", PROP_BOOLEAN, PROP_NONE);
2939 RNA_def_property_boolean_sdna(prop, NULL, "shrinkOpts", MOD_SHRINKWRAP_KEEP_ABOVE_SURFACE);
2940 RNA_def_property_ui_text(prop, "Keep Above Surface", "");
2941 RNA_def_property_update(prop, 0, "rna_Modifier_update");
2943 prop = RNA_def_property(srna, "invert_vertex_group", PROP_BOOLEAN, PROP_NONE);
2944 RNA_def_property_boolean_sdna(prop, NULL, "shrinkOpts", MOD_SHRINKWRAP_INVERT_VGROUP);
2945 RNA_def_property_ui_text(prop, "Invert", "Invert vertex group influence");
2946 RNA_def_property_update(prop, 0, "rna_Modifier_update");
2949 static void rna_def_modifier_fluidsim(BlenderRNA *brna)
2954 srna = RNA_def_struct(brna, "FluidSimulationModifier", "Modifier");
2955 RNA_def_struct_ui_text(srna, "Fluid Simulation Modifier", "Fluid simulation modifier");
2956 RNA_def_struct_sdna(srna, "FluidsimModifierData");
2957 RNA_def_struct_ui_icon(srna, ICON_MOD_FLUIDSIM);
2959 prop = RNA_def_property(srna, "settings", PROP_POINTER, PROP_NONE);
2960 RNA_def_property_flag(prop, PROP_NEVER_NULL);
2961 RNA_def_property_pointer_sdna(prop, NULL, "fss");
2962 RNA_def_property_ui_text(prop, "Settings", "Settings for how this object is used in the fluid simulation");
2965 static void rna_def_modifier_mask(BlenderRNA *brna)
2970 static EnumPropertyItem modifier_mask_mode_items[] = {
2971 {MOD_MASK_MODE_VGROUP, "VERTEX_GROUP", 0, "Vertex Group", ""},
2972 {MOD_MASK_MODE_ARM, "ARMATURE", 0, "Armature", ""},
2973 {0, NULL, 0, NULL, NULL}
2976 srna = RNA_def_struct(brna, "MaskModifier", "Modifier");
2977 RNA_def_struct_ui_text(srna, "Mask Modifier", "Mask modifier to hide parts of the mesh");
2978 RNA_def_struct_sdna(srna, "MaskModifierData");
2979 RNA_def_struct_ui_icon(srna, ICON_MOD_MASK);
2981 prop = RNA_def_property(srna, "mode", PROP_ENUM, PROP_NONE);
2982 RNA_def_property_enum_items(prop, modifier_mask_mode_items);
2983 RNA_def_property_ui_text(prop, "Mode", "");
2984 RNA_def_property_update(prop, 0, "rna_Modifier_update");
2986 prop = RNA_def_property(srna, "armature", PROP_POINTER, PROP_NONE);
2987 RNA_def_property_pointer_sdna(prop, NULL, "ob_arm");
2988 RNA_def_property_ui_text(prop, "Armature", "Armature to use as source of bones to mask");
2989 RNA_def_property_pointer_funcs(prop, NULL, "rna_MaskModifier_ob_arm_set", NULL, "rna_Armature_object_poll");
2990 RNA_def_property_flag(prop, PROP_EDITABLE | PROP_ID_SELF_CHECK);
2991 RNA_def_property_update(prop, 0, "rna_Modifier_dependency_update");
2993 prop = RNA_def_property(srna, "vertex_group", PROP_STRING, PROP_NONE);
2994 RNA_def_property_string_sdna(prop, NULL, "vgroup");
2995 RNA_def_property_ui_text(prop, "Vertex Group", "Vertex group name");
2996 RNA_def_property_string_funcs(prop, NULL, NULL, "rna_MaskModifier_vgroup_set");
2997 RNA_def_property_update(prop, 0, "rna_Modifier_update");
2999 prop = RNA_def_property(srna, "invert_vertex_group", PROP_BOOLEAN, PROP_NONE);
3000 RNA_def_property_boolean_sdna(prop, NULL, "flag", MOD_MASK_INV);
3001 RNA_def_property_ui_text(prop, "Invert", "Use vertices that are not part of region defined");
3002 RNA_def_property_update(prop, 0, "rna_Modifier_update");
3005 static void rna_def_modifier_simpledeform(BlenderRNA *brna)
3010 static EnumPropertyItem simple_deform_mode_items[] = {
3011 {MOD_SIMPLEDEFORM_MODE_TWIST, "TWIST", 0, "Twist", "Rotate around the Z axis of the modifier space"},
3012 {MOD_SIMPLEDEFORM_MODE_BEND, "BEND", 0, "Bend", "Bend the mesh over the Z axis of the modifier space"},
3013 {MOD_SIMPLEDEFORM_MODE_TAPER, "TAPER", 0, "Taper", "Linearly scale along Z axis of the modifier space"},
3014 {MOD_SIMPLEDEFORM_MODE_STRETCH, "STRETCH", 0, "Stretch",
3015 "Stretch the object along the Z axis of the modifier space"},
3016 {0, NULL, 0, NULL, NULL}
3019 srna = RNA_def_struct(brna, "SimpleDeformModifier", "Modifier");
3020 RNA_def_struct_ui_text(srna, "SimpleDeform Modifier",
3021 "Simple deformation modifier to apply effects such as twisting and bending");
3022 RNA_def_struct_sdna(srna, "SimpleDeformModifierData");
3023 RNA_def_struct_ui_icon(srna, ICON_MOD_SIMPLEDEFORM);
3025 prop = RNA_def_property(srna, "deform_method", PROP_ENUM, PROP_NONE);
3026 RNA_def_property_enum_sdna(prop, NULL, "mode");
3027 RNA_def_property_enum_items(prop, simple_deform_mode_items);
3028 RNA_def_property_ui_text(prop, "Mode", "");
3029 RNA_def_property_update(prop, 0, "rna_Modifier_update");
3031 prop = RNA_def_property(srna, "vertex_group", PROP_STRING, PROP_NONE);
3032 RNA_def_property_string_sdna(prop, NULL, "vgroup_name");
3033 RNA_def_property_ui_text(prop, "Vertex Group", "Vertex group name");
3034 RNA_def_property_string_funcs(prop, NULL, NULL, "rna_SimpleDeformModifier_vgroup_name_set");
3035 RNA_def_property_update(prop, 0, "rna_Modifier_update");
3037 prop = RNA_def_property(srna, "origin", PROP_POINTER, PROP_NONE);
3038 RNA_def_property_ui_text(prop, "Origin", "Offset the origin and orientation of the deformation");
3039 RNA_def_property_flag(prop, PROP_EDITABLE | PROP_ID_SELF_CHECK);
3040 RNA_def_property_update(prop, 0, "rna_Modifier_dependency_update");
3042 prop = RNA_def_property(srna, "factor", PROP_FLOAT, PROP_NONE);
3043 RNA_def_property_range(prop, -FLT_MAX, FLT_MAX);
3044 RNA_def_property_ui_range(prop, -10.0, 10.0, 1.0, 3);
3045 RNA_def_property_ui_text(prop, "Factor", "Amount to deform object");
3046 RNA_def_property_update(prop, 0, "rna_Modifier_update");
3048 prop = RNA_def_property(srna, "angle", PROP_FLOAT, PROP_ANGLE);
3049 RNA_def_property_float_sdna(prop, NULL, "factor");
3050 RNA_def_property_range(prop, -FLT_MAX, FLT_MAX);
3051 RNA_def_property_float_default(prop, DEG2RADF(45.0f));
3052 RNA_def_property_ui_range(prop, DEG2RAD(-360.0), DEG2RAD(360.0), 10.0, 3);
3053 RNA_def_property_ui_text(prop, "Angle", "Angle of deformation");
3054 RNA_def_property_update(prop, 0, "rna_Modifier_update");
3056 prop = RNA_def_property(srna, "limits", PROP_FLOAT, PROP_NONE);
3057 RNA_def_property_float_sdna(prop, NULL, "limit");
3058 RNA_def_property_array(prop, 2);
3059 RNA_def_property_range(prop, 0, 1);
3060 RNA_def_property_ui_range(prop, 0, 1, 5, 2);
3061 RNA_def_property_ui_text(prop, "Limits", "Lower/Upper limits for deform");
3062 RNA_def_property_update(prop, 0, "rna_Modifier_update");
3064 prop = RNA_def_property(srna, "lock_x", PROP_BOOLEAN, PROP_NONE);
3065 RNA_def_property_boolean_sdna(prop, NULL, "axis", MOD_SIMPLEDEFORM_LOCK_AXIS_X);
3066 RNA_def_property_ui_text(prop, "Lock X Axis", "Do not allow deformation along the X axis");
3067 RNA_def_property_update(prop, 0, "rna_Modifier_update");
3069 prop = RNA_def_property(srna, "lock_y", PROP_BOOLEAN, PROP_NONE);
3070 RNA_def_property_boolean_sdna(prop, NULL, "axis", MOD_SIMPLEDEFORM_LOCK_AXIS_Y);
3071 RNA_def_property_ui_text(prop, "Lock Y Axis", "Do not allow deformation along the Y axis");
3072 RNA_def_property_update(prop, 0, "rna_Modifier_update");
3074 prop = RNA_def_property(srna, "invert_vertex_group", PROP_BOOLEAN, PROP_NONE);
3075 RNA_def_property_boolean_sdna(prop, NULL, "flag", MOD_SIMPLEDEFORM_FLAG_INVERT_VGROUP);
3076 RNA_def_property_ui_text(prop, "Invert", "Invert vertex group influence");
3077 RNA_def_property_update(prop, 0, "rna_Modifier_update");
3080 static void rna_def_modifier_surface(BlenderRNA *brna)
3084 srna = RNA_def_struct(brna, "SurfaceModifier", "Modifier");
3085 RNA_def_struct_ui_text(srna, "Surface Modifier",
3086 "Surface modifier defining modifier stack position used for surface fields");
3087 RNA_def_struct_sdna(srna, "SurfaceModifierData");
3088 RNA_def_struct_ui_icon(srna, ICON_MOD_PHYSICS);
3091 static void rna_def_modifier_solidify(BlenderRNA *brna)
3096 srna = RNA_def_struct(brna, "SolidifyModifier", "Modifier");
3097 RNA_def_struct_ui_text(srna, "Solidify Modifier",
3098 "Create a solid skin by extruding, compensating for sharp angles");
3099 RNA_def_struct_sdna(srna, "SolidifyModifierData");
3100 RNA_def_struct_ui_icon(srna, ICON_MOD_SOLIDIFY);
3102 prop = RNA_def_property(srna, "thickness", PROP_FLOAT, PROP_DISTANCE);
3103 RNA_def_property_float_sdna(prop, NULL, "offset");
3104 RNA_def_property_range(prop, -FLT_MAX, FLT_MAX);
3105 RNA_def_property_ui_range(prop, -10, 10, 0.1, 4);
3106 RNA_def_property_ui_text(prop, "Thickness", "Thickness of the shell");
3107 RNA_def_property_update(prop, 0, "rna_Modifier_update");
3109 prop = RNA_def_property(srna, "thickness_clamp", PROP_FLOAT, PROP_FACTOR);
3110 RNA_def_property_float_sdna(prop, NULL, "offset_clamp");
3111 RNA_def_property_range(prop, 0, 100.0);
3112 RNA_def_property_ui_range(prop, 0, 2.0, 0.1, 4);
3113 RNA_def_property_ui_text(prop, "Clamp", "Offset clamp based on geometry scale");
3114 RNA_def_property_update(prop, 0, "rna_Modifier_update");
3116 prop = RNA_def_property(srna, "thickness_vertex_group", PROP_FLOAT, PROP_FACTOR);
3117 RNA_def_property_float_sdna(prop, NULL, "offset_fac_vg");
3118 RNA_def_property_range(prop, 0.0, 1.0);
3119 RNA_def_property_ui_range(prop, 0, 1, 0.1, 3);
3120 RNA_def_property_ui_text(prop, "Vertex Group Factor",
3121 "Thickness factor to use for zero vertex group influence");
3122 RNA_def_property_update(prop, 0, "rna_Modifier_update");
3124 prop = RNA_def_property(srna, "offset", PROP_FLOAT, PROP_FACTOR);
3125 RNA_def_property_float_sdna(prop, NULL, "offset_fac");
3126 RNA_def_property_range(prop, -FLT_MAX, FLT_MAX);
3127 RNA_def_property_ui_range(prop, -1, 1, 0.1, 4);
3128 RNA_def_property_ui_text(prop, "Offset", "Offset the thickness from the center");
3129 RNA_def_property_update(prop, 0, "rna_Modifier_update");
3131 prop = RNA_def_property(srna, "edge_crease_inner", PROP_FLOAT, PROP_FACTOR);
3132 RNA_def_property_float_sdna(prop, NULL, "crease_inner");
3133 RNA_def_property_range(prop, 0, 1);
3134 RNA_def_property_ui_range(prop, 0, 1, 0.1, 3);
3135 RNA_def_property_ui_text(prop, "Inner Crease", "Assign a crease to inner edges");
3136 RNA_def_property_update(prop, 0, "rna_Modifier_update");
3138 prop = RNA_def_property(srna, "edge_crease_outer", PROP_FLOAT, PROP_FACTOR);
3139 RNA_def_property_float_sdna(prop, NULL, "crease_outer");
3140 RNA_def_property_range(prop, 0, 1);
3141 RNA_def_property_ui_range(prop, 0, 1, 0.1, 3);
3142 RNA_def_property_ui_text(prop, "Outer Crease", "Assign a crease to outer edges");
3143 RNA_def_property_update(prop, 0, "rna_Modifier_update");
3145 prop = RNA_def_property(srna, "edge_crease_rim", PROP_FLOAT, PROP_FACTOR);
3146 RNA_def_property_float_sdna(prop, NULL, "crease_rim");
3147 RNA_def_property_range(prop, 0, 1);
3148 RNA_def_property_ui_range(prop, 0, 1, 0.1, 3);
3149 RNA_def_property_ui_text(prop, "Rim Crease", "Assign a crease to the edges making up the rim");
3150 RNA_def_property_update(prop, 0, "rna_Modifier_update");
3152 prop = RNA_def_property(srna, "material_offset", PROP_INT, PROP_NONE);
3153 RNA_def_property_int_sdna(prop, NULL, "mat_ofs");