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_mesh_types.h"
34 #include "DNA_modifier_types.h"
35 #include "DNA_object_types.h"
36 #include "DNA_object_force.h"
37 #include "DNA_scene_types.h"
39 #include "MEM_guardedalloc.h"
43 #include "BLT_translation.h"
45 #include "BKE_animsys.h"
46 #include "BKE_data_transfer.h"
47 #include "BKE_DerivedMesh.h"
48 #include "BKE_dynamicpaint.h"
49 #include "BKE_effect.h"
50 #include "BKE_mesh_mapping.h"
51 #include "BKE_mesh_remap.h"
52 #include "BKE_multires.h"
53 #include "BKE_smoke.h" /* For smokeModifier_free & smokeModifier_createType */
55 #include "RNA_access.h"
56 #include "RNA_define.h"
57 #include "RNA_enum_types.h"
59 #include "rna_internal.h"
64 EnumPropertyItem rna_enum_object_modifier_type_items[] = {
65 {0, "", 0, N_("Modify"), ""},
66 {eModifierType_DataTransfer, "DATA_TRANSFER", ICON_MOD_DATA_TRANSFER, "Data Transfer", ""},
67 {eModifierType_MeshCache, "MESH_CACHE", ICON_MOD_MESHDEFORM, "Mesh Cache", ""},
68 {eModifierType_NormalEdit, "NORMAL_EDIT", ICON_MOD_NORMALEDIT, "Normal Edit", ""},
69 {eModifierType_UVProject, "UV_PROJECT", ICON_MOD_UVPROJECT, "UV Project", ""},
70 {eModifierType_UVWarp, "UV_WARP", ICON_MOD_UVPROJECT, "UV Warp", ""},
71 {eModifierType_WeightVGEdit, "VERTEX_WEIGHT_EDIT", ICON_MOD_VERTEX_WEIGHT, "Vertex Weight Edit", ""},
72 {eModifierType_WeightVGMix, "VERTEX_WEIGHT_MIX", ICON_MOD_VERTEX_WEIGHT, "Vertex Weight Mix", ""},
73 {eModifierType_WeightVGProximity, "VERTEX_WEIGHT_PROXIMITY", ICON_MOD_VERTEX_WEIGHT,
74 "Vertex Weight Proximity", ""},
75 {0, "", 0, N_("Generate"), ""},
76 {eModifierType_Array, "ARRAY", ICON_MOD_ARRAY, "Array", ""},
77 {eModifierType_Bevel, "BEVEL", ICON_MOD_BEVEL, "Bevel", ""},
78 {eModifierType_Boolean, "BOOLEAN", ICON_MOD_BOOLEAN, "Boolean", ""},
79 {eModifierType_Build, "BUILD", ICON_MOD_BUILD, "Build", ""},
80 {eModifierType_Decimate, "DECIMATE", ICON_MOD_DECIM, "Decimate", ""},
81 {eModifierType_EdgeSplit, "EDGE_SPLIT", ICON_MOD_EDGESPLIT, "Edge Split", ""},
82 {eModifierType_Mask, "MASK", ICON_MOD_MASK, "Mask", ""},
83 {eModifierType_Mirror, "MIRROR", ICON_MOD_MIRROR, "Mirror", ""},
84 {eModifierType_Multires, "MULTIRES", ICON_MOD_MULTIRES, "Multiresolution", ""},
85 {eModifierType_Remesh, "REMESH", ICON_MOD_REMESH, "Remesh", ""},
86 {eModifierType_Screw, "SCREW", ICON_MOD_SCREW, "Screw", ""},
87 {eModifierType_Skin, "SKIN", ICON_MOD_SKIN, "Skin", ""},
88 {eModifierType_Solidify, "SOLIDIFY", ICON_MOD_SOLIDIFY, "Solidify", ""},
89 {eModifierType_Subsurf, "SUBSURF", ICON_MOD_SUBSURF, "Subdivision Surface", ""},
90 {eModifierType_Triangulate, "TRIANGULATE", ICON_MOD_TRIANGULATE, "Triangulate", ""},
91 {eModifierType_Wireframe, "WIREFRAME", ICON_MOD_WIREFRAME, "Wireframe", "Generate a wireframe on the edges of a mesh"},
92 {0, "", 0, N_("Deform"), ""},
93 {eModifierType_Armature, "ARMATURE", ICON_MOD_ARMATURE, "Armature", ""},
94 {eModifierType_Cast, "CAST", ICON_MOD_CAST, "Cast", ""},
95 {eModifierType_CorrectiveSmooth, "CORRECTIVE_SMOOTH", ICON_MOD_SMOOTH, "Corrective Smooth", ""},
96 {eModifierType_Curve, "CURVE", ICON_MOD_CURVE, "Curve", ""},
97 {eModifierType_Displace, "DISPLACE", ICON_MOD_DISPLACE, "Displace", ""},
98 {eModifierType_Hook, "HOOK", ICON_HOOK, "Hook", ""},
99 {eModifierType_LaplacianSmooth, "LAPLACIANSMOOTH", ICON_MOD_SMOOTH, "Laplacian Smooth", ""},
100 {eModifierType_LaplacianDeform, "LAPLACIANDEFORM", ICON_MOD_MESHDEFORM, "Laplacian Deform", ""},
101 {eModifierType_Lattice, "LATTICE", ICON_MOD_LATTICE, "Lattice", ""},
102 {eModifierType_MeshDeform, "MESH_DEFORM", ICON_MOD_MESHDEFORM, "Mesh Deform", ""},
103 {eModifierType_Shrinkwrap, "SHRINKWRAP", ICON_MOD_SHRINKWRAP, "Shrinkwrap", ""},
104 {eModifierType_SimpleDeform, "SIMPLE_DEFORM", ICON_MOD_SIMPLEDEFORM, "Simple Deform", ""},
105 {eModifierType_Smooth, "SMOOTH", ICON_MOD_SMOOTH, "Smooth", ""},
106 {eModifierType_Warp, "WARP", ICON_MOD_WARP, "Warp", ""},
107 {eModifierType_Wave, "WAVE", ICON_MOD_WAVE, "Wave", ""},
108 {0, "", 0, N_("Simulate"), ""},
109 {eModifierType_Cloth, "CLOTH", ICON_MOD_CLOTH, "Cloth", ""},
110 {eModifierType_Collision, "COLLISION", ICON_MOD_PHYSICS, "Collision", ""},
111 {eModifierType_DynamicPaint, "DYNAMIC_PAINT", ICON_MOD_DYNAMICPAINT, "Dynamic Paint", ""},
112 {eModifierType_Explode, "EXPLODE", ICON_MOD_EXPLODE, "Explode", ""},
113 {eModifierType_Fluidsim, "FLUID_SIMULATION", ICON_MOD_FLUIDSIM, "Fluid Simulation", ""},
114 {eModifierType_Ocean, "OCEAN", ICON_MOD_OCEAN, "Ocean", ""},
115 {eModifierType_Smoke, "SMOKE", ICON_MOD_SMOKE, "Smoke", ""},
116 {eModifierType_Softbody, "SOFT_BODY", ICON_MOD_SOFT, "Soft Body", ""},
117 {eModifierType_Surface, "SURFACE", ICON_MOD_PHYSICS, "Surface", ""},
118 {0, NULL, 0, NULL, NULL}
121 EnumPropertyItem rna_enum_modifier_triangulate_quad_method_items[] = {
122 {MOD_TRIANGULATE_QUAD_BEAUTY, "BEAUTY", 0, "Beauty ", "Split the quads in nice triangles, slower method"},
123 {MOD_TRIANGULATE_QUAD_FIXED, "FIXED", 0, "Fixed", "Split the quads on the first and third vertices"},
124 {MOD_TRIANGULATE_QUAD_ALTERNATE, "FIXED_ALTERNATE", 0, "Fixed Alternate",
125 "Split the quads on the 2nd and 4th vertices"},
126 {MOD_TRIANGULATE_QUAD_SHORTEDGE, "SHORTEST_DIAGONAL", 0, "Shortest Diagonal",
127 "Split the quads based on the distance between the vertices"},
128 {0, NULL, 0, NULL, NULL}
131 EnumPropertyItem rna_enum_modifier_triangulate_ngon_method_items[] = {
132 {MOD_TRIANGULATE_NGON_BEAUTY, "BEAUTY", 0, "Beauty", "Arrange the new triangles evenly (slow)"},
133 {MOD_TRIANGULATE_NGON_EARCLIP, "CLIP", 0, "Clip", "Split the polygons with an ear clipping algorithm"},
134 {0, NULL, 0, NULL, NULL}
138 /* use eWarp_Falloff_*** & eHook_Falloff_***, they're in sync */
139 static EnumPropertyItem modifier_warp_falloff_items[] = {
140 {eWarp_Falloff_None, "NONE", 0, "No Falloff", ""},
141 {eWarp_Falloff_Curve, "CURVE", 0, "Curve", ""},
142 {eWarp_Falloff_Smooth, "SMOOTH", ICON_SMOOTHCURVE, "Smooth", ""},
143 {eWarp_Falloff_Sphere, "SPHERE", ICON_SPHERECURVE, "Sphere", ""},
144 {eWarp_Falloff_Root, "ROOT", ICON_ROOTCURVE, "Root", ""},
145 {eWarp_Falloff_InvSquare, "INVERSE_SQUARE", ICON_ROOTCURVE, "Inverse Square", ""},
146 {eWarp_Falloff_Sharp, "SHARP", ICON_SHARPCURVE, "Sharp", ""},
147 {eWarp_Falloff_Linear, "LINEAR", ICON_LINCURVE, "Linear", ""},
148 {eWarp_Falloff_Const, "CONSTANT", ICON_NOCURVE, "Constant", ""},
149 {0, NULL, 0, NULL, NULL}
153 /* ***** Data Transfer ***** */
155 EnumPropertyItem rna_enum_dt_method_vertex_items[] = {
156 {MREMAP_MODE_TOPOLOGY, "TOPOLOGY", 0, "Topology",
157 "Copy from identical topology meshes"},
158 {MREMAP_MODE_VERT_NEAREST, "NEAREST", 0, "Nearest vertex",
159 "Copy from closest vertex"},
160 {MREMAP_MODE_VERT_EDGE_NEAREST, "EDGE_NEAREST", 0, "Nearest Edge Vertex",
161 "Copy from closest vertex of closest edge"},
162 {MREMAP_MODE_VERT_EDGEINTERP_NEAREST, "EDGEINTERP_NEAREST", 0, "Nearest Edge Interpolated",
163 "Copy from interpolated values of vertices from closest point on closest edge"},
164 {MREMAP_MODE_VERT_POLY_NEAREST, "POLY_NEAREST", 0, "Nearest Face Vertex",
165 "Copy from closest vertex of closest face"},
166 {MREMAP_MODE_VERT_POLYINTERP_NEAREST, "POLYINTERP_NEAREST", 0, "Nearest Face Interpolated",
167 "Copy from interpolated values of vertices from closest point on closest face"},
168 {MREMAP_MODE_VERT_POLYINTERP_VNORPROJ, "POLYINTERP_VNORPROJ", 0, "Projected Face Interpolated",
169 "Copy from interpolated values of vertices from point on closest face hit by normal-projection"},
170 {0, NULL, 0, NULL, NULL}
173 EnumPropertyItem rna_enum_dt_method_edge_items[] = {
174 {MREMAP_MODE_TOPOLOGY, "TOPOLOGY", 0, "Topology",
175 "Copy from identical topology meshes"},
176 {MREMAP_MODE_EDGE_VERT_NEAREST, "VERT_NEAREST", 0, "Nearest Vertices",
177 "Copy from most similar edge (edge which vertices are the closest of destination edge's ones)"},
178 {MREMAP_MODE_EDGE_NEAREST, "NEAREST", 0, "Nearest Edge",
179 "Copy from closest edge (using midpoints)"},
180 {MREMAP_MODE_EDGE_POLY_NEAREST, "POLY_NEAREST", 0, "Nearest Face Edge",
181 "Copy from closest edge of closest face (using midpoints)"},
182 {MREMAP_MODE_EDGE_EDGEINTERP_VNORPROJ, "EDGEINTERP_VNORPROJ", 0, "Projected Edge Interpolated",
183 "Interpolate all source edges hit by the projection of destination one along its own normal (from vertices)"},
184 {0, NULL, 0, NULL, NULL}
187 EnumPropertyItem rna_enum_dt_method_loop_items[] = {
188 {MREMAP_MODE_TOPOLOGY, "TOPOLOGY", 0, "Topology",
189 "Copy from identical topology meshes"},
190 {MREMAP_MODE_LOOP_NEAREST_LOOPNOR, "NEAREST_NORMAL", 0, "Nearest Corner And Best Matching Normal",
191 "Copy from nearest corner which has the best matching normal"},
192 {MREMAP_MODE_LOOP_NEAREST_POLYNOR, "NEAREST_POLYNOR", 0, "Nearest Corner And Best Matching Face Normal",
193 "Copy from nearest corner which has the face with the best matching normal to destination corner's face one"},
194 {MREMAP_MODE_LOOP_POLY_NEAREST, "NEAREST_POLY", 0, "Nearest Corner Of Nearest Face",
195 "Copy from nearest corner of nearest polygon"},
196 {MREMAP_MODE_LOOP_POLYINTERP_NEAREST, "POLYINTERP_NEAREST", 0, "Nearest Face Interpolated",
197 "Copy from interpolated corners of the nearest source polygon"},
198 {MREMAP_MODE_LOOP_POLYINTERP_LNORPROJ, "POLYINTERP_LNORPROJ", 0, "Projected Face Interpolated",
199 "Copy from interpolated corners of the source polygon hit by corner normal projection"},
200 {0, NULL, 0, NULL, NULL}
203 EnumPropertyItem rna_enum_dt_method_poly_items[] = {
204 {MREMAP_MODE_TOPOLOGY, "TOPOLOGY", 0, "Topology",
205 "Copy from identical topology meshes"},
206 {MREMAP_MODE_POLY_NEAREST, "NEAREST", 0, "Nearest Face",
207 "Copy from nearest polygon (using center points)"},
208 {MREMAP_MODE_POLY_NOR, "NORMAL", 0, "Best Normal-Matching",
209 "Copy from source polygon which normal is the closest to destination one"},
210 {MREMAP_MODE_POLY_POLYINTERP_PNORPROJ, "POLYINTERP_PNORPROJ", 0, "Projected Face Interpolated",
211 "Interpolate all source polygons intersected by the projection of destination one along its own normal"},
212 {0, NULL, 0, NULL, NULL}
215 EnumPropertyItem rna_enum_dt_mix_mode_items[] = {
216 {CDT_MIX_TRANSFER, "REPLACE", 0, "Replace",
217 "Overwrite all elements' data"},
218 {CDT_MIX_REPLACE_ABOVE_THRESHOLD, "ABOVE_THRESHOLD", 0, "Above Threshold",
219 "Only replace destination elements where data is above given threshold (exact behavior depends on data type)"},
220 {CDT_MIX_REPLACE_BELOW_THRESHOLD, "BELOW_THRESHOLD", 0, "Below Threshold",
221 "Only replace destination elements where data is below given threshold (exact behavior depends on data type)"},
222 {CDT_MIX_MIX, "MIX", 0, "Mix",
223 "Mix source value into destination one, using given threshold as factor"},
224 {CDT_MIX_ADD, "ADD", 0, "Add",
225 "Add source value to destination one, using given threshold as factor"},
226 {CDT_MIX_SUB, "SUB", 0, "Subtract",
227 "Subtract source value to destination one, using given threshold as factor"},
228 {CDT_MIX_MUL, "MUL", 0, "Multiply",
229 "Multiply source value to destination one, using given threshold as factor"},
231 {0, NULL, 0, NULL, NULL}
234 EnumPropertyItem rna_enum_dt_layers_select_src_items[] = {
235 {DT_LAYERS_ACTIVE_SRC, "ACTIVE", 0, "Active Layer",
236 "Only transfer active data layer"},
237 {DT_LAYERS_ALL_SRC, "ALL", 0, "All Layers",
238 "Transfer all data layers"},
239 {DT_LAYERS_VGROUP_SRC_BONE_SELECT, "BONE_SELECT", 0, "Selected Pose Bones",
240 "Transfer all vertex groups used by selected pose bones"},
241 {DT_LAYERS_VGROUP_SRC_BONE_DEFORM, "BONE_DEFORM", 0, "Deform Pose Bones",
242 "Transfer all vertex groups used by deform bones"},
243 {0, NULL, 0, NULL, NULL}
246 EnumPropertyItem rna_enum_dt_layers_select_dst_items[] = {
247 {DT_LAYERS_ACTIVE_DST, "ACTIVE", 0, "Active Layer",
248 "Affect active data layer of all targets"},
249 {DT_LAYERS_NAME_DST, "NAME", 0, "By Name",
250 "Match target data layers to affect by name"},
251 {DT_LAYERS_INDEX_DST, "INDEX", 0, "By Order",
252 "Match target data layers to affect by order (indices)"},
253 {0, NULL, 0, NULL, NULL}
256 EnumPropertyItem rna_enum_axis_xy_items[] = {
257 {0, "X", 0, "X", ""},
258 {1, "Y", 0, "Y", ""},
259 {0, NULL, 0, NULL, NULL}
262 EnumPropertyItem rna_enum_axis_xyz_items[] = {
263 {0, "X", 0, "X", ""},
264 {1, "Y", 0, "Y", ""},
265 {2, "Z", 0, "Z", ""},
266 {0, NULL, 0, NULL, NULL}
269 EnumPropertyItem rna_enum_axis_flag_xyz_items[] = {
270 {(1 << 0), "X", 0, "X", ""},
271 {(1 << 1), "Y", 0, "Y", ""},
272 {(1 << 2), "Z", 0, "Z", ""},
273 {0, NULL, 0, NULL, NULL}
278 #include "DNA_curve_types.h"
279 #include "DNA_smoke_types.h"
281 #include "BKE_context.h"
282 #include "BKE_depsgraph.h"
283 #include "BKE_library.h"
284 #include "BKE_modifier.h"
285 #include "BKE_object.h"
287 static void rna_UVProject_projectors_begin(CollectionPropertyIterator *iter, PointerRNA *ptr)
289 UVProjectModifierData *uvp = (UVProjectModifierData *)ptr->data;
290 rna_iterator_array_begin(iter, (void *)uvp->projectors, sizeof(Object *), uvp->num_projectors, 0, NULL);
293 static StructRNA *rna_Modifier_refine(struct PointerRNA *ptr)
295 ModifierData *md = (ModifierData *)ptr->data;
297 switch ((ModifierType)md->type) {
298 case eModifierType_Subsurf:
299 return &RNA_SubsurfModifier;
300 case eModifierType_Lattice:
301 return &RNA_LatticeModifier;
302 case eModifierType_Curve:
303 return &RNA_CurveModifier;
304 case eModifierType_Build:
305 return &RNA_BuildModifier;
306 case eModifierType_Mirror:
307 return &RNA_MirrorModifier;
308 case eModifierType_Decimate:
309 return &RNA_DecimateModifier;
310 case eModifierType_Wave:
311 return &RNA_WaveModifier;
312 case eModifierType_Armature:
313 return &RNA_ArmatureModifier;
314 case eModifierType_Hook:
315 return &RNA_HookModifier;
316 case eModifierType_Softbody:
317 return &RNA_SoftBodyModifier;
318 case eModifierType_Boolean:
319 return &RNA_BooleanModifier;
320 case eModifierType_Array:
321 return &RNA_ArrayModifier;
322 case eModifierType_EdgeSplit:
323 return &RNA_EdgeSplitModifier;
324 case eModifierType_Displace:
325 return &RNA_DisplaceModifier;
326 case eModifierType_UVProject:
327 return &RNA_UVProjectModifier;
328 case eModifierType_Smooth:
329 return &RNA_SmoothModifier;
330 case eModifierType_Cast:
331 return &RNA_CastModifier;
332 case eModifierType_MeshDeform:
333 return &RNA_MeshDeformModifier;
334 case eModifierType_Explode:
335 return &RNA_ExplodeModifier;
336 case eModifierType_Cloth:
337 return &RNA_ClothModifier;
338 case eModifierType_Collision:
339 return &RNA_CollisionModifier;
340 case eModifierType_Bevel:
341 return &RNA_BevelModifier;
342 case eModifierType_Shrinkwrap:
343 return &RNA_ShrinkwrapModifier;
344 case eModifierType_Fluidsim:
345 return &RNA_FluidSimulationModifier;
346 case eModifierType_Mask:
347 return &RNA_MaskModifier;
348 case eModifierType_SimpleDeform:
349 return &RNA_SimpleDeformModifier;
350 case eModifierType_Multires:
351 return &RNA_MultiresModifier;
352 case eModifierType_Surface:
353 return &RNA_SurfaceModifier;
354 case eModifierType_Smoke:
355 return &RNA_SmokeModifier;
356 case eModifierType_Solidify:
357 return &RNA_SolidifyModifier;
358 case eModifierType_Screw:
359 return &RNA_ScrewModifier;
360 case eModifierType_Ocean:
361 return &RNA_OceanModifier;
362 case eModifierType_Warp:
363 return &RNA_WarpModifier;
364 case eModifierType_WeightVGEdit:
365 return &RNA_VertexWeightEditModifier;
366 case eModifierType_WeightVGMix:
367 return &RNA_VertexWeightMixModifier;
368 case eModifierType_WeightVGProximity:
369 return &RNA_VertexWeightProximityModifier;
370 case eModifierType_DynamicPaint:
371 return &RNA_DynamicPaintModifier;
372 case eModifierType_Remesh:
373 return &RNA_RemeshModifier;
374 case eModifierType_Skin:
375 return &RNA_SkinModifier;
376 case eModifierType_LaplacianSmooth:
377 return &RNA_LaplacianSmoothModifier;
378 case eModifierType_Triangulate:
379 return &RNA_TriangulateModifier;
380 case eModifierType_UVWarp:
381 return &RNA_UVWarpModifier;
382 case eModifierType_MeshCache:
383 return &RNA_MeshCacheModifier;
384 case eModifierType_LaplacianDeform:
385 return &RNA_LaplacianDeformModifier;
386 case eModifierType_Wireframe:
387 return &RNA_WireframeModifier;
388 case eModifierType_DataTransfer:
389 return &RNA_DataTransferModifier;
390 case eModifierType_NormalEdit:
391 return &RNA_NormalEditModifier;
392 case eModifierType_CorrectiveSmooth:
393 return &RNA_CorrectiveSmoothModifier;
395 case eModifierType_None:
396 case eModifierType_ShapeKey:
397 case NUM_MODIFIER_TYPES:
398 return &RNA_Modifier;
401 return &RNA_Modifier;
404 static void rna_Modifier_name_set(PointerRNA *ptr, const char *value)
406 ModifierData *md = ptr->data;
407 char oldname[sizeof(md->name)];
409 /* make a copy of the old name first */
410 BLI_strncpy(oldname, md->name, sizeof(md->name));
412 /* copy the new name into the name slot */
413 BLI_strncpy_utf8(md->name, value, sizeof(md->name));
415 /* make sure the name is truly unique */
417 Object *ob = ptr->id.data;
418 modifier_unique_name(&ob->modifiers, md);
421 /* fix all the animation data which may link to this */
422 BKE_animdata_fix_paths_rename_all(NULL, "modifiers", oldname, md->name);
425 static char *rna_Modifier_path(PointerRNA *ptr)
427 ModifierData *md = ptr->data;
428 char name_esc[sizeof(md->name) * 2];
430 BLI_strescape(name_esc, md->name, sizeof(name_esc));
431 return BLI_sprintfN("modifiers[\"%s\"]", name_esc);
434 static void rna_Modifier_update(Main *UNUSED(bmain), Scene *UNUSED(scene), PointerRNA *ptr)
436 DAG_id_tag_update(ptr->id.data, OB_RECALC_DATA);
437 WM_main_add_notifier(NC_OBJECT | ND_MODIFIER, ptr->id.data);
440 static void rna_Modifier_dependency_update(Main *bmain, Scene *scene, PointerRNA *ptr)
442 rna_Modifier_update(bmain, scene, ptr);
443 DAG_relations_tag_update(bmain);
448 #define RNA_MOD_VGROUP_NAME_SET(_type, _prop) \
449 static void rna_##_type##Modifier_##_prop##_set(PointerRNA *ptr, const char *value) \
451 _type##ModifierData *tmd = (_type##ModifierData *)ptr->data; \
452 rna_object_vgroup_name_set(ptr, value, tmd->_prop, sizeof(tmd->_prop)); \
455 RNA_MOD_VGROUP_NAME_SET(Armature, defgrp_name);
456 RNA_MOD_VGROUP_NAME_SET(Bevel, defgrp_name);
457 RNA_MOD_VGROUP_NAME_SET(Cast, defgrp_name);
458 RNA_MOD_VGROUP_NAME_SET(Curve, name);
459 RNA_MOD_VGROUP_NAME_SET(DataTransfer, defgrp_name);
460 RNA_MOD_VGROUP_NAME_SET(Decimate, defgrp_name);
461 RNA_MOD_VGROUP_NAME_SET(CorrectiveSmooth, defgrp_name);
462 RNA_MOD_VGROUP_NAME_SET(Displace, defgrp_name);
463 RNA_MOD_VGROUP_NAME_SET(Hook, name);
464 RNA_MOD_VGROUP_NAME_SET(LaplacianDeform, anchor_grp_name);
465 RNA_MOD_VGROUP_NAME_SET(LaplacianSmooth, defgrp_name);
466 RNA_MOD_VGROUP_NAME_SET(Lattice, name);
467 RNA_MOD_VGROUP_NAME_SET(Mask, vgroup);
468 RNA_MOD_VGROUP_NAME_SET(MeshDeform, defgrp_name);
469 RNA_MOD_VGROUP_NAME_SET(NormalEdit, defgrp_name);
470 RNA_MOD_VGROUP_NAME_SET(Shrinkwrap, vgroup_name);
471 RNA_MOD_VGROUP_NAME_SET(SimpleDeform, vgroup_name);
472 RNA_MOD_VGROUP_NAME_SET(Smooth, defgrp_name);
473 RNA_MOD_VGROUP_NAME_SET(Solidify, defgrp_name);
474 RNA_MOD_VGROUP_NAME_SET(UVWarp, vgroup_name);
475 RNA_MOD_VGROUP_NAME_SET(Warp, defgrp_name);
476 RNA_MOD_VGROUP_NAME_SET(Wave, defgrp_name);
477 RNA_MOD_VGROUP_NAME_SET(WeightVGEdit, defgrp_name);
478 RNA_MOD_VGROUP_NAME_SET(WeightVGEdit, mask_defgrp_name);
479 RNA_MOD_VGROUP_NAME_SET(WeightVGMix, defgrp_name_a);
480 RNA_MOD_VGROUP_NAME_SET(WeightVGMix, defgrp_name_b);
481 RNA_MOD_VGROUP_NAME_SET(WeightVGMix, mask_defgrp_name);
482 RNA_MOD_VGROUP_NAME_SET(WeightVGProximity, defgrp_name);
483 RNA_MOD_VGROUP_NAME_SET(WeightVGProximity, mask_defgrp_name);
484 RNA_MOD_VGROUP_NAME_SET(Wireframe, defgrp_name);
486 static void rna_ExplodeModifier_vgroup_get(PointerRNA *ptr, char *value)
488 ExplodeModifierData *emd = (ExplodeModifierData *)ptr->data;
489 rna_object_vgroup_name_index_get(ptr, value, emd->vgroup);
492 static int rna_ExplodeModifier_vgroup_length(PointerRNA *ptr)
494 ExplodeModifierData *emd = (ExplodeModifierData *)ptr->data;
495 return rna_object_vgroup_name_index_length(ptr, emd->vgroup);
498 static void rna_ExplodeModifier_vgroup_set(PointerRNA *ptr, const char *value)
500 ExplodeModifierData *emd = (ExplodeModifierData *)ptr->data;
501 rna_object_vgroup_name_index_set(ptr, value, &emd->vgroup);
504 #undef RNA_MOD_VGROUP_NAME_SET
508 #define RNA_MOD_UVLAYER_NAME_SET(_type, _prop) \
509 static void rna_##_type##Modifier_##_prop##_set(PointerRNA *ptr, const char *value) \
511 _type##ModifierData *tmd = (_type##ModifierData *)ptr->data; \
512 rna_object_uvlayer_name_set(ptr, value, tmd->_prop, sizeof(tmd->_prop)); \
515 RNA_MOD_UVLAYER_NAME_SET(MappingInfo, uvlayer_name);
516 RNA_MOD_UVLAYER_NAME_SET(UVProject, uvlayer_name);
517 RNA_MOD_UVLAYER_NAME_SET(UVWarp, uvlayer_name);
518 RNA_MOD_UVLAYER_NAME_SET(WeightVGEdit, mask_tex_uvlayer_name);
519 RNA_MOD_UVLAYER_NAME_SET(WeightVGMix, mask_tex_uvlayer_name);
520 RNA_MOD_UVLAYER_NAME_SET(WeightVGProximity, mask_tex_uvlayer_name);
522 #undef RNA_MOD_UVLAYER_NAME_SET
526 static void modifier_object_set(Object *self, Object **ob_p, int type, PointerRNA value)
528 Object *ob = value.data;
530 if (!self || ob != self) {
531 if (!ob || type == OB_EMPTY || ob->type == type) {
532 id_lib_extern((ID *)ob);
538 #define RNA_MOD_OBJECT_SET(_type, _prop, _obtype) \
539 static void rna_##_type##Modifier_##_prop##_set(PointerRNA *ptr, PointerRNA value) \
541 _type##ModifierData *tmd = (_type##ModifierData *)ptr->data; \
542 modifier_object_set(ptr->id.data, &tmd->_prop, _obtype, value); \
545 RNA_MOD_OBJECT_SET(Armature, object, OB_ARMATURE);
546 RNA_MOD_OBJECT_SET(Array, start_cap, OB_MESH);
547 RNA_MOD_OBJECT_SET(Array, end_cap, OB_MESH);
548 RNA_MOD_OBJECT_SET(Array, curve_ob, OB_CURVE);
549 RNA_MOD_OBJECT_SET(Boolean, object, OB_MESH);
550 RNA_MOD_OBJECT_SET(Cast, object, OB_EMPTY);
551 RNA_MOD_OBJECT_SET(Curve, object, OB_CURVE);
552 RNA_MOD_OBJECT_SET(DataTransfer, ob_source, OB_MESH);
553 RNA_MOD_OBJECT_SET(Lattice, object, OB_LATTICE);
554 RNA_MOD_OBJECT_SET(Mask, ob_arm, OB_ARMATURE);
555 RNA_MOD_OBJECT_SET(MeshDeform, object, OB_MESH);
556 RNA_MOD_OBJECT_SET(NormalEdit, target, OB_EMPTY);
557 RNA_MOD_OBJECT_SET(Shrinkwrap, target, OB_MESH);
558 RNA_MOD_OBJECT_SET(Shrinkwrap, auxTarget, OB_MESH);
560 static void rna_HookModifier_object_set(PointerRNA *ptr, PointerRNA value)
562 HookModifierData *hmd = ptr->data;
563 Object *ob = (Object *)value.data;
566 id_lib_extern((ID *)ob);
567 BKE_object_modifier_hook_reset(ob, hmd);
570 static PointerRNA rna_UVProjector_object_get(PointerRNA *ptr)
572 Object **ob = (Object **)ptr->data;
573 return rna_pointer_inherit_refine(ptr, &RNA_Object, *ob);
576 static void rna_UVProjector_object_set(PointerRNA *ptr, PointerRNA value)
578 Object **ob_p = (Object **)ptr->data;
579 Object *ob = (Object *)value.data;
580 id_lib_extern((ID *)ob);
584 #undef RNA_MOD_OBJECT_SET
586 /* Other rna callbacks */
588 static void rna_Smoke_set_type(Main *bmain, Scene *scene, PointerRNA *ptr)
590 SmokeModifierData *smd = (SmokeModifierData *)ptr->data;
591 Object *ob = (Object *)ptr->id.data;
593 /* nothing changed */
594 if ((smd->type & MOD_SMOKE_TYPE_DOMAIN) && smd->domain)
597 smokeModifier_free(smd); /* XXX TODO: completely free all 3 pointers */
598 smokeModifier_createType(smd); /* create regarding of selected type */
601 case MOD_SMOKE_TYPE_DOMAIN:
604 case MOD_SMOKE_TYPE_FLOW:
605 case MOD_SMOKE_TYPE_COLL:
611 /* update dependency since a domain - other type switch could have happened */
612 rna_Modifier_dependency_update(bmain, scene, ptr);
615 static void rna_MultiresModifier_type_set(PointerRNA *ptr, int value)
617 Object *ob = (Object *)ptr->id.data;
618 MultiresModifierData *mmd = (MultiresModifierData *)ptr->data;
620 multires_force_update(ob);
624 static void rna_MultiresModifier_level_range(PointerRNA *ptr, int *min, int *max,
625 int *UNUSED(softmin), int *UNUSED(softmax))
627 MultiresModifierData *mmd = (MultiresModifierData *)ptr->data;
630 *max = max_ii(0, mmd->totlvl); /* intentionally _not_ -1 */
633 static int rna_MultiresModifier_external_get(PointerRNA *ptr)
635 Object *ob = (Object *)ptr->id.data;
638 return CustomData_external_test(&me->ldata, CD_MDISPS);
641 static void rna_MultiresModifier_filepath_get(PointerRNA *ptr, char *value)
643 Object *ob = (Object *)ptr->id.data;
644 CustomDataExternal *external = ((Mesh *)ob->data)->ldata.external;
646 BLI_strncpy(value, (external) ? external->filename : "", sizeof(external->filename));
649 static void rna_MultiresModifier_filepath_set(PointerRNA *ptr, const char *value)
651 Object *ob = (Object *)ptr->id.data;
652 CustomDataExternal *external = ((Mesh *)ob->data)->ldata.external;
654 if (external && !STREQ(external->filename, value)) {
655 BLI_strncpy(external->filename, value, sizeof(external->filename));
656 multires_force_external_reload(ob);
660 static int rna_MultiresModifier_filepath_length(PointerRNA *ptr)
662 Object *ob = (Object *)ptr->id.data;
663 CustomDataExternal *external = ((Mesh *)ob->data)->ldata.external;
665 return strlen((external) ? external->filename : "");
668 static int rna_ShrinkwrapModifier_face_cull_get(PointerRNA *ptr)
670 ShrinkwrapModifierData *swm = (ShrinkwrapModifierData *)ptr->data;
671 return swm->shrinkOpts & (MOD_SHRINKWRAP_CULL_TARGET_FRONTFACE | MOD_SHRINKWRAP_CULL_TARGET_BACKFACE);
674 static void rna_ShrinkwrapModifier_face_cull_set(struct PointerRNA *ptr, int value)
676 ShrinkwrapModifierData *swm = (ShrinkwrapModifierData *)ptr->data;
679 (swm->shrinkOpts & ~(MOD_SHRINKWRAP_CULL_TARGET_FRONTFACE | MOD_SHRINKWRAP_CULL_TARGET_BACKFACE)) | value;
682 static int rna_MeshDeformModifier_is_bound_get(PointerRNA *ptr)
684 return (((MeshDeformModifierData *)ptr->data)->bindcagecos != NULL);
687 static PointerRNA rna_SoftBodyModifier_settings_get(PointerRNA *ptr)
689 Object *ob = (Object *)ptr->id.data;
690 return rna_pointer_inherit_refine(ptr, &RNA_SoftBodySettings, ob->soft);
693 static PointerRNA rna_CollisionModifier_settings_get(PointerRNA *ptr)
695 Object *ob = (Object *)ptr->id.data;
696 return rna_pointer_inherit_refine(ptr, &RNA_CollisionSettings, ob->pd);
699 static void rna_UVProjectModifier_num_projectors_set(PointerRNA *ptr, int value)
701 UVProjectModifierData *md = (UVProjectModifierData *)ptr->data;
704 md->num_projectors = CLAMPIS(value, 1, MOD_UVPROJECT_MAXPROJECTORS);
705 for (a = md->num_projectors; a < MOD_UVPROJECT_MAXPROJECTORS; a++)
706 md->projectors[a] = NULL;
709 static void rna_OceanModifier_init_update(Main *bmain, Scene *scene, PointerRNA *ptr)
711 OceanModifierData *omd = (OceanModifierData *)ptr->data;
713 omd->refresh |= (MOD_OCEAN_REFRESH_RESET | MOD_OCEAN_REFRESH_SIM | MOD_OCEAN_REFRESH_CLEAR_CACHE);
715 rna_Modifier_update(bmain, scene, ptr);
718 static void rna_OceanModifier_sim_update(Main *bmain, Scene *scene, PointerRNA *ptr)
720 OceanModifierData *omd = (OceanModifierData *)ptr->data;
722 omd->refresh |= MOD_OCEAN_REFRESH_SIM;
724 rna_Modifier_update(bmain, scene, ptr);
727 static void rna_OceanModifier_topology_update(Main *bmain, Scene *scene, PointerRNA *ptr)
729 OceanModifierData *omd = (OceanModifierData *)ptr->data;
731 omd->refresh |= MOD_OCEAN_REFRESH_TOPOLOGY;
733 rna_Modifier_update(bmain, scene, ptr);
736 static void rna_OceanModifier_ocean_chop_set(PointerRNA *ptr, float value)
738 OceanModifierData *omd = (OceanModifierData *)ptr->data;
739 float old_value = omd->chop_amount;
741 omd->chop_amount = value;
743 if ((old_value == 0.0f && value > 0.0f) ||
744 (old_value > 0.0f && value == 0.0f))
746 omd->refresh |= MOD_OCEAN_REFRESH_RESET;
747 omd->refresh |= MOD_OCEAN_REFRESH_CLEAR_CACHE;
751 static int rna_LaplacianDeformModifier_is_bind_get(PointerRNA *ptr)
753 LaplacianDeformModifierData *lmd = (LaplacianDeformModifierData *)ptr->data;
754 return ((lmd->flag & MOD_LAPLACIANDEFORM_BIND) && (lmd->cache_system != NULL));
757 /* NOTE: Curve and array modifiers requires curve path to be evaluated,
758 * dependency graph will make sure that curve eval would create such a path,
759 * but if curve was already evaluated we might miss path.
761 * So what we do here is: if path was not calculated for target curve we
765 static void rna_CurveModifier_dependency_update(Main *bmain, Scene *scene, PointerRNA *ptr)
767 CurveModifierData *cmd = (CurveModifierData *)ptr->data;
768 rna_Modifier_update(bmain, scene, ptr);
769 DAG_relations_tag_update(bmain);
770 if (cmd->object != NULL) {
771 Curve *curve = cmd->object->data;
772 if ((curve->flag & CU_PATH) == 0) {
773 DAG_id_tag_update(&curve->id, OB_RECALC_DATA);
778 static void rna_ArrayModifier_dependency_update(Main *bmain, Scene *scene, PointerRNA *ptr)
780 ArrayModifierData *amd = (ArrayModifierData *)ptr->data;
781 rna_Modifier_update(bmain, scene, ptr);
782 DAG_relations_tag_update(bmain);
783 if (amd->curve_ob != NULL) {
784 Curve *curve = amd->curve_ob->data;
785 if ((curve->flag & CU_PATH) == 0) {
786 DAG_id_tag_update(&curve->id, OB_RECALC_DATA);
792 static void rna_DataTransferModifier_use_data_update(Main *bmain, Scene *scene, PointerRNA *ptr)
794 DataTransferModifierData *dtmd = (DataTransferModifierData *)ptr->data;
796 if (!(dtmd->flags & MOD_DATATRANSFER_USE_VERT)) {
797 dtmd->data_types &= ~DT_TYPE_VERT_ALL;
799 if (!(dtmd->flags & MOD_DATATRANSFER_USE_EDGE)) {
800 dtmd->data_types &= ~DT_TYPE_EDGE_ALL;
802 if (!(dtmd->flags & MOD_DATATRANSFER_USE_LOOP)) {
803 dtmd->data_types &= ~DT_TYPE_LOOP_ALL;
805 if (!(dtmd->flags & MOD_DATATRANSFER_USE_POLY)) {
806 dtmd->data_types &= ~DT_TYPE_POLY_ALL;
809 rna_Modifier_update(bmain, scene, ptr);
812 static void rna_DataTransferModifier_data_types_update(Main *bmain, Scene *scene, PointerRNA *ptr)
814 DataTransferModifierData *dtmd = (DataTransferModifierData *)ptr->data;
815 const int item_types = BKE_object_data_transfer_get_dttypes_item_types(dtmd->data_types);
817 if (item_types & ME_VERT) {
818 dtmd->flags |= MOD_DATATRANSFER_USE_VERT;
820 if (item_types & ME_EDGE) {
821 dtmd->flags |= MOD_DATATRANSFER_USE_EDGE;
823 if (item_types & ME_LOOP) {
824 dtmd->flags |= MOD_DATATRANSFER_USE_LOOP;
826 if (item_types & ME_POLY) {
827 dtmd->flags |= MOD_DATATRANSFER_USE_POLY;
830 rna_Modifier_update(bmain, scene, ptr);
833 static void rna_DataTransferModifier_verts_data_types_set(struct PointerRNA *ptr, int value)
835 DataTransferModifierData *dtmd = (DataTransferModifierData *)ptr->data;
837 dtmd->data_types &= ~DT_TYPE_VERT_ALL;
838 dtmd->data_types |= value;
841 static void rna_DataTransferModifier_edges_data_types_set(struct PointerRNA *ptr, int value)
843 DataTransferModifierData *dtmd = (DataTransferModifierData *)ptr->data;
845 dtmd->data_types &= ~DT_TYPE_EDGE_ALL;
846 dtmd->data_types |= value;
849 static void rna_DataTransferModifier_loops_data_types_set(struct PointerRNA *ptr, int value)
851 DataTransferModifierData *dtmd = (DataTransferModifierData *)ptr->data;
853 dtmd->data_types &= ~DT_TYPE_LOOP_ALL;
854 dtmd->data_types |= value;
857 static void rna_DataTransferModifier_polys_data_types_set(struct PointerRNA *ptr, int value)
859 DataTransferModifierData *dtmd = (DataTransferModifierData *)ptr->data;
861 dtmd->data_types &= ~DT_TYPE_POLY_ALL;
862 dtmd->data_types |= value;
865 static EnumPropertyItem *rna_DataTransferModifier_layers_select_src_itemf(bContext *C, PointerRNA *ptr, PropertyRNA *prop, bool *r_free)
867 DataTransferModifierData *dtmd = (DataTransferModifierData *)ptr->data;
868 EnumPropertyItem *item = NULL, tmp_item = {0};
871 if (!C) { /* needed for docs and i18n tools */
872 return rna_enum_dt_layers_select_src_items;
875 /* No active here! */
876 RNA_enum_items_add_value(&item, &totitem, rna_enum_dt_layers_select_src_items, DT_LAYERS_ALL_SRC);
878 if (STREQ(RNA_property_identifier(prop), "layers_vgroup_select_src")) {
879 Object *ob_src = dtmd->ob_source;
881 #if 0 /* XXX Don't think we want this in modifier version... */
882 if (BKE_object_pose_armature_get(ob_src)) {
883 RNA_enum_items_add_value(&item, &totitem, rna_enum_dt_layers_select_src_items, DT_LAYERS_VGROUP_SRC_BONE_SELECT);
884 RNA_enum_items_add_value(&item, &totitem, rna_enum_dt_layers_select_src_items, DT_LAYERS_VGROUP_SRC_BONE_DEFORM);
892 RNA_enum_item_add_separator(&item, &totitem);
894 for (i = 0, dg = ob_src->defbase.first; dg; i++, dg = dg->next) {
896 tmp_item.identifier = tmp_item.name = dg->name;
897 RNA_enum_item_add(&item, &totitem, &tmp_item);
901 else if (STREQ(RNA_property_identifier(prop), "layers_shapekey_select_src")) {
904 else if (STREQ(RNA_property_identifier(prop), "layers_uv_select_src")) {
905 Object *ob_src = dtmd->ob_source;
912 /* XXX Is this OK? */
913 dm_src = mesh_get_derived_final(dtmd->modifier.scene, ob_src, CD_MASK_BAREMESH | CD_MTEXPOLY);
914 pdata = dm_src->getPolyDataLayout(dm_src);
915 num_data = CustomData_number_of_layers(pdata, CD_MTEXPOLY);
917 RNA_enum_item_add_separator(&item, &totitem);
919 for (i = 0; i < num_data; i++) {
921 tmp_item.identifier = tmp_item.name = CustomData_get_layer_name(pdata, CD_MTEXPOLY, i);
922 RNA_enum_item_add(&item, &totitem, &tmp_item);
926 else if (STREQ(RNA_property_identifier(prop), "layers_vcol_select_src")) {
927 Object *ob_src = dtmd->ob_source;
934 /* XXX Is this OK? */
935 dm_src = mesh_get_derived_final(dtmd->modifier.scene, ob_src, CD_MASK_BAREMESH | CD_MLOOPCOL);
936 ldata = dm_src->getLoopDataLayout(dm_src);
937 num_data = CustomData_number_of_layers(ldata, CD_MLOOPCOL);
939 RNA_enum_item_add_separator(&item, &totitem);
941 for (i = 0; i < num_data; i++) {
943 tmp_item.identifier = tmp_item.name = CustomData_get_layer_name(ldata, CD_MLOOPCOL, i);
944 RNA_enum_item_add(&item, &totitem, &tmp_item);
949 RNA_enum_item_end(&item, &totitem);
955 static EnumPropertyItem *rna_DataTransferModifier_layers_select_dst_itemf(bContext *C, PointerRNA *ptr, PropertyRNA *prop, bool *r_free)
957 DataTransferModifierData *dtmd = (DataTransferModifierData *)ptr->data;
958 EnumPropertyItem *item = NULL, tmp_item = {0};
961 if (!C) { /* needed for docs and i18n tools */
962 return rna_enum_dt_layers_select_dst_items;
965 /* No active here! */
966 RNA_enum_items_add_value(&item, &totitem, rna_enum_dt_layers_select_dst_items, DT_LAYERS_NAME_DST);
967 RNA_enum_items_add_value(&item, &totitem, rna_enum_dt_layers_select_dst_items, DT_LAYERS_INDEX_DST);
969 if (STREQ(RNA_property_identifier(prop), "layers_vgroup_select_dst")) {
970 /* Only list destination layers if we have a single source! */
971 if (dtmd->layers_select_src[DT_MULTILAYER_INDEX_MDEFORMVERT] >= 0) {
972 Object *ob_dst = CTX_data_active_object(C); /* XXX Is this OK? */
978 RNA_enum_item_add_separator(&item, &totitem);
980 for (i = 0, dg = ob_dst->defbase.first; dg; i++, dg = dg->next) {
982 tmp_item.identifier = tmp_item.name = dg->name;
983 RNA_enum_item_add(&item, &totitem, &tmp_item);
988 else if (STREQ(RNA_property_identifier(prop), "layers_shapekey_select_dst")) {
991 else if (STREQ(RNA_property_identifier(prop), "layers_uv_select_dst")) {
992 /* Only list destination layers if we have a single source! */
993 if (dtmd->layers_select_src[DT_MULTILAYER_INDEX_UV] >= 0) {
994 Object *ob_dst = CTX_data_active_object(C); /* XXX Is this OK? */
996 if (ob_dst && ob_dst->data) {
1001 me_dst = ob_dst->data;
1002 pdata = &me_dst->pdata;
1003 num_data = CustomData_number_of_layers(pdata, CD_MTEXPOLY);
1005 RNA_enum_item_add_separator(&item, &totitem);
1007 for (i = 0; i < num_data; i++) {
1009 tmp_item.identifier = tmp_item.name = CustomData_get_layer_name(pdata, CD_MTEXPOLY, i);
1010 RNA_enum_item_add(&item, &totitem, &tmp_item);
1015 else if (STREQ(RNA_property_identifier(prop), "layers_vcol_select_dst")) {
1016 /* Only list destination layers if we have a single source! */
1017 if (dtmd->layers_select_src[DT_MULTILAYER_INDEX_VCOL] >= 0) {
1018 Object *ob_dst = CTX_data_active_object(C); /* XXX Is this OK? */
1020 if (ob_dst && ob_dst->data) {
1025 me_dst = ob_dst->data;
1026 ldata = &me_dst->ldata;
1027 num_data = CustomData_number_of_layers(ldata, CD_MLOOPCOL);
1029 RNA_enum_item_add_separator(&item, &totitem);
1031 for (i = 0; i < num_data; i++) {
1033 tmp_item.identifier = tmp_item.name = CustomData_get_layer_name(ldata, CD_MLOOPCOL, i);
1034 RNA_enum_item_add(&item, &totitem, &tmp_item);
1041 RNA_enum_item_end(&item, &totitem);
1047 static EnumPropertyItem *rna_DataTransferModifier_mix_mode_itemf(bContext *C, PointerRNA *ptr, PropertyRNA *UNUSED(prop), bool *r_free)
1049 DataTransferModifierData *dtmd = (DataTransferModifierData *)ptr->data;
1050 EnumPropertyItem *item = NULL;
1053 bool support_advanced_mixing, support_threshold;
1055 if (!C) { /* needed for docs and i18n tools */
1056 return rna_enum_dt_mix_mode_items;
1059 RNA_enum_items_add_value(&item, &totitem, rna_enum_dt_mix_mode_items, CDT_MIX_TRANSFER);
1061 BKE_object_data_transfer_get_dttypes_capacity(dtmd->data_types, &support_advanced_mixing, &support_threshold);
1063 if (support_threshold) {
1064 RNA_enum_items_add_value(&item, &totitem, rna_enum_dt_mix_mode_items, CDT_MIX_REPLACE_ABOVE_THRESHOLD);
1065 RNA_enum_items_add_value(&item, &totitem, rna_enum_dt_mix_mode_items, CDT_MIX_REPLACE_BELOW_THRESHOLD);
1068 if (support_advanced_mixing) {
1069 RNA_enum_item_add_separator(&item, &totitem);
1070 RNA_enum_items_add_value(&item, &totitem, rna_enum_dt_mix_mode_items, CDT_MIX_MIX);
1071 RNA_enum_items_add_value(&item, &totitem, rna_enum_dt_mix_mode_items, CDT_MIX_ADD);
1072 RNA_enum_items_add_value(&item, &totitem, rna_enum_dt_mix_mode_items, CDT_MIX_SUB);
1073 RNA_enum_items_add_value(&item, &totitem, rna_enum_dt_mix_mode_items, CDT_MIX_MUL);
1076 RNA_enum_item_end(&item, &totitem);
1082 static void rna_CorrectiveSmoothModifier_update(Main *bmain, Scene *scene, PointerRNA *ptr)
1084 CorrectiveSmoothModifierData *csmd = (CorrectiveSmoothModifierData *)ptr->data;
1086 MEM_SAFE_FREE(csmd->delta_cache);
1088 rna_Modifier_update(bmain, scene, ptr);
1091 static void rna_CorrectiveSmoothModifier_rest_source_update(Main *bmain, Scene *scene, PointerRNA *ptr)
1093 CorrectiveSmoothModifierData *csmd = (CorrectiveSmoothModifierData *)ptr->data;
1095 if (csmd->rest_source != MOD_CORRECTIVESMOOTH_RESTSOURCE_BIND) {
1096 MEM_SAFE_FREE(csmd->bind_coords);
1097 csmd->bind_coords_num = 0;
1100 rna_CorrectiveSmoothModifier_update(bmain, scene, ptr);
1103 static int rna_CorrectiveSmoothModifier_is_bind_get(PointerRNA *ptr)
1105 CorrectiveSmoothModifierData *csmd = (CorrectiveSmoothModifierData *)ptr->data;
1106 return (csmd->bind_coords != NULL);
1111 static PropertyRNA *rna_def_property_subdivision_common(StructRNA *srna, const char type[])
1113 static EnumPropertyItem prop_subdivision_type_items[] = {
1114 {0, "CATMULL_CLARK", 0, "Catmull-Clark", ""},
1115 {1, "SIMPLE", 0, "Simple", ""},
1116 {0, NULL, 0, NULL, NULL}
1119 PropertyRNA *prop = RNA_def_property(srna, "subdivision_type", PROP_ENUM, PROP_NONE);
1120 RNA_def_property_enum_sdna(prop, NULL, type);
1121 RNA_def_property_enum_items(prop, prop_subdivision_type_items);
1122 RNA_def_property_ui_text(prop, "Subdivision Type", "Select type of subdivision algorithm");
1123 RNA_def_property_update(prop, 0, "rna_Modifier_update");
1128 static void rna_def_modifier_subsurf(BlenderRNA *brna)
1133 srna = RNA_def_struct(brna, "SubsurfModifier", "Modifier");
1134 RNA_def_struct_ui_text(srna, "Subsurf Modifier", "Subdivision surface modifier");
1135 RNA_def_struct_sdna(srna, "SubsurfModifierData");
1136 RNA_def_struct_ui_icon(srna, ICON_MOD_SUBSURF);
1138 rna_def_property_subdivision_common(srna, "subdivType");
1140 /* see CCGSUBSURF_LEVEL_MAX for max limit */
1141 prop = RNA_def_property(srna, "levels", PROP_INT, PROP_UNSIGNED);
1142 RNA_def_property_int_sdna(prop, NULL, "levels");
1143 RNA_def_property_range(prop, 0, 11);
1144 RNA_def_property_ui_range(prop, 0, 6, 1, -1);
1145 RNA_def_property_ui_text(prop, "Levels", "Number of subdivisions to perform");
1146 RNA_def_property_update(prop, 0, "rna_Modifier_update");
1148 prop = RNA_def_property(srna, "render_levels", PROP_INT, PROP_UNSIGNED);
1149 RNA_def_property_int_sdna(prop, NULL, "renderLevels");
1150 RNA_def_property_range(prop, 0, 11);
1151 RNA_def_property_ui_range(prop, 0, 6, 1, -1);
1152 RNA_def_property_ui_text(prop, "Render Levels", "Number of subdivisions to perform when rendering");
1154 prop = RNA_def_property(srna, "show_only_control_edges", PROP_BOOLEAN, PROP_NONE);
1155 RNA_def_property_boolean_sdna(prop, NULL, "flags", eSubsurfModifierFlag_ControlEdges);
1156 RNA_def_property_ui_text(prop, "Optimal Display", "Skip drawing/rendering of interior subdivided edges");
1157 RNA_def_property_update(prop, 0, "rna_Modifier_update");
1159 prop = RNA_def_property(srna, "use_subsurf_uv", PROP_BOOLEAN, PROP_NONE);
1160 RNA_def_property_boolean_sdna(prop, NULL, "flags", eSubsurfModifierFlag_SubsurfUv);
1161 RNA_def_property_ui_text(prop, "Subdivide UVs", "Use subsurf to subdivide UVs");
1162 RNA_def_property_update(prop, 0, "rna_Modifier_update");
1164 #ifdef WITH_OPENSUBDIV
1165 prop = RNA_def_property(srna, "use_opensubdiv", PROP_BOOLEAN, PROP_NONE);
1166 RNA_def_property_boolean_sdna(prop, NULL, "use_opensubdiv", 1);
1167 RNA_def_property_ui_text(prop, "Use OpenSubdiv", "Use OpenSubdiv for the subdivisions (viewport only)");
1168 RNA_def_property_update(prop, 0, "rna_Modifier_update");
1172 static void rna_def_modifier_generic_map_info(StructRNA *srna)
1174 static EnumPropertyItem prop_texture_coordinates_items[] = {
1175 {MOD_DISP_MAP_LOCAL, "LOCAL", 0, "Local", "Use the local coordinate system for the texture coordinates"},
1176 {MOD_DISP_MAP_GLOBAL, "GLOBAL", 0, "Global", "Use the global coordinate system for the texture coordinates"},
1177 {MOD_DISP_MAP_OBJECT, "OBJECT", 0, "Object",
1178 "Use the linked object's local coordinate system for the texture coordinates"},
1179 {MOD_DISP_MAP_UV, "UV", 0, "UV", "Use UV coordinates for the texture coordinates"},
1180 {0, NULL, 0, NULL, NULL}
1185 prop = RNA_def_property(srna, "texture", PROP_POINTER, PROP_NONE);
1186 RNA_def_property_ui_text(prop, "Texture", "");
1187 RNA_def_property_flag(prop, PROP_EDITABLE);
1188 RNA_def_property_update(prop, 0, "rna_Modifier_update");
1190 prop = RNA_def_property(srna, "texture_coords", PROP_ENUM, PROP_NONE);
1191 RNA_def_property_enum_sdna(prop, NULL, "texmapping");
1192 RNA_def_property_enum_items(prop, prop_texture_coordinates_items);
1193 RNA_def_property_ui_text(prop, "Texture Coordinates", "");
1194 RNA_def_property_update(prop, 0, "rna_Modifier_dependency_update");
1196 prop = RNA_def_property(srna, "uv_layer", PROP_STRING, PROP_NONE);
1197 RNA_def_property_string_sdna(prop, NULL, "uvlayer_name");
1198 RNA_def_property_ui_text(prop, "UV Map", "UV map name");
1199 RNA_def_property_string_funcs(prop, NULL, NULL, "rna_MappingInfoModifier_uvlayer_name_set");
1200 RNA_def_property_update(prop, 0, "rna_Modifier_update");
1202 prop = RNA_def_property(srna, "texture_coords_object", PROP_POINTER, PROP_NONE);
1203 RNA_def_property_pointer_sdna(prop, NULL, "map_object");
1204 RNA_def_property_ui_text(prop, "Texture Coordinate Object", "Object to set the texture coordinates");
1205 RNA_def_property_flag(prop, PROP_EDITABLE | PROP_ID_SELF_CHECK);
1206 RNA_def_property_update(prop, 0, "rna_Modifier_dependency_update");
1209 static void rna_def_modifier_warp(BlenderRNA *brna)
1214 srna = RNA_def_struct(brna, "WarpModifier", "Modifier");
1215 RNA_def_struct_ui_text(srna, "Warp Modifier", "Warp modifier");
1216 RNA_def_struct_sdna(srna, "WarpModifierData");
1217 RNA_def_struct_ui_icon(srna, ICON_MOD_WARP);
1219 prop = RNA_def_property(srna, "object_from", PROP_POINTER, PROP_NONE);
1220 RNA_def_property_ui_text(prop, "From", "Object to transform from");
1221 RNA_def_property_flag(prop, PROP_EDITABLE | PROP_ID_SELF_CHECK);
1222 RNA_def_property_update(prop, 0, "rna_Modifier_dependency_update");
1224 prop = RNA_def_property(srna, "object_to", PROP_POINTER, PROP_NONE);
1225 RNA_def_property_ui_text(prop, "To", "Object to transform to");
1226 RNA_def_property_flag(prop, PROP_EDITABLE | PROP_ID_SELF_CHECK);
1227 RNA_def_property_update(prop, 0, "rna_Modifier_dependency_update");
1229 prop = RNA_def_property(srna, "strength", PROP_FLOAT, PROP_NONE);
1230 RNA_def_property_range(prop, -FLT_MAX, FLT_MAX);
1231 RNA_def_property_ui_range(prop, -100, 100, 10, 2);
1232 RNA_def_property_ui_text(prop, "Strength", "");
1233 RNA_def_property_update(prop, 0, "rna_Modifier_update");
1235 prop = RNA_def_property(srna, "falloff_type", PROP_ENUM, PROP_NONE);
1236 RNA_def_property_enum_items(prop, modifier_warp_falloff_items);
1237 RNA_def_property_ui_text(prop, "Falloff Type", "");
1238 RNA_def_property_translation_context(prop, BLT_I18NCONTEXT_ID_CURVE); /* Abusing id_curve :/ */
1239 RNA_def_property_update(prop, 0, "rna_Modifier_update");
1241 prop = RNA_def_property(srna, "falloff_radius", PROP_FLOAT, PROP_UNSIGNED | PROP_DISTANCE);
1242 RNA_def_property_ui_text(prop, "Radius", "Radius to apply");
1243 RNA_def_property_update(prop, 0, "rna_Modifier_update");
1245 prop = RNA_def_property(srna, "falloff_curve", PROP_POINTER, PROP_NONE);
1246 RNA_def_property_pointer_sdna(prop, NULL, "curfalloff");
1247 RNA_def_property_ui_text(prop, "Falloff Curve", "Custom Lamp Falloff Curve");
1248 RNA_def_property_update(prop, 0, "rna_Modifier_update");
1250 prop = RNA_def_property(srna, "use_volume_preserve", PROP_BOOLEAN, PROP_NONE);
1251 RNA_def_property_boolean_sdna(prop, NULL, "flag", MOD_WARP_VOLUME_PRESERVE);
1252 RNA_def_property_ui_text(prop, "Preserve Volume", "Preserve volume when rotations are used");
1253 RNA_def_property_update(prop, 0, "rna_Modifier_update");
1255 prop = RNA_def_property(srna, "vertex_group", PROP_STRING, PROP_NONE);
1256 RNA_def_property_string_sdna(prop, NULL, "defgrp_name");
1257 RNA_def_property_ui_text(prop, "Vertex Group", "Vertex group name for modulating the deform");
1258 RNA_def_property_string_funcs(prop, NULL, NULL, "rna_WarpModifier_defgrp_name_set");
1259 RNA_def_property_update(prop, 0, "rna_Modifier_update");
1261 rna_def_modifier_generic_map_info(srna);
1264 static void rna_def_modifier_multires(BlenderRNA *brna)
1269 srna = RNA_def_struct(brna, "MultiresModifier", "Modifier");
1270 RNA_def_struct_ui_text(srna, "Multires Modifier", "Multiresolution mesh modifier");
1271 RNA_def_struct_sdna(srna, "MultiresModifierData");
1272 RNA_def_struct_ui_icon(srna, ICON_MOD_MULTIRES);
1274 prop = rna_def_property_subdivision_common(srna, "simple");
1275 RNA_def_property_enum_funcs(prop, NULL, "rna_MultiresModifier_type_set", NULL);
1277 prop = RNA_def_property(srna, "levels", PROP_INT, PROP_UNSIGNED);
1278 RNA_def_property_int_sdna(prop, NULL, "lvl");
1279 RNA_def_property_ui_text(prop, "Levels", "Number of subdivisions to use in the viewport");
1280 RNA_def_property_int_funcs(prop, NULL, NULL, "rna_MultiresModifier_level_range");
1281 RNA_def_property_update(prop, 0, "rna_Modifier_update");
1283 prop = RNA_def_property(srna, "sculpt_levels", PROP_INT, PROP_UNSIGNED);
1284 RNA_def_property_int_sdna(prop, NULL, "sculptlvl");
1285 RNA_def_property_ui_text(prop, "Sculpt Levels", "Number of subdivisions to use in sculpt mode");
1286 RNA_def_property_int_funcs(prop, NULL, NULL, "rna_MultiresModifier_level_range");
1287 RNA_def_property_update(prop, 0, "rna_Modifier_update");
1289 prop = RNA_def_property(srna, "render_levels", PROP_INT, PROP_UNSIGNED);
1290 RNA_def_property_int_sdna(prop, NULL, "renderlvl");
1291 RNA_def_property_ui_text(prop, "Render Levels", "The subdivision level visible at render time");
1292 RNA_def_property_int_funcs(prop, NULL, NULL, "rna_MultiresModifier_level_range");
1294 prop = RNA_def_property(srna, "total_levels", PROP_INT, PROP_UNSIGNED);
1295 RNA_def_property_int_sdna(prop, NULL, "totlvl");
1296 RNA_def_property_clear_flag(prop, PROP_EDITABLE);
1297 RNA_def_property_ui_text(prop, "Total Levels", "Number of subdivisions for which displacements are stored");
1299 prop = RNA_def_property(srna, "is_external", PROP_BOOLEAN, PROP_NONE);
1300 RNA_def_property_clear_flag(prop, PROP_EDITABLE);
1301 RNA_def_property_boolean_funcs(prop, "rna_MultiresModifier_external_get", NULL);
1302 RNA_def_property_ui_text(prop, "External",
1303 "Store multires displacements outside the .blend file, to save memory");
1305 prop = RNA_def_property(srna, "filepath", PROP_STRING, PROP_FILEPATH);
1306 RNA_def_property_string_funcs(prop, "rna_MultiresModifier_filepath_get", "rna_MultiresModifier_filepath_length",
1307 "rna_MultiresModifier_filepath_set");
1308 RNA_def_property_ui_text(prop, "File Path", "Path to external displacements file");
1309 RNA_def_property_update(prop, 0, "rna_Modifier_update");
1311 prop = RNA_def_property(srna, "show_only_control_edges", PROP_BOOLEAN, PROP_NONE);
1312 RNA_def_property_boolean_sdna(prop, NULL, "flags", eMultiresModifierFlag_ControlEdges);
1313 RNA_def_property_ui_text(prop, "Optimal Display", "Skip drawing/rendering of interior subdivided edges");
1314 RNA_def_property_update(prop, 0, "rna_Modifier_update");
1316 prop = RNA_def_property(srna, "use_subsurf_uv", PROP_BOOLEAN, PROP_NONE);
1317 RNA_def_property_boolean_negative_sdna(prop, NULL, "flags", eMultiresModifierFlag_PlainUv);
1318 RNA_def_property_ui_text(prop, "Subdivide UVs", "Use subsurf to subdivide UVs");
1319 RNA_def_property_update(prop, 0, "rna_Modifier_update");
1322 static void rna_def_modifier_lattice(BlenderRNA *brna)
1327 srna = RNA_def_struct(brna, "LatticeModifier", "Modifier");
1328 RNA_def_struct_ui_text(srna, "Lattice Modifier", "Lattice deformation modifier");
1329 RNA_def_struct_sdna(srna, "LatticeModifierData");
1330 RNA_def_struct_ui_icon(srna, ICON_MOD_LATTICE);
1332 prop = RNA_def_property(srna, "object", PROP_POINTER, PROP_NONE);
1333 RNA_def_property_ui_text(prop, "Object", "Lattice object to deform with");
1334 RNA_def_property_pointer_funcs(prop, NULL, "rna_LatticeModifier_object_set", NULL, "rna_Lattice_object_poll");
1335 RNA_def_property_flag(prop, PROP_EDITABLE | PROP_ID_SELF_CHECK);
1336 RNA_def_property_update(prop, 0, "rna_Modifier_dependency_update");
1338 prop = RNA_def_property(srna, "vertex_group", PROP_STRING, PROP_NONE);
1339 RNA_def_property_string_sdna(prop, NULL, "name");
1340 RNA_def_property_ui_text(prop, "Vertex Group",
1341 "Name of Vertex Group which determines influence of modifier per point");
1342 RNA_def_property_string_funcs(prop, NULL, NULL, "rna_LatticeModifier_name_set");
1343 RNA_def_property_update(prop, 0, "rna_Modifier_update");
1345 prop = RNA_def_property(srna, "strength", PROP_FLOAT, PROP_NONE);
1346 RNA_def_property_range(prop, -FLT_MAX, FLT_MAX);
1347 RNA_def_property_ui_range(prop, 0, 1, 10, 2);
1348 RNA_def_property_ui_text(prop, "Strength", "Strength of modifier effect");
1349 RNA_def_property_update(prop, 0, "rna_Modifier_update");
1352 static void rna_def_modifier_curve(BlenderRNA *brna)
1357 static EnumPropertyItem prop_deform_axis_items[] = {
1358 {MOD_CURVE_POSX, "POS_X", 0, "X", ""},
1359 {MOD_CURVE_POSY, "POS_Y", 0, "Y", ""},
1360 {MOD_CURVE_POSZ, "POS_Z", 0, "Z", ""},
1361 {MOD_CURVE_NEGX, "NEG_X", 0, "-X", ""},
1362 {MOD_CURVE_NEGY, "NEG_Y", 0, "-Y", ""},
1363 {MOD_CURVE_NEGZ, "NEG_Z", 0, "-Z", ""},
1364 {0, NULL, 0, NULL, NULL}
1367 srna = RNA_def_struct(brna, "CurveModifier", "Modifier");
1368 RNA_def_struct_ui_text(srna, "Curve Modifier", "Curve deformation modifier");
1369 RNA_def_struct_sdna(srna, "CurveModifierData");
1370 RNA_def_struct_ui_icon(srna, ICON_MOD_CURVE);
1372 prop = RNA_def_property(srna, "object", PROP_POINTER, PROP_NONE);
1373 RNA_def_property_ui_text(prop, "Object", "Curve object to deform with");
1374 RNA_def_property_pointer_funcs(prop, NULL, "rna_CurveModifier_object_set", NULL, "rna_Curve_object_poll");
1375 RNA_def_property_flag(prop, PROP_EDITABLE | PROP_ID_SELF_CHECK);
1376 RNA_def_property_update(prop, 0, "rna_CurveModifier_dependency_update");
1378 prop = RNA_def_property(srna, "vertex_group", PROP_STRING, PROP_NONE);
1379 RNA_def_property_string_sdna(prop, NULL, "name");
1380 RNA_def_property_ui_text(prop, "Vertex Group",
1381 "Name of Vertex Group which determines influence of modifier per point");
1382 RNA_def_property_string_funcs(prop, NULL, NULL, "rna_CurveModifier_name_set");
1383 RNA_def_property_update(prop, 0, "rna_Modifier_update");
1385 prop = RNA_def_property(srna, "deform_axis", PROP_ENUM, PROP_NONE);
1386 RNA_def_property_enum_sdna(prop, NULL, "defaxis");
1387 RNA_def_property_enum_items(prop, prop_deform_axis_items);
1388 RNA_def_property_ui_text(prop, "Deform Axis", "The axis that the curve deforms along");
1389 RNA_def_property_update(prop, 0, "rna_Modifier_update");
1392 static void rna_def_modifier_build(BlenderRNA *brna)
1397 srna = RNA_def_struct(brna, "BuildModifier", "Modifier");
1398 RNA_def_struct_ui_text(srna, "Build Modifier", "Build effect modifier");
1399 RNA_def_struct_sdna(srna, "BuildModifierData");
1400 RNA_def_struct_ui_icon(srna, ICON_MOD_BUILD);
1402 prop = RNA_def_property(srna, "frame_start", PROP_FLOAT, PROP_TIME);
1403 RNA_def_property_float_sdna(prop, NULL, "start");
1404 RNA_def_property_range(prop, MINAFRAMEF, MAXFRAMEF);
1405 RNA_def_property_ui_text(prop, "Start", "Start frame of the effect");
1406 RNA_def_property_update(prop, 0, "rna_Modifier_update");
1408 prop = RNA_def_property(srna, "frame_duration", PROP_FLOAT, PROP_TIME);
1409 RNA_def_property_float_sdna(prop, NULL, "length");
1410 RNA_def_property_range(prop, 1, MAXFRAMEF);
1411 RNA_def_property_ui_text(prop, "Length", "Total time the build effect requires");
1412 RNA_def_property_update(prop, 0, "rna_Modifier_update");
1414 prop = RNA_def_property(srna, "use_reverse", PROP_BOOLEAN, PROP_NONE);
1415 RNA_def_property_boolean_sdna(prop, NULL, "flag", MOD_BUILD_FLAG_REVERSE);
1416 RNA_def_property_ui_text(prop, "Reversed", "Deconstruct the mesh instead of building it");
1417 RNA_def_property_update(prop, 0, "rna_Modifier_update");
1419 prop = RNA_def_property(srna, "use_random_order", PROP_BOOLEAN, PROP_NONE);
1420 RNA_def_property_boolean_sdna(prop, NULL, "flag", MOD_BUILD_FLAG_RANDOMIZE);
1421 RNA_def_property_ui_text(prop, "Randomize", "Randomize the faces or edges during build");
1422 RNA_def_property_update(prop, 0, "rna_Modifier_update");
1424 prop = RNA_def_property(srna, "seed", PROP_INT, PROP_NONE);
1425 RNA_def_property_range(prop, 1, MAXFRAMEF);
1426 RNA_def_property_ui_text(prop, "Seed", "Seed for random if used");
1427 RNA_def_property_update(prop, 0, "rna_Modifier_update");
1430 static void rna_def_modifier_mirror(BlenderRNA *brna)
1435 srna = RNA_def_struct(brna, "MirrorModifier", "Modifier");
1436 RNA_def_struct_ui_text(srna, "Mirror Modifier", "Mirroring modifier");
1437 RNA_def_struct_sdna(srna, "MirrorModifierData");
1438 RNA_def_struct_ui_icon(srna, ICON_MOD_MIRROR);
1440 prop = RNA_def_property(srna, "use_x", PROP_BOOLEAN, PROP_NONE);
1441 RNA_def_property_boolean_sdna(prop, NULL, "flag", MOD_MIR_AXIS_X);
1442 RNA_def_property_ui_text(prop, "X", "Enable X axis mirror");
1443 RNA_def_property_update(prop, 0, "rna_Modifier_update");
1445 prop = RNA_def_property(srna, "use_y", PROP_BOOLEAN, PROP_NONE);
1446 RNA_def_property_boolean_sdna(prop, NULL, "flag", MOD_MIR_AXIS_Y);
1447 RNA_def_property_ui_text(prop, "Y", "Enable Y axis mirror");
1448 RNA_def_property_update(prop, 0, "rna_Modifier_update");
1450 prop = RNA_def_property(srna, "use_z", PROP_BOOLEAN, PROP_NONE);
1451 RNA_def_property_boolean_sdna(prop, NULL, "flag", MOD_MIR_AXIS_Z);
1452 RNA_def_property_ui_text(prop, "Z", "Enable Z axis mirror");
1453 RNA_def_property_update(prop, 0, "rna_Modifier_update");
1455 prop = RNA_def_property(srna, "use_clip", PROP_BOOLEAN, PROP_NONE);
1456 RNA_def_property_boolean_sdna(prop, NULL, "flag", MOD_MIR_CLIPPING);
1457 RNA_def_property_ui_text(prop, "Clip", "Prevent vertices from going through the mirror during transform");
1458 RNA_def_property_update(prop, 0, "rna_Modifier_update");
1460 prop = RNA_def_property(srna, "use_mirror_vertex_groups", PROP_BOOLEAN, PROP_NONE);
1461 RNA_def_property_boolean_sdna(prop, NULL, "flag", MOD_MIR_VGROUP);
1462 RNA_def_property_ui_text(prop, "Mirror Vertex Groups", "Mirror vertex groups (e.g. .R->.L)");
1463 RNA_def_property_update(prop, 0, "rna_Modifier_update");
1465 prop = RNA_def_property(srna, "use_mirror_merge", PROP_BOOLEAN, PROP_NONE);
1466 RNA_def_property_boolean_negative_sdna(prop, NULL, "flag", MOD_MIR_NO_MERGE);
1467 RNA_def_property_ui_text(prop, "Merge Vertices", "Merge vertices within the merge threshold");
1468 RNA_def_property_update(prop, 0, "rna_Modifier_update");
1470 prop = RNA_def_property(srna, "use_mirror_u", PROP_BOOLEAN, PROP_NONE);
1471 RNA_def_property_boolean_sdna(prop, NULL, "flag", MOD_MIR_MIRROR_U);
1472 RNA_def_property_ui_text(prop, "Mirror U", "Mirror the U texture coordinate around the 0.5 point");
1473 RNA_def_property_update(prop, 0, "rna_Modifier_update");
1475 prop = RNA_def_property(srna, "use_mirror_v", PROP_BOOLEAN, PROP_NONE);
1476 RNA_def_property_boolean_sdna(prop, NULL, "flag", MOD_MIR_MIRROR_V);
1477 RNA_def_property_ui_text(prop, "Mirror V", "Mirror the V texture coordinate around the 0.5 point");
1478 RNA_def_property_update(prop, 0, "rna_Modifier_update");
1480 prop = RNA_def_property(srna, "merge_threshold", PROP_FLOAT, PROP_DISTANCE);
1481 RNA_def_property_float_sdna(prop, NULL, "tolerance");
1482 RNA_def_property_range(prop, 0, FLT_MAX);
1483 RNA_def_property_ui_range(prop, 0, 1, 0.01, 6);
1484 RNA_def_property_ui_text(prop, "Merge Limit", "Distance within which mirrored vertices are merged");
1485 RNA_def_property_update(prop, 0, "rna_Modifier_update");
1487 prop = RNA_def_property(srna, "mirror_object", PROP_POINTER, PROP_NONE);
1488 RNA_def_property_pointer_sdna(prop, NULL, "mirror_ob");
1489 RNA_def_property_ui_text(prop, "Mirror Object", "Object to use as mirror");
1490 RNA_def_property_flag(prop, PROP_EDITABLE | PROP_ID_SELF_CHECK);
1491 RNA_def_property_update(prop, 0, "rna_Modifier_dependency_update");
1494 static void rna_def_modifier_decimate(BlenderRNA *brna)
1496 static EnumPropertyItem modifier_decim_mode_items[] = {
1497 {MOD_DECIM_MODE_COLLAPSE, "COLLAPSE", 0, "Collapse", "Use edge collapsing"},
1498 {MOD_DECIM_MODE_UNSUBDIV, "UNSUBDIV", 0, "Un-Subdivide", "Use un-subdivide face reduction"},
1499 {MOD_DECIM_MODE_DISSOLVE, "DISSOLVE", 0, "Planar", "Dissolve geometry to form planar polygons"},
1500 {0, NULL, 0, NULL, NULL}
1506 srna = RNA_def_struct(brna, "DecimateModifier", "Modifier");
1507 RNA_def_struct_ui_text(srna, "Decimate Modifier", "Decimation modifier");
1508 RNA_def_struct_sdna(srna, "DecimateModifierData");
1509 RNA_def_struct_ui_icon(srna, ICON_MOD_DECIM);
1511 prop = RNA_def_property(srna, "decimate_type", PROP_ENUM, PROP_NONE);
1512 RNA_def_property_enum_sdna(prop, NULL, "mode");
1513 RNA_def_property_enum_items(prop, modifier_decim_mode_items);
1514 RNA_def_property_ui_text(prop, "Mode", "");
1515 RNA_def_property_update(prop, 0, "rna_Modifier_update");
1517 /* (mode == MOD_DECIM_MODE_COLLAPSE) */
1518 prop = RNA_def_property(srna, "ratio", PROP_FLOAT, PROP_FACTOR);
1519 RNA_def_property_float_sdna(prop, NULL, "percent");
1520 RNA_def_property_range(prop, 0, 1);
1521 RNA_def_property_ui_range(prop, 0, 1, 1, 4);
1522 RNA_def_property_ui_text(prop, "Ratio", "Ratio of triangles to reduce to (collapse only)");
1523 RNA_def_property_update(prop, 0, "rna_Modifier_update");
1525 /* (mode == MOD_DECIM_MODE_UNSUBDIV) */
1526 prop = RNA_def_property(srna, "iterations", PROP_INT, PROP_UNSIGNED);
1527 RNA_def_property_int_sdna(prop, NULL, "iter");
1528 RNA_def_property_range(prop, 0, SHRT_MAX);
1529 RNA_def_property_ui_range(prop, 0, 100, 1, -1);
1530 RNA_def_property_ui_text(prop, "Iterations", "Number of times reduce the geometry (unsubdivide only)");
1531 RNA_def_property_update(prop, 0, "rna_Modifier_update");
1533 /* (mode == MOD_DECIM_MODE_DISSOLVE) */
1534 prop = RNA_def_property(srna, "angle_limit", PROP_FLOAT, PROP_ANGLE);
1535 RNA_def_property_float_sdna(prop, NULL, "angle");
1536 RNA_def_property_range(prop, 0, DEG2RAD(180));
1537 RNA_def_property_ui_range(prop, 0, DEG2RAD(180), 10, 2);
1538 RNA_def_property_ui_text(prop, "Angle Limit", "Only dissolve angles below this (planar only)");
1539 RNA_def_property_update(prop, 0, "rna_Modifier_update");
1541 /* (mode == MOD_DECIM_MODE_COLLAPSE) */
1542 prop = RNA_def_property(srna, "vertex_group", PROP_STRING, PROP_NONE);
1543 RNA_def_property_string_sdna(prop, NULL, "defgrp_name");
1544 RNA_def_property_ui_text(prop, "Vertex Group", "Vertex group name (collapse only)");
1545 RNA_def_property_string_funcs(prop, NULL, NULL, "rna_DecimateModifier_defgrp_name_set");
1546 RNA_def_property_update(prop, 0, "rna_Modifier_update");
1548 prop = RNA_def_property(srna, "invert_vertex_group", PROP_BOOLEAN, PROP_NONE);
1549 RNA_def_property_boolean_sdna(prop, NULL, "flag", MOD_DECIM_FLAG_INVERT_VGROUP);
1550 RNA_def_property_ui_text(prop, "Invert", "Invert vertex group influence (collapse only)");
1551 RNA_def_property_update(prop, 0, "rna_Modifier_update");
1553 prop = RNA_def_property(srna, "use_collapse_triangulate", PROP_BOOLEAN, PROP_NONE);
1554 RNA_def_property_boolean_sdna(prop, NULL, "flag", MOD_DECIM_FLAG_TRIANGULATE);
1555 RNA_def_property_ui_text(prop, "Triangulate", "Keep triangulated faces resulting from decimation (collapse only)");
1556 RNA_def_property_update(prop, 0, "rna_Modifier_update");
1558 prop = RNA_def_property(srna, "use_symmetry", PROP_BOOLEAN, PROP_NONE);
1559 RNA_def_property_boolean_sdna(prop, NULL, "flag", MOD_DECIM_FLAG_SYMMETRY);
1560 RNA_def_property_ui_text(prop, "Symmetry", "Maintain symmetry on an axis");
1561 RNA_def_property_update(prop, 0, "rna_Modifier_update");
1563 prop = RNA_def_property(srna, "symmetry_axis", PROP_ENUM, PROP_NONE);
1564 RNA_def_property_enum_sdna(prop, NULL, "symmetry_axis");
1565 RNA_def_property_enum_items(prop, rna_enum_axis_xyz_items);
1566 RNA_def_property_ui_text(prop, "Axis", "Axis of symmetry");
1567 RNA_def_property_update(prop, 0, "rna_Modifier_update");
1569 prop = RNA_def_property(srna, "vertex_group_factor", PROP_FLOAT, PROP_NONE);
1570 RNA_def_property_float_sdna(prop, NULL, "defgrp_factor");
1571 RNA_def_property_range(prop, 0, 1000);
1572 RNA_def_property_ui_range(prop, 0, 10, 1, 4);
1573 RNA_def_property_ui_text(prop, "Factor", "Vertex group strength");
1574 RNA_def_property_update(prop, 0, "rna_Modifier_update");
1575 /* end collapse-only option */
1577 /* (mode == MOD_DECIM_MODE_DISSOLVE) */
1578 prop = RNA_def_property(srna, "use_dissolve_boundaries", PROP_BOOLEAN, PROP_NONE);
1579 RNA_def_property_boolean_sdna(prop, NULL, "flag", MOD_DECIM_FLAG_ALL_BOUNDARY_VERTS);
1580 RNA_def_property_ui_text(prop, "All Boundaries", "Dissolve all vertices inbetween face boundaries (planar only)");
1581 RNA_def_property_update(prop, 0, "rna_Modifier_update");
1583 prop = RNA_def_property(srna, "delimit", PROP_ENUM, PROP_NONE);
1584 RNA_def_property_flag(prop, PROP_ENUM_FLAG); /* important to run before default set */
1585 RNA_def_property_enum_items(prop, rna_enum_mesh_delimit_mode_items);
1586 RNA_def_property_ui_text(prop, "Delimit", "Limit merging geometry");
1587 RNA_def_property_update(prop, 0, "rna_Modifier_update");
1589 /* end dissolve-only option */
1593 /* all modes use this */
1594 prop = RNA_def_property(srna, "face_count", PROP_INT, PROP_NONE);
1595 RNA_def_property_clear_flag(prop, PROP_EDITABLE);
1596 RNA_def_property_ui_text(prop, "Face Count", "The current number of faces in the decimated mesh");
1599 static void rna_def_modifier_wave(BlenderRNA *brna)
1604 srna = RNA_def_struct(brna, "WaveModifier", "Modifier");
1605 RNA_def_struct_ui_text(srna, "Wave Modifier", "Wave effect modifier");
1606 RNA_def_struct_sdna(srna, "WaveModifierData");
1607 RNA_def_struct_ui_icon(srna, ICON_MOD_WAVE);
1609 prop = RNA_def_property(srna, "use_x", PROP_BOOLEAN, PROP_NONE);
1610 RNA_def_property_boolean_sdna(prop, NULL, "flag", MOD_WAVE_X);
1611 RNA_def_property_ui_text(prop, "X", "X axis motion");
1612 RNA_def_property_update(prop, 0, "rna_Modifier_update");
1614 prop = RNA_def_property(srna, "use_y", PROP_BOOLEAN, PROP_NONE);
1615 RNA_def_property_boolean_sdna(prop, NULL, "flag", MOD_WAVE_Y);
1616 RNA_def_property_ui_text(prop, "Y", "Y axis motion");
1617 RNA_def_property_update(prop, 0, "rna_Modifier_update");
1619 prop = RNA_def_property(srna, "use_cyclic", PROP_BOOLEAN, PROP_NONE);
1620 RNA_def_property_boolean_sdna(prop, NULL, "flag", MOD_WAVE_CYCL);
1621 RNA_def_property_ui_text(prop, "Cyclic", "Cyclic wave effect");
1622 RNA_def_property_update(prop, 0, "rna_Modifier_update");
1624 prop = RNA_def_property(srna, "use_normal", PROP_BOOLEAN, PROP_NONE);
1625 RNA_def_property_boolean_sdna(prop, NULL, "flag", MOD_WAVE_NORM);
1626 RNA_def_property_ui_text(prop, "Normals", "Displace along normals");
1627 RNA_def_property_update(prop, 0, "rna_Modifier_update");
1629 prop = RNA_def_property(srna, "use_normal_x", PROP_BOOLEAN, PROP_NONE);
1630 RNA_def_property_boolean_sdna(prop, NULL, "flag", MOD_WAVE_NORM_X);
1631 RNA_def_property_ui_text(prop, "X Normal", "Enable displacement along the X normal");
1632 RNA_def_property_update(prop, 0, "rna_Modifier_update");
1634 prop = RNA_def_property(srna, "use_normal_y", PROP_BOOLEAN, PROP_NONE);
1635 RNA_def_property_boolean_sdna(prop, NULL, "flag", MOD_WAVE_NORM_Y);
1636 RNA_def_property_ui_text(prop, "Y Normal", "Enable displacement along the Y normal");
1637 RNA_def_property_update(prop, 0, "rna_Modifier_update");
1639 prop = RNA_def_property(srna, "use_normal_z", PROP_BOOLEAN, PROP_NONE);
1640 RNA_def_property_boolean_sdna(prop, NULL, "flag", MOD_WAVE_NORM_Z);
1641 RNA_def_property_ui_text(prop, "Z Normal", "Enable displacement along the Z normal");
1642 RNA_def_property_update(prop, 0, "rna_Modifier_update");
1644 prop = RNA_def_property(srna, "time_offset", PROP_FLOAT, PROP_NONE);
1645 RNA_def_property_float_sdna(prop, NULL, "timeoffs");
1646 RNA_def_property_range(prop, MINAFRAMEF, MAXFRAMEF);
1647 RNA_def_property_ui_text(prop, "Time Offset",
1648 "Either the starting frame (for positive speed) or ending frame (for negative speed.)");
1649 RNA_def_property_update(prop, 0, "rna_Modifier_update");
1651 prop = RNA_def_property(srna, "lifetime", PROP_FLOAT, PROP_TIME);
1652 RNA_def_property_float_sdna(prop, NULL, "lifetime");
1653 RNA_def_property_range(prop, MINAFRAMEF, MAXFRAMEF);
1654 RNA_def_property_ui_text(prop, "Lifetime", "Lifetime of the wave in frames, zero means infinite");
1655 RNA_def_property_update(prop, 0, "rna_Modifier_update");
1657 prop = RNA_def_property(srna, "damping_time", PROP_FLOAT, PROP_TIME);
1658 RNA_def_property_float_sdna(prop, NULL, "damp");
1659 RNA_def_property_range(prop, MINAFRAMEF, MAXFRAMEF);
1660 RNA_def_property_ui_text(prop, "Damping Time", "Number of frames in which the wave damps out after it dies");
1661 RNA_def_property_update(prop, 0, "rna_Modifier_update");
1663 prop = RNA_def_property(srna, "falloff_radius", PROP_FLOAT, PROP_DISTANCE);
1664 RNA_def_property_float_sdna(prop, NULL, "falloff");
1665 RNA_def_property_range(prop, 0, FLT_MAX);
1666 RNA_def_property_ui_range(prop, 0, 100, 100, 2);
1667 RNA_def_property_ui_text(prop, "Falloff Radius", "Distance after which it fades out");
1668 RNA_def_property_update(prop, 0, "rna_Modifier_update");
1670 prop = RNA_def_property(srna, "start_position_x", PROP_FLOAT, PROP_DISTANCE);
1671 RNA_def_property_float_sdna(prop, NULL, "startx");
1672 RNA_def_property_range(prop, -FLT_MAX, FLT_MAX);
1673 RNA_def_property_ui_range(prop, -100, 100, 100, 2);
1674 RNA_def_property_ui_text(prop, "Start Position X", "X coordinate of the start position");
1675 RNA_def_property_update(prop, 0, "rna_Modifier_update");
1677 prop = RNA_def_property(srna, "start_position_y", PROP_FLOAT, PROP_DISTANCE);
1678 RNA_def_property_float_sdna(prop, NULL, "starty");
1679 RNA_def_property_range(prop, -FLT_MAX, FLT_MAX);
1680 RNA_def_property_ui_range(prop, -100, 100, 100, 2);
1681 RNA_def_property_ui_text(prop, "Start Position Y", "Y coordinate of the start position");
1682 RNA_def_property_update(prop, 0, "rna_Modifier_update");
1684 prop = RNA_def_property(srna, "start_position_object", PROP_POINTER, PROP_NONE);
1685 RNA_def_property_pointer_sdna(prop, NULL, "objectcenter");
1686 RNA_def_property_ui_text(prop, "Start Position Object", "Object which defines the wave center");
1687 RNA_def_property_flag(prop, PROP_EDITABLE | PROP_ID_SELF_CHECK);
1688 RNA_def_property_update(prop, 0, "rna_Modifier_dependency_update");
1690 prop = RNA_def_property(srna, "vertex_group", PROP_STRING, PROP_NONE);
1691 RNA_def_property_string_sdna(prop, NULL, "defgrp_name");
1692 RNA_def_property_ui_text(prop, "Vertex Group", "Vertex group name for modulating the wave");
1693 RNA_def_property_string_funcs(prop, NULL, NULL, "rna_WaveModifier_defgrp_name_set");
1694 RNA_def_property_update(prop, 0, "rna_Modifier_update");
1696 prop = RNA_def_property(srna, "speed", PROP_FLOAT, PROP_NONE);
1697 RNA_def_property_range(prop, -FLT_MAX, FLT_MAX);
1698 RNA_def_property_ui_range(prop, -1, 1, 10, 2);
1699 RNA_def_property_ui_text(prop, "Speed", "Speed of the wave, towards the starting point when negative");
1700 RNA_def_property_update(prop, 0, "rna_Modifier_update");
1702 prop = RNA_def_property(srna, "height", PROP_FLOAT, PROP_DISTANCE);
1703 RNA_def_property_range(prop, -FLT_MAX, FLT_MAX);
1704 RNA_def_property_ui_range(prop, -2, 2, 10, 2);
1705 RNA_def_property_ui_text(prop, "Height", "Height of the wave");
1706 RNA_def_property_update(prop, 0, "rna_Modifier_update");
1708 prop = RNA_def_property(srna, "width", PROP_FLOAT, PROP_DISTANCE);
1709 RNA_def_property_range(prop, 0, FLT_MAX);
1710 RNA_def_property_ui_range(prop, 0, 5, 10, 2);
1711 RNA_def_property_ui_text(prop, "Width", "Distance between the waves");
1712 RNA_def_property_update(prop, 0, "rna_Modifier_update");
1714 prop = RNA_def_property(srna, "narrowness", PROP_FLOAT, PROP_DISTANCE);
1715 RNA_def_property_float_sdna(prop, NULL, "narrow");
1716 RNA_def_property_range(prop, 0, FLT_MAX);
1717 RNA_def_property_ui_range(prop, 0, 10, 10, 2);
1718 RNA_def_property_ui_text(prop, "Narrowness",
1719 "Distance between the top and the base of a wave, the higher the value, "
1720 "the more narrow the wave");
1721 RNA_def_property_update(prop, 0, "rna_Modifier_update");
1723 rna_def_modifier_generic_map_info(srna);
1726 static void rna_def_modifier_armature(BlenderRNA *brna)
1731 srna = RNA_def_struct(brna, "ArmatureModifier", "Modifier");
1732 RNA_def_struct_ui_text(srna, "Armature Modifier", "Armature deformation modifier");
1733 RNA_def_struct_sdna(srna, "ArmatureModifierData");
1734 RNA_def_struct_ui_icon(srna, ICON_MOD_ARMATURE);
1736 prop = RNA_def_property(srna, "object", PROP_POINTER, PROP_NONE);
1737 RNA_def_property_ui_text(prop, "Object", "Armature object to deform with");
1738 RNA_def_property_pointer_funcs(prop, NULL, "rna_ArmatureModifier_object_set", NULL, "rna_Armature_object_poll");
1739 RNA_def_property_flag(prop, PROP_EDITABLE | PROP_ID_SELF_CHECK);
1740 RNA_def_property_update(prop, 0, "rna_Modifier_dependency_update");
1742 prop = RNA_def_property(srna, "use_bone_envelopes", PROP_BOOLEAN, PROP_NONE);
1743 RNA_def_property_boolean_sdna(prop, NULL, "deformflag", ARM_DEF_ENVELOPE);
1744 RNA_def_property_ui_text(prop, "Use Bone Envelopes", "Bind Bone envelopes to armature modifier");
1745 RNA_def_property_update(prop, 0, "rna_Modifier_update");
1747 prop = RNA_def_property(srna, "use_vertex_groups", PROP_BOOLEAN, PROP_NONE);
1748 RNA_def_property_boolean_sdna(prop, NULL, "deformflag", ARM_DEF_VGROUP);
1749 RNA_def_property_ui_text(prop, "Use Vertex Groups", "Bind vertex groups to armature modifier");
1750 RNA_def_property_update(prop, 0, "rna_Modifier_update");
1752 prop = RNA_def_property(srna, "use_deform_preserve_volume", PROP_BOOLEAN, PROP_NONE);
1753 RNA_def_property_boolean_sdna(prop, NULL, "deformflag", ARM_DEF_QUATERNION);
1754 RNA_def_property_ui_text(prop, "Preserve Volume", "Deform rotation interpolation with quaternions");
1755 RNA_def_property_update(prop, 0, "rna_Modifier_update");
1757 prop = RNA_def_property(srna, "use_multi_modifier", PROP_BOOLEAN, PROP_NONE);
1758 RNA_def_property_boolean_sdna(prop, NULL, "multi", 0);
1759 RNA_def_property_ui_text(prop, "Multi Modifier",
1760 "Use same input as previous modifier, and mix results using overall vgroup");
1761 RNA_def_property_update(prop, 0, "rna_Modifier_update");
1763 prop = RNA_def_property(srna, "vertex_group", PROP_STRING, PROP_NONE);
1764 RNA_def_property_string_sdna(prop, NULL, "defgrp_name");
1765 RNA_def_property_ui_text(prop, "Vertex Group",
1766 "Name of Vertex Group which determines influence of modifier per point");
1767 RNA_def_property_string_funcs(prop, NULL, NULL, "rna_ArmatureModifier_defgrp_name_set");
1768 RNA_def_property_update(prop, 0, "rna_Modifier_update");
1770 prop = RNA_def_property(srna, "invert_vertex_group", PROP_BOOLEAN, PROP_NONE);
1771 RNA_def_property_boolean_sdna(prop, NULL, "deformflag", ARM_DEF_INVERT_VGROUP);
1772 RNA_def_property_ui_text(prop, "Invert", "Invert vertex group influence");
1773 RNA_def_property_update(prop, 0, "rna_Modifier_update");
1776 static void rna_def_modifier_hook(BlenderRNA *brna)
1781 srna = RNA_def_struct(brna, "HookModifier", "Modifier");
1782 RNA_def_struct_ui_text(srna, "Hook Modifier", "Hook modifier to modify the location of vertices");
1783 RNA_def_struct_sdna(srna, "HookModifierData");
1784 RNA_def_struct_ui_icon(srna, ICON_HOOK);
1786 prop = RNA_def_property(srna, "strength", PROP_FLOAT, PROP_NONE);
1787 RNA_def_property_float_sdna(prop, NULL, "force");
1788 RNA_def_property_range(prop, 0, 1);
1789 RNA_def_property_ui_text(prop, "Strength", "Relative force of the hook");
1790 RNA_def_property_update(prop, 0, "rna_Modifier_update");
1792 prop = RNA_def_property(srna, "falloff_type", PROP_ENUM, PROP_NONE);
1793 RNA_def_property_enum_items(prop, modifier_warp_falloff_items); /* share the enum */
1794 RNA_def_property_ui_text(prop, "Falloff Type", "");
1795 RNA_def_property_translation_context(prop, BLT_I18NCONTEXT_ID_CURVE); /* Abusing id_curve :/ */
1796 RNA_def_property_update(prop, 0, "rna_Modifier_update");
1798 prop = RNA_def_property(srna, "falloff_radius", PROP_FLOAT, PROP_DISTANCE);
1799 RNA_def_property_float_sdna(prop, NULL, "falloff");
1800 RNA_def_property_range(prop, 0, FLT_MAX);
1801 RNA_def_property_ui_range(prop, 0, 100, 100, 2);
1802 RNA_def_property_ui_text(prop, "Radius", "If not zero, the distance from the hook where influence ends");
1803 RNA_def_property_update(prop, 0, "rna_Modifier_update");
1805 prop = RNA_def_property(srna, "falloff_curve", PROP_POINTER, PROP_NONE);
1806 RNA_def_property_pointer_sdna(prop, NULL, "curfalloff");
1807 RNA_def_property_ui_text(prop, "Falloff Curve", "Custom Lamp Falloff Curve");
1808 RNA_def_property_update(prop, 0, "rna_Modifier_update");
1810 prop = RNA_def_property(srna, "center", PROP_FLOAT, PROP_NONE);
1811 RNA_def_property_float_sdna(prop, NULL, "cent");
1812 RNA_def_property_ui_text(prop, "Hook Center", "");
1813 RNA_def_property_update(prop, 0, "rna_Modifier_update");
1815 prop = RNA_def_property(srna, "object", PROP_POINTER, PROP_NONE);
1816 RNA_def_property_ui_text(prop, "Object", "Parent Object for hook, also recalculates and clears offset");
1817 RNA_def_property_flag(prop, PROP_EDITABLE | PROP_ID_SELF_CHECK);
1818 RNA_def_property_pointer_funcs(prop, NULL, "rna_HookModifier_object_set", NULL, NULL);
1819 RNA_def_property_update(prop, 0, "rna_Modifier_dependency_update");
1821 prop = RNA_def_property(srna, "subtarget", PROP_STRING, PROP_NONE);
1822 RNA_def_property_string_sdna(prop, NULL, "subtarget");
1823 RNA_def_property_ui_text(prop, "Sub-Target",
1824 "Name of Parent Bone for hook (if applicable), also recalculates and clears offset");
1825 RNA_def_property_update(prop, 0, "rna_Modifier_dependency_update");
1827 prop = RNA_def_property(srna, "use_falloff_uniform", PROP_BOOLEAN, PROP_NONE);
1828 RNA_def_property_boolean_sdna(prop, NULL, "flag", MOD_HOOK_UNIFORM_SPACE);
1829 RNA_def_property_ui_text(prop, "Uniform Falloff", "Compensate for non-uniform object scale");
1830 RNA_def_property_update(prop, 0, "rna_Modifier_update");
1832 prop = RNA_def_property(srna, "vertex_group", PROP_STRING, PROP_NONE);
1833 RNA_def_property_string_sdna(prop, NULL, "name");
1834 RNA_def_property_ui_text(prop, "Vertex Group",
1835 "Name of Vertex Group which determines influence of modifier per point");
1836 RNA_def_property_string_funcs(prop, NULL, NULL, "rna_HookModifier_name_set");
1837 RNA_def_property_update(prop, 0, "rna_Modifier_update");
1840 static void rna_def_modifier_softbody(BlenderRNA *brna)
1845 srna = RNA_def_struct(brna, "SoftBodyModifier", "Modifier");
1846 RNA_def_struct_ui_text(srna, "Soft Body Modifier", "Soft body simulation modifier");
1847 RNA_def_struct_sdna(srna, "SoftbodyModifierData");
1848 RNA_def_struct_ui_icon(srna, ICON_MOD_SOFT);
1850 prop = RNA_def_property(srna, "settings", PROP_POINTER, PROP_NONE);
1851 RNA_def_property_flag(prop, PROP_NEVER_NULL);
1852 RNA_def_property_struct_type(prop, "SoftBodySettings");
1853 RNA_def_property_pointer_funcs(prop, "rna_SoftBodyModifier_settings_get", NULL, NULL, NULL);
1854 RNA_def_property_ui_text(prop, "Soft Body Settings", "");
1857 static void rna_def_modifier_boolean(BlenderRNA *brna)
1862 static EnumPropertyItem prop_operation_items[] = {
1863 {eBooleanModifierOp_Intersect, "INTERSECT", 0, "Intersect",
1864 "Keep the part of the mesh that intersects with the other selected object"},
1865 {eBooleanModifierOp_Union, "UNION", 0, "Union", "Combine two meshes in an additive way"},
1866 {eBooleanModifierOp_Difference, "DIFFERENCE", 0, "Difference", "Combine two meshes in a subtractive way"},
1867 {0, NULL, 0, NULL, NULL}
1870 srna = RNA_def_struct(brna, "BooleanModifier", "Modifier");
1871 RNA_def_struct_ui_text(srna, "Boolean Modifier", "Boolean operations modifier");
1872 RNA_def_struct_sdna(srna, "BooleanModifierData");
1873 RNA_def_struct_ui_icon(srna, ICON_MOD_BOOLEAN);
1875 prop = RNA_def_property(srna, "object", PROP_POINTER, PROP_NONE);
1876 RNA_def_property_ui_text(prop, "Object", "Mesh object to use for Boolean operation");
1877 RNA_def_property_pointer_funcs(prop, NULL, "rna_BooleanModifier_object_set", NULL, "rna_Mesh_object_poll");
1878 RNA_def_property_flag(prop, PROP_EDITABLE | PROP_ID_SELF_CHECK);
1879 RNA_def_property_update(prop, 0, "rna_Modifier_dependency_update");
1881 prop = RNA_def_property(srna, "operation", PROP_ENUM, PROP_NONE);
1882 RNA_def_property_enum_items(prop, prop_operation_items);
1883 RNA_def_property_ui_text(prop, "Operation", "");
1884 RNA_def_property_update(prop, 0, "rna_Modifier_update");
1886 #if 0 /* WITH_MOD_BOOLEAN */
1887 /* BMesh intersection options */
1888 prop = RNA_def_property(srna, "use_bmesh", PROP_BOOLEAN, PROP_NONE);
1889 RNA_def_property_boolean_sdna(prop, NULL, "bm_flag", eBooleanModifierBMeshFlag_Enabled);
1890 RNA_def_property_ui_text(prop, "Use BMesh", "Use BMesh boolean calculation");
1891 RNA_def_property_update(prop, 0, "rna_Modifier_update");
1893 prop = RNA_def_property(srna, "use_bmesh_separate", PROP_BOOLEAN, PROP_NONE);
1894 RNA_def_property_boolean_sdna(prop, NULL, "bm_flag", eBooleanModifierBMeshFlag_BMesh_Separate);
1895 RNA_def_property_ui_text(prop, "Separate", "Keep edges separate");
1896 RNA_def_property_update(prop, 0, "rna_Modifier_update");
1898 prop = RNA_def_property(srna, "use_bmesh_dissolve", PROP_BOOLEAN, PROP_NONE);
1899 RNA_def_property_boolean_negative_sdna(prop, NULL, "bm_flag", eBooleanModifierBMeshFlag_BMesh_NoDissolve);
1900 RNA_def_property_ui_text(prop, "Dissolve", "Dissolve verts created from tessellated intersection");
1901 RNA_def_property_update(prop, 0, "rna_Modifier_update");
1903 prop = RNA_def_property(srna, "use_bmesh_connect_regions", PROP_BOOLEAN, PROP_NONE);
1904 RNA_def_property_boolean_negative_sdna(prop, NULL, "bm_flag", eBooleanModifierBMeshFlag_BMesh_NoConnectRegions);
1905 RNA_def_property_ui_text(prop, "Calculate Holes", "Connect regions (needed for hole filling)");
1906 RNA_def_property_update(prop, 0, "rna_Modifier_update");
1908 prop = RNA_def_property(srna, "threshold", PROP_FLOAT, PROP_DISTANCE);
1909 RNA_def_property_float_sdna(prop, NULL, "threshold");
1910 RNA_def_property_range(prop, 0, 1.0f);
1911 RNA_def_property_ui_range(prop, 0, 1, 1, 7);
1912 RNA_def_property_ui_text(prop, "Threshold", "");
1913 RNA_def_property_update(prop, 0, "rna_Modifier_update");
1917 static void rna_def_modifier_array(BlenderRNA *brna)
1922 static EnumPropertyItem prop_fit_type_items[] = {
1923 {MOD_ARR_FIXEDCOUNT, "FIXED_COUNT", 0, "Fixed Count", "Duplicate the object a certain number of times"},
1924 {MOD_ARR_FITLENGTH, "FIT_LENGTH", 0, "Fit Length",
1925 "Duplicate the object as many times as fits in a certain length"},
1926 {MOD_ARR_FITCURVE, "FIT_CURVE", 0, "Fit Curve", "Fit the duplicated objects to a curve"},
1927 {0, NULL, 0, NULL, NULL}
1930 srna = RNA_def_struct(brna, "ArrayModifier", "Modifier");
1931 RNA_def_struct_ui_text(srna, "Array Modifier", "Array duplication modifier");
1932 RNA_def_struct_sdna(srna, "ArrayModifierData");
1933 RNA_def_struct_ui_icon(srna, ICON_MOD_ARRAY);
1935 /* Length parameters */
1936 prop = RNA_def_property(srna, "fit_type", PROP_ENUM, PROP_NONE);
1937 RNA_def_property_enum_items(prop, prop_fit_type_items);
1938 RNA_def_property_ui_text(prop, "Fit Type", "Array length calculation method");
1939 RNA_def_property_update(prop, 0, "rna_Modifier_update");
1941 prop = RNA_def_property(srna, "count", PROP_INT, PROP_NONE);
1942 RNA_def_property_range(prop, 1, INT_MAX);
1943 RNA_def_property_ui_range(prop, 1, 1000, 1, -1);
1944 RNA_def_property_ui_text(prop, "Count", "Number of duplicates to make");
1945 RNA_def_property_update(prop, 0, "rna_Modifier_update");
1947 prop = RNA_def_property(srna, "fit_length", PROP_FLOAT, PROP_DISTANCE);
1948 RNA_def_property_float_sdna(prop, NULL, "length");
1949 RNA_def_property_range(prop, 0, INT_MAX);
1950 RNA_def_property_ui_range(prop, 0, 10000, 10, 2);
1951 RNA_def_property_ui_text(prop, "Length", "Length to fit array within");
1952 RNA_def_property_update(prop, 0, "rna_Modifier_update");
1954 prop = RNA_def_property(srna, "curve", PROP_POINTER, PROP_NONE);
1955 RNA_def_property_pointer_sdna(prop, NULL, "curve_ob");
1956 RNA_def_property_ui_text(prop, "Curve", "Curve object to fit array length to");
1957 RNA_def_property_pointer_funcs(prop, NULL, "rna_ArrayModifier_curve_ob_set", NULL, "rna_Curve_object_poll");
1958 RNA_def_property_flag(prop, PROP_EDITABLE | PROP_ID_SELF_CHECK);
1959 RNA_def_property_update(prop, 0, "rna_ArrayModifier_dependency_update");
1961 /* Offset parameters */
1962 prop = RNA_def_property(srna, "use_constant_offset", PROP_BOOLEAN, PROP_NONE);
1963 RNA_def_property_boolean_sdna(prop, NULL, "offset_type", MOD_ARR_OFF_CONST);
1964 RNA_def_property_ui_text(prop, "Constant Offset", "Add a constant offset");
1965 RNA_def_property_update(prop, 0, "rna_Modifier_update");
1967 prop = RNA_def_property(srna, "constant_offset_displace", PROP_FLOAT, PROP_TRANSLATION);
1968 RNA_def_property_float_sdna(prop, NULL, "offset");
1969 RNA_def_property_ui_text(prop, "Constant Offset Displacement", "Value for the distance between arrayed items");
1970 RNA_def_property_ui_range(prop, -FLT_MAX, FLT_MAX, 1, RNA_TRANSLATION_PREC_DEFAULT);
1971 RNA_def_property_update(prop, 0, "rna_Modifier_update");
1973 prop = RNA_def_property(srna, "use_relative_offset", PROP_BOOLEAN, PROP_NONE);
1974 RNA_def_property_boolean_sdna(prop, NULL, "offset_type", MOD_ARR_OFF_RELATIVE);
1975 RNA_def_property_ui_text(prop, "Relative Offset", "Add an offset relative to the object's bounding box");
1976 RNA_def_property_update(prop, 0, "rna_Modifier_update");
1978 /* PROP_TRANSLATION causes units to be used which we don't want */
1979 prop = RNA_def_property(srna, "relative_offset_displace", PROP_FLOAT, PROP_NONE);
1980 RNA_def_property_float_sdna(prop, NULL, "scale");
1981 RNA_def_property_ui_text(prop, "Relative Offset Displacement",
1982 "The size of the geometry will determine the distance between arrayed items");
1983 RNA_def_property_update(prop, 0, "rna_Modifier_update");
1985 /* Vertex merging parameters */
1986 prop = RNA_def_property(srna, "use_merge_vertices", PROP_BOOLEAN, PROP_NONE);
1987 RNA_def_property_boolean_sdna(prop, NULL, "flags", MOD_ARR_MERGE);
1988 RNA_def_property_ui_text(prop, "Merge Vertices", "Merge vertices in adjacent duplicates");
1989 RNA_def_property_update(prop, 0, "rna_Modifier_update");
1991 prop = RNA_def_property(srna, "use_merge_vertices_cap", PROP_BOOLEAN, PROP_NONE);
1992 RNA_def_property_boolean_sdna(prop, NULL, "flags", MOD_ARR_MERGEFINAL);
1993 RNA_def_property_ui_text(prop, "Merge Vertices", "Merge vertices in first and last duplicates");
1994 RNA_def_property_update(prop, 0, "rna_Modifier_update");
1996 prop = RNA_def_property(srna, "merge_threshold", PROP_FLOAT, PROP_DISTANCE);
1997 RNA_def_property_float_sdna(prop, NULL, "merge_dist");
1998 RNA_def_property_range(prop, 0, FLT_MAX);
1999 RNA_def_property_ui_range(prop, 0, 1, 1, 4);
2000 RNA_def_property_ui_text(prop, "Merge Distance", "Limit below which to merge vertices");
2001 RNA_def_property_update(prop, 0, "rna_Modifier_update");
2004 prop = RNA_def_property(srna, "use_object_offset", PROP_BOOLEAN, PROP_NONE);
2005 RNA_def_property_boolean_sdna(prop, NULL, "offset_type", MOD_ARR_OFF_OBJ);
2006 RNA_def_property_ui_text(prop, "Object Offset", "Add another object's transformation to the total offset");
2007 RNA_def_property_update(prop, 0, "rna_Modifier_update");
2009 prop = RNA_def_property(srna, "offset_object", PROP_POINTER, PROP_NONE);
2010 RNA_def_property_pointer_sdna(prop, NULL, "offset_ob");
2011 RNA_def_property_ui_text(prop, "Object Offset",
2012 "Use the location and rotation of another object to determine the distance and "
2013 "rotational change between arrayed items");
2014 RNA_def_property_flag(prop, PROP_EDITABLE | PROP_ID_SELF_CHECK);
2015 RNA_def_property_update(prop, 0, "rna_Modifier_dependency_update");
2018 prop = RNA_def_property(srna, "start_cap", PROP_POINTER, PROP_NONE);
2019 RNA_def_property_ui_text(prop, "Start Cap", "Mesh object to use as a start cap");
2020 RNA_def_property_pointer_funcs(prop, NULL, "rna_ArrayModifier_start_cap_set", NULL, "rna_Mesh_object_poll");
2021 RNA_def_property_flag(prop, PROP_EDITABLE | PROP_ID_SELF_CHECK);
2022 RNA_def_property_update(prop, 0, "rna_Modifier_update");
2024 prop = RNA_def_property(srna, "end_cap", PROP_POINTER, PROP_NONE);
2025 RNA_def_property_ui_text(prop, "End Cap", "Mesh object to use as an end cap");
2026 RNA_def_property_pointer_funcs(prop, NULL, "rna_ArrayModifier_end_cap_set", NULL, "rna_Mesh_object_poll");
2027 RNA_def_property_flag(prop, PROP_EDITABLE | PROP_ID_SELF_CHECK);
2028 RNA_def_property_update(prop, 0, "rna_Modifier_dependency_update");
2031 static void rna_def_modifier_edgesplit(BlenderRNA *brna)
2036 srna = RNA_def_struct(brna, "EdgeSplitModifier", "Modifier");
2037 RNA_def_struct_ui_text(srna, "EdgeSplit Modifier", "Edge splitting modifier to create sharp edges");
2038 RNA_def_struct_sdna(srna, "EdgeSplitModifierData");
2039 RNA_def_struct_ui_icon(srna, ICON_MOD_EDGESPLIT);
2041 prop = RNA_def_property(srna, "split_angle", PROP_FLOAT, PROP_ANGLE);
2042 RNA_def_property_range(prop, 0.0f, DEG2RADF(180.0f));
2043 RNA_def_property_ui_range(prop, 0.0f, DEG2RADF(180.0f), 10, 2);
2044 RNA_def_property_ui_text(prop, "Split Angle", "Angle above which to split edges");
2045 RNA_def_property_update(prop, 0, "rna_Modifier_update");
2047 prop = RNA_def_property(srna, "use_edge_angle", PROP_BOOLEAN, PROP_NONE);
2048 RNA_def_property_boolean_sdna(prop, NULL, "flags", MOD_EDGESPLIT_FROMANGLE);
2049 RNA_def_property_ui_text(prop, "Use Edge Angle", "Split edges with high angle between faces");
2050 RNA_def_property_update(prop, 0, "rna_Modifier_update");
2052 prop = RNA_def_property(srna, "use_edge_sharp", PROP_BOOLEAN, PROP_NONE);
2053 RNA_def_property_boolean_sdna(prop, NULL, "flags", MOD_EDGESPLIT_FROMFLAG);
2054 RNA_def_property_ui_text(prop, "Use Sharp Edges", "Split edges that are marked as sharp");
2055 RNA_def_property_update(prop, 0, "rna_Modifier_update");
2058 static void rna_def_modifier_displace(BlenderRNA *brna)
2063 static EnumPropertyItem prop_direction_items[] = {
2064 {MOD_DISP_DIR_X, "X", 0, "X", "Use the texture's intensity value to displace in the X direction"},
2065 {MOD_DISP_DIR_Y, "Y", 0, "Y", "Use the texture's intensity value to displace in the Y direction"},
2066 {MOD_DISP_DIR_Z, "Z", 0, "Z", "Use the texture's intensity value to displace in the Z direction"},
2067 {MOD_DISP_DIR_NOR, "NORMAL", 0, "Normal",
2068 "Use the texture's intensity value to displace along the vertex normal"},
2069 {MOD_DISP_DIR_CLNOR, "CUSTOM_NORMAL", 0, "Custom Normal",
2070 "Use the texture's intensity value to displace along the (averaged) custom normal (falls back to vertex)"},
2071 {MOD_DISP_DIR_RGB_XYZ, "RGB_TO_XYZ", 0, "RGB to XYZ",
2072 "Use the texture's RGB values to displace the mesh in the XYZ direction"},
2073 {0, NULL, 0, NULL, NULL}
2076 srna = RNA_def_struct(brna, "DisplaceModifier", "Modifier");
2077 RNA_def_struct_ui_text(srna, "Displace Modifier", "Displacement modifier");
2078 RNA_def_struct_sdna(srna, "DisplaceModifierData");
2079 RNA_def_struct_ui_icon(srna, ICON_MOD_DISPLACE);
2081 prop = RNA_def_property(srna, "vertex_group", PROP_STRING, PROP_NONE);
2082 RNA_def_property_string_sdna(prop, NULL, "defgrp_name");
2083 RNA_def_property_ui_text(prop, "Vertex Group",
2084 "Name of Vertex Group which determines influence of modifier per point");
2085 RNA_def_property_string_funcs(prop, NULL, NULL, "rna_DisplaceModifier_defgrp_name_set");
2086 RNA_def_property_update(prop, 0, "rna_Modifier_update");
2088 prop = RNA_def_property(srna, "mid_level", PROP_FLOAT, PROP_FACTOR);
2089 RNA_def_property_float_sdna(prop, NULL, "midlevel");
2090 RNA_def_property_range(prop, -FLT_MAX, FLT_MAX);
2091 RNA_def_property_ui_range(prop, 0, 1, 10, 3);
2092 RNA_def_property_ui_text(prop, "Midlevel", "Material value that gives no displacement");
2093 RNA_def_property_update(prop, 0, "rna_Modifier_update");
2095 prop = RNA_def_property(srna, "strength", PROP_FLOAT, PROP_NONE);
2096 RNA_def_property_range(prop, -FLT_MAX, FLT_MAX);
2097 RNA_def_property_ui_range(prop, -100, 100, 10, 3);
2098 RNA_def_property_ui_text(prop, "Strength", "Amount to displace geometry");
2099 RNA_def_property_update(prop, 0, "rna_Modifier_update");
2101 prop = RNA_def_property(srna, "direction", PROP_ENUM, PROP_NONE);
2102 RNA_def_property_enum_items(prop, prop_direction_items);
2103 RNA_def_property_ui_text(prop, "Direction", "");
2104 RNA_def_property_update(prop, 0, "rna_Modifier_update");
2106 rna_def_modifier_generic_map_info(srna);
2109 static void rna_def_modifier_uvproject(BlenderRNA *brna)
2114 srna = RNA_def_struct(brna, "UVProjectModifier", "Modifier");
2115 RNA_def_struct_ui_text(srna, "UV Project Modifier", "UV projection modifier to set UVs from a projector");
2116 RNA_def_struct_sdna(srna, "UVProjectModifierData");
2117 RNA_def_struct_ui_icon(srna, ICON_MOD_UVPROJECT);
2119 prop = RNA_def_property(srna, "uv_layer", PROP_STRING, PROP_NONE);
2120 RNA_def_property_string_sdna(prop, NULL, "uvlayer_name");
2121 RNA_def_property_ui_text(prop, "UV Map", "UV map name");
2122 RNA_def_property_string_funcs(prop, NULL, NULL, "rna_UVProjectModifier_uvlayer_name_set");
2123 RNA_def_property_update(prop, 0, "rna_Modifier_update");
2125 prop = RNA_def_property(srna, "projector_count", PROP_INT, PROP_NONE);
2126 RNA_def_property_int_sdna(prop, NULL, "num_projectors");
2127 RNA_def_property_ui_text(prop, "Number of Projectors", "Number of projectors to use");
2128 RNA_def_property_int_funcs(prop, NULL, "rna_UVProjectModifier_num_projectors_set", NULL);
2129 RNA_def_property_range(prop, 1, MOD_UVPROJECT_MAXPROJECTORS);
2130 RNA_def_property_update(prop, 0, "rna_Modifier_update");
2132 prop = RNA_def_property(srna, "projectors", PROP_COLLECTION, PROP_NONE);
2133 RNA_def_property_struct_type(prop, "UVProjector");
2134 RNA_def_property_collection_funcs(prop, "rna_UVProject_projectors_begin", "rna_iterator_array_next",
2135 "rna_iterator_array_end", "rna_iterator_array_get", NULL, NULL, NULL, NULL);
2136 RNA_def_property_ui_text(prop, "Projectors", "");
2138 prop = RNA_def_property(srna, "image", PROP_POINTER, PROP_NONE);
2139 RNA_def_property_ui_text(prop, "Image", "");
2140 RNA_def_property_flag(prop, PROP_EDITABLE);
2141 RNA_def_property_update(prop, 0, "rna_Modifier_update");
2143 prop = RNA_def_property(srna, "aspect_x", PROP_FLOAT, PROP_NONE);
2144 RNA_def_property_float_sdna(prop, NULL, "aspectx");
2145 RNA_def_property_flag(prop, PROP_PROPORTIONAL);
2146 RNA_def_property_range(prop, 1, FLT_MAX);
2147 RNA_def_property_ui_range(prop, 1, 1000, 1, 3);
2148 RNA_def_property_ui_text(prop, "Horizontal Aspect Ratio", "");
2149 RNA_def_property_update(prop, 0, "rna_Modifier_update");
2151 prop = RNA_def_property(srna, "aspect_y", PROP_FLOAT, PROP_NONE);
2152 RNA_def_property_float_sdna(prop, NULL, "aspecty");
2153 RNA_def_property_flag(prop, PROP_PROPORTIONAL);
2154 RNA_def_property_range(prop, 1, FLT_MAX);
2155 RNA_def_property_ui_range(prop, 1, 1000, 1, 3);
2156 RNA_def_property_ui_text(prop, "Vertical Aspect Ratio", "");
2157 RNA_def_property_update(prop, 0, "rna_Modifier_update");
2159 prop = RNA_def_property(srna, "scale_x", PROP_FLOAT, PROP_NONE);
2160 RNA_def_property_float_sdna(prop, NULL, "scalex");
2161 RNA_def_property_flag(prop, PROP_PROPORTIONAL);
2162 RNA_def_property_range(prop, 0, FLT_MAX);
2163 RNA_def_property_ui_range(prop, 0, 1000, 1, 3);
2164 RNA_def_property_ui_text(prop, "Horizontal Scale", "");
2165 RNA_def_property_update(prop, 0, "rna_Modifier_update");
2167 prop = RNA_def_property(srna, "scale_y", PROP_FLOAT, PROP_NONE);
2168 RNA_def_property_float_sdna(prop, NULL, "scaley");
2169 RNA_def_property_flag(prop, PROP_PROPORTIONAL);
2170 RNA_def_property_range(prop, 0, FLT_MAX);
2171 RNA_def_property_ui_range(prop, 0, 1000, 1, 3);
2172 RNA_def_property_ui_text(prop, "Vertical Scale", "");
2173 RNA_def_property_update(prop, 0, "rna_Modifier_update");
2175 prop = RNA_def_property(srna, "use_image_override", PROP_BOOLEAN, PROP_NONE);
2176 RNA_def_property_boolean_sdna(prop, NULL, "flags", MOD_UVPROJECT_OVERRIDEIMAGE);
2177 RNA_def_property_ui_text(prop, "Override Image", "Override faces' current images with the given image");
2178 RNA_def_property_update(prop, 0, "rna_Modifier_update");
2180 srna = RNA_def_struct(brna, "UVProjector", NULL);
2181 RNA_def_struct_ui_text(srna, "UVProjector", "UV projector used by the UV project modifier");
2183 prop = RNA_def_property(srna, "object", PROP_POINTER, PROP_NONE);
2184 RNA_def_property_struct_type(prop, "Object");
2185 RNA_def_property_pointer_funcs(prop, "rna_UVProjector_object_get", "rna_UVProjector_object_set", NULL, NULL);
2186 RNA_def_property_flag(prop, PROP_EDITABLE | PROP_ID_SELF_CHECK);
2187 RNA_def_property_ui_text(prop, "Object", "Object to use as projector transform");
2188 RNA_def_property_update(prop, 0, "rna_Modifier_dependency_update");
2191 static void rna_def_modifier_smooth(BlenderRNA *brna)
2196 srna = RNA_def_struct(brna, "SmoothModifier", "Modifier");
2197 RNA_def_struct_ui_text(srna, "Smooth Modifier", "Smoothing effect modifier");
2198 RNA_def_struct_sdna(srna, "SmoothModifierData");
2199 RNA_def_struct_ui_icon(srna, ICON_MOD_SMOOTH);
2201 prop = RNA_def_property(srna, "use_x", PROP_BOOLEAN, PROP_NONE);
2202 RNA_def_property_boolean_sdna(prop, NULL, "flag", MOD_SMOOTH_X);
2203 RNA_def_property_ui_text(prop, "X", "Smooth object along X axis");
2204 RNA_def_property_update(prop, 0, "rna_Modifier_update");
2206 prop = RNA_def_property(srna, "use_y", PROP_BOOLEAN, PROP_NONE);
2207 RNA_def_property_boolean_sdna(prop, NULL, "flag", MOD_SMOOTH_Y);
2208 RNA_def_property_ui_text(prop, "Y", "Smooth object along Y axis");
2209 RNA_def_property_update(prop, 0, "rna_Modifier_update");
2211 prop = RNA_def_property(srna, "use_z", PROP_BOOLEAN, PROP_NONE);
2212 RNA_def_property_boolean_sdna(prop, NULL, "flag", MOD_SMOOTH_Z);
2213 RNA_def_property_ui_text(prop, "Z", "Smooth object along Z axis");
2214 RNA_def_property_update(prop, 0, "rna_Modifier_update");
2216 prop = RNA_def_property(srna, "factor", PROP_FLOAT, PROP_NONE);
2217 RNA_def_property_float_sdna(prop, NULL, "fac");
2218 RNA_def_property_range(prop, -FLT_MAX, FLT_MAX);
2219 RNA_def_property_ui_range(prop, -10, 10, 1, 3);
2220 RNA_def_property_ui_text(prop, "Factor", "Strength of modifier effect");
2221 RNA_def_property_update(prop, 0, "rna_Modifier_update");
2223 prop = RNA_def_property(srna, "iterations", PROP_INT, PROP_NONE);
2224 RNA_def_property_int_sdna(prop, NULL, "repeat");
2225 RNA_def_property_ui_range(prop, 0, 30, 1, -1);
2226 RNA_def_property_ui_text(prop, "Repeat", "");
2227 RNA_def_property_update(prop, 0, "rna_Modifier_update");
2229 prop = RNA_def_property(srna, "vertex_group", PROP_STRING, PROP_NONE);
2230 RNA_def_property_string_sdna(prop, NULL, "defgrp_name");
2231 RNA_def_property_ui_text(prop, "Vertex Group",
2232 "Name of Vertex Group which determines influence of modifier per point");
2233 RNA_def_property_string_funcs(prop, NULL, NULL, "rna_SmoothModifier_defgrp_name_set");
2234 RNA_def_property_update(prop, 0, "rna_Modifier_update");
2238 static void rna_def_modifier_correctivesmooth(BlenderRNA *brna)
2243 static EnumPropertyItem modifier_smooth_type_items[] = {
2244 {MOD_CORRECTIVESMOOTH_SMOOTH_SIMPLE, "SIMPLE", 0, "Simple",
2245 "Use the average of adjacent edge-vertices"},
2246 {MOD_CORRECTIVESMOOTH_SMOOTH_LENGTH_WEIGHT, "LENGTH_WEIGHTED", 0, "Length Weight",
2247 "Use the average of adjacent edge-vertices weighted by their length"},
2248 {0, NULL, 0, NULL, NULL}
2251 static EnumPropertyItem modifier_rest_source_items[] = {
2252 {MOD_CORRECTIVESMOOTH_RESTSOURCE_ORCO, "ORCO", 0, "Original Coords",
2253 "Use base mesh vert coords as the rest position"},
2254 {MOD_CORRECTIVESMOOTH_RESTSOURCE_BIND, "BIND", 0, "Bind Coords",
2255 "Use bind vert coords for rest position"},
2256 {0, NULL, 0, NULL, NULL}
2259 srna = RNA_def_struct(brna, "CorrectiveSmoothModifier", "Modifier");
2260 RNA_def_struct_ui_text(srna, "Corrective Smooth Modifier", "Correct distortion caused by deformation");
2261 RNA_def_struct_sdna(srna, "CorrectiveSmoothModifierData");
2262 RNA_def_struct_ui_icon(srna, ICON_MOD_SMOOTH);
2264 prop = RNA_def_property(srna, "factor", PROP_FLOAT, PROP_NONE);
2265 RNA_def_property_float_sdna(prop, NULL, "lambda");
2266 RNA_def_property_range(prop, -FLT_MAX, FLT_MAX);
2267 RNA_def_property_ui_range(prop, 0.0, 1.0, 5, 3);
2268 RNA_def_property_ui_text(prop, "Lambda Factor", "Smooth factor effect");
2269 RNA_def_property_update(prop, 0, "rna_CorrectiveSmoothModifier_update");
2271 prop = RNA_def_property(srna, "iterations", PROP_INT, PROP_NONE);
2272 RNA_def_property_int_sdna(prop, NULL, "repeat");
2273 RNA_def_property_ui_range(prop, 0, 200, 1, -1);
2274 RNA_def_property_ui_text(prop, "Repeat", "");
2275 RNA_def_property_update(prop, 0, "rna_CorrectiveSmoothModifier_update");
2277 prop = RNA_def_property(srna, "rest_source", PROP_ENUM, PROP_NONE);
2278 RNA_def_property_enum_sdna(prop, NULL, "rest_source");
2279 RNA_def_property_enum_items(prop, modifier_rest_source_items);
2280 RNA_def_property_ui_text(prop, "Rest Source", "Select the source of rest positions");
2281 RNA_def_property_update(prop, 0, "rna_CorrectiveSmoothModifier_rest_source_update");
2283 prop = RNA_def_property(srna, "smooth_type", PROP_ENUM, PROP_NONE);
2284 RNA_def_property_enum_sdna(prop, NULL, "smooth_type");
2285 RNA_def_property_enum_items(prop, modifier_smooth_type_items);
2286 RNA_def_property_ui_text(prop, "Smooth Type", "Method used for smoothing");
2287 RNA_def_property_update(prop, 0, "rna_CorrectiveSmoothModifier_update");
2289 prop = RNA_def_property(srna, "invert_vertex_group", PROP_BOOLEAN, PROP_NONE);
2290 RNA_def_property_boolean_sdna(prop, NULL, "flag", MOD_CORRECTIVESMOOTH_INVERT_VGROUP);
2291 RNA_def_property_ui_text(prop, "Invert", "Invert vertex group influence");
2292 RNA_def_property_update(prop, 0, "rna_CorrectiveSmoothModifier_update");
2294 prop = RNA_def_property(srna, "vertex_group", PROP_STRING, PROP_NONE);
2295 RNA_def_property_string_sdna(prop, NULL, "defgrp_name");
2296 RNA_def_property_ui_text(prop, "Vertex Group",
2297 "Name of Vertex Group which determines influence of modifier per point");
2298 RNA_def_property_string_funcs(prop, NULL, NULL, "rna_CorrectiveSmoothModifier_defgrp_name_set");
2299 RNA_def_property_update(prop, 0, "rna_CorrectiveSmoothModifier_update");
2301 prop = RNA_def_property(srna, "is_bind", PROP_BOOLEAN, PROP_NONE);
2302 RNA_def_property_ui_text(prop, "Bind current shape", "");
2303 RNA_def_property_boolean_funcs(prop, "rna_CorrectiveSmoothModifier_is_bind_get", NULL);
2304 RNA_def_property_clear_flag(prop, PROP_EDITABLE);
2305 RNA_def_property_update(prop, 0, "rna_Modifier_update");
2307 prop = RNA_def_property(srna, "use_only_smooth", PROP_BOOLEAN, PROP_NONE);
2308 RNA_def_property_boolean_sdna(prop, NULL, "flag", MOD_CORRECTIVESMOOTH_ONLY_SMOOTH);
2309 RNA_def_property_ui_text(prop, "Only Smooth",
2310 "Apply smoothing without reconstructing the surface");
2311 RNA_def_property_update(prop, 0, "rna_Modifier_update");
2313 prop = RNA_def_property(srna, "use_pin_boundary", PROP_BOOLEAN, PROP_NONE);
2314 RNA_def_property_boolean_sdna(prop, NULL, "flag", MOD_CORRECTIVESMOOTH_PIN_BOUNDARY);
2315 RNA_def_property_ui_text(prop, "Pin Boundaries",
2316 "Excludes boundary vertices from being smoothed");
2317 RNA_def_property_update(prop, 0, "rna_CorrectiveSmoothModifier_update");
2321 static void rna_def_modifier_laplaciansmooth(BlenderRNA *brna)
2326 srna = RNA_def_struct(brna, "LaplacianSmoothModifier", "Modifier");
2327 RNA_def_struct_ui_text(srna, "Laplacian Smooth Modifier", "Smoothing effect modifier");
2328 RNA_def_struct_sdna(srna, "LaplacianSmoothModifierData");
2329 RNA_def_struct_ui_icon(srna, ICON_MOD_SMOOTH);
2331 prop = RNA_def_property(srna, "use_x", PROP_BOOLEAN, PROP_NONE);
2332 RNA_def_property_boolean_sdna(prop, NULL, "flag", MOD_LAPLACIANSMOOTH_X);
2333 RNA_def_property_ui_text(prop, "X", "Smooth object along X axis");
2334 RNA_def_property_update(prop, 0, "rna_Modifier_update");
2336 prop = RNA_def_property(srna, "use_y", PROP_BOOLEAN, PROP_NONE);
2337 RNA_def_property_boolean_sdna(prop, NULL, "flag", MOD_LAPLACIANSMOOTH_Y);
2338 RNA_def_property_ui_text(prop, "Y", "Smooth object along Y axis");
2339 RNA_def_property_update(prop, 0, "rna_Modifier_update");
2341 prop = RNA_def_property(srna, "use_z", PROP_BOOLEAN, PROP_NONE);
2342 RNA_def_property_boolean_sdna(prop, NULL, "flag", MOD_LAPLACIANSMOOTH_Z);
2343 RNA_def_property_ui_text(prop, "Z", "Smooth object along Z axis");
2344 RNA_def_property_update(prop, 0, "rna_Modifier_update");
2346 prop = RNA_def_property(srna, "use_volume_preserve", PROP_BOOLEAN, PROP_NONE);
2347 RNA_def_property_boolean_sdna(prop, NULL, "flag", MOD_LAPLACIANSMOOTH_PRESERVE_VOLUME);
2348 RNA_def_property_ui_text(prop, "Preserve Volume", "Apply volume preservation after smooth");
2349 RNA_def_property_update(prop, 0, "rna_Modifier_update");
2351 prop = RNA_def_property(srna, "use_normalized", PROP_BOOLEAN, PROP_NONE);
2352 RNA_def_property_boolean_sdna(prop, NULL, "flag", MOD_LAPLACIANSMOOTH_NORMALIZED);
2353 RNA_def_property_ui_text(prop, "Normalized", "Improve and stabilize the enhanced shape");
2354 RNA_def_property_update(prop, 0, "rna_Modifier_update");
2356 prop = RNA_def_property(srna, "lambda_factor", PROP_FLOAT, PROP_NONE);
2357 RNA_def_property_float_sdna(prop, NULL, "lambda");
2358 RNA_def_property_range(prop, -FLT_MAX, FLT_MAX);
2359 RNA_def_property_ui_range(prop, -1000.0, 1000.0, 5, 3);
2360 RNA_def_property_ui_text(prop, "Lambda Factor", "Smooth factor effect");
2361 RNA_def_property_update(prop, 0, "rna_Modifier_update");
2363 prop = RNA_def_property(srna, "lambda_border", PROP_FLOAT, PROP_NONE);
2364 RNA_def_property_float_sdna(prop, NULL, "lambda_border");
2365 RNA_def_property_range(prop, -FLT_MAX, FLT_MAX);
2366 RNA_def_property_ui_range(prop, -1000.0, 1000.0, 5, 3);
2367 RNA_def_property_ui_text(prop, "Lambda Border", "Lambda factor in border");
2368 RNA_def_property_update(prop, 0, "rna_Modifier_update");
2370 prop = RNA_def_property(srna, "iterations", PROP_INT, PROP_NONE);
2371 RNA_def_property_int_sdna(prop, NULL, "repeat");
2372 RNA_def_property_ui_range(prop, 0, 200, 1, -1);
2373 RNA_def_property_ui_text(prop, "Repeat", "");
2374 RNA_def_property_update(prop, 0, "rna_Modifier_update");
2376 prop = RNA_def_property(srna, "vertex_group", PROP_STRING, PROP_NONE);
2377 RNA_def_property_string_sdna(prop, NULL, "defgrp_name");
2378 RNA_def_property_ui_text(prop, "Vertex Group",
2379 "Name of Vertex Group which determines influence of modifier per point");
2380 RNA_def_property_string_funcs(prop, NULL, NULL, "rna_LaplacianSmoothModifier_defgrp_name_set");
2381 RNA_def_property_update(prop, 0, "rna_Modifier_update");
2384 static void rna_def_modifier_cast(BlenderRNA *brna)
2389 static EnumPropertyItem prop_cast_type_items[] = {
2390 {MOD_CAST_TYPE_SPHERE, "SPHERE", 0, "Sphere", ""},
2391 {MOD_CAST_TYPE_CYLINDER, "CYLINDER", 0, "Cylinder", ""},
2392 {MOD_CAST_TYPE_CUBOID, "CUBOID", 0, "Cuboid", ""},
2393 {0, NULL, 0, NULL, NULL}
2396 srna = RNA_def_struct(brna, "CastModifier", "Modifier");
2397 RNA_def_struct_ui_text(srna, "Cast Modifier", "Modifier to cast to other shapes");
2398 RNA_def_struct_sdna(srna, "CastModifierData");
2399 RNA_def_struct_ui_icon(srna, ICON_MOD_CAST);
2401 prop = RNA_def_property(srna, "cast_type", PROP_ENUM, PROP_NONE);
2402 RNA_def_property_enum_sdna(prop, NULL, "type");
2403 RNA_def_property_enum_items(prop, prop_cast_type_items);
2404 RNA_def_property_ui_text(prop, "Cast Type", "Target object shape");
2405 RNA_def_property_update(prop, 0, "rna_Modifier_update");
2407 prop = RNA_def_property(srna, "object", PROP_POINTER, PROP_NONE);
2408 RNA_def_property_ui_text(prop, "Object",
2409 "Control object: if available, its location determines the center of the effect");
2410 RNA_def_property_pointer_funcs(prop, NULL, "rna_CastModifier_object_set", NULL, NULL);
2411 RNA_def_property_flag(prop, PROP_EDITABLE | PROP_ID_SELF_CHECK);
2412 RNA_def_property_update(prop, 0, "rna_Modifier_dependency_update");
2414 prop = RNA_def_property(srna, "use_x", PROP_BOOLEAN, PROP_NONE);
2415 RNA_def_property_boolean_sdna(prop, NULL, "flag", MOD_CAST_X);
2416 RNA_def_property_ui_text(prop, "X", "");
2417 RNA_def_property_update(prop, 0, "rna_Modifier_update");
2419 prop = RNA_def_property(srna, "use_y", PROP_BOOLEAN, PROP_NONE);
2420 RNA_def_property_boolean_sdna(prop, NULL, "flag", MOD_CAST_Y);
2421 RNA_def_property_ui_text(prop, "Y", "");
2422 RNA_def_property_update(prop, 0, "rna_Modifier_update");
2424 prop = RNA_def_property(srna, "use_z", PROP_BOOLEAN, PROP_NONE);
2425 RNA_def_property_boolean_sdna(prop, NULL, "flag", MOD_CAST_Z);
2426 RNA_def_property_ui_text(prop, "Z", "");
2427 RNA_def_property_update(prop, 0, "rna_Modifier_update");
2429 prop = RNA_def_property(srna, "use_radius_as_size", PROP_BOOLEAN, PROP_NONE);
2430 RNA_def_property_boolean_sdna(prop, NULL, "flag", MOD_CAST_SIZE_FROM_RADIUS);
2431 RNA_def_property_ui_text(prop, "From Radius", "Use radius as size of projection shape (0 = auto)");
2432 RNA_def_property_update(prop, 0, "rna_Modifier_update");
2434 prop = RNA_def_property(srna, "use_transform", PROP_BOOLEAN, PROP_NONE);
2435 RNA_def_property_boolean_sdna(prop, NULL, "flag", MOD_CAST_USE_OB_TRANSFORM);
2436 RNA_def_property_ui_text(prop, "Use transform", "Use object transform to control projection shape");
2437 RNA_def_property_update(prop, 0, "rna_Modifier_update");
2439 prop = RNA_def_property(srna, "factor", PROP_FLOAT, PROP_NONE);
2440 RNA_def_property_float_sdna(prop, NULL, "fac");
2441 RNA_def_property_range(prop, -FLT_MAX, FLT_MAX);
2442 RNA_def_property_ui_range(prop, -10, 10, 5, 2);
2443 RNA_def_property_ui_text(prop, "Factor", "");
2444 RNA_def_property_update(prop, 0, "rna_Modifier_update");
2446 prop = RNA_def_property(srna, "radius", PROP_FLOAT, PROP_DISTANCE);
2447 RNA_def_property_range(prop, 0, FLT_MAX);
2448 RNA_def_property_ui_range(prop, 0, 100, 5, 2);
2449 RNA_def_property_ui_text(prop, "Radius",
2450 "Only deform vertices within this distance from the center of the effect "
2451 "(leave as 0 for infinite.)");
2452 RNA_def_property_update(prop, 0, "rna_Modifier_update");
2454 prop = RNA_def_property(srna, "size", PROP_FLOAT, PROP_NONE);
2455 RNA_def_property_range(prop, 0, FLT_MAX);
2456 RNA_def_property_ui_range(prop, 0, 100, 5, 2);
2457 RNA_def_property_ui_text(prop, "Size", "Size of projection shape (leave as 0 for auto)");
2458 RNA_def_property_update(prop, 0, "rna_Modifier_update");
2460 prop = RNA_def_property(srna, "vertex_group", PROP_STRING, PROP_NONE);
2461 RNA_def_property_string_sdna(prop, NULL, "defgrp_name");
2462 RNA_def_property_ui_text(prop, "Vertex Group", "Vertex group name");
2463 RNA_def_property_string_funcs(prop, NULL, NULL, "rna_CastModifier_defgrp_name_set");
2464 RNA_def_property_update(prop, 0, "rna_Modifier_update");
2467 static void rna_def_modifier_meshdeform(BlenderRNA *brna)
2472 static EnumPropertyItem prop_mode_items[] = {
2473 {0, "VOLUME", 0, "Volume", "Bind to volume inside cage mesh"},
2474 {1, "SURFACE", 0, "Surface", "Bind to surface of cage mesh"},
2475 {0, NULL, 0, NULL, NULL}
2479 srna = RNA_def_struct(brna, "MeshDeformModifier", "Modifier");
2480 RNA_def_struct_ui_text(srna, "MeshDeform Modifier", "Mesh deformation modifier to deform with other meshes");
2481 RNA_def_struct_sdna(srna, "MeshDeformModifierData");
2482 RNA_def_struct_ui_icon(srna, ICON_MOD_MESHDEFORM);
2484 prop = RNA_def_property(srna, "object", PROP_POINTER, PROP_NONE);
2485 RNA_def_property_ui_text(prop, "Object", "Mesh object to deform with");
2486 RNA_def_property_pointer_funcs(prop, NULL, "rna_MeshDeformModifier_object_set", NULL, "rna_Mesh_object_poll");
2487 RNA_def_property_flag(prop, PROP_EDITABLE | PROP_ID_SELF_CHECK);
2488 RNA_def_property_update(prop, 0, "rna_Modifier_dependency_update");
2490 prop = RNA_def_property(srna, "is_bound", PROP_BOOLEAN, PROP_NONE);
2491 RNA_def_property_boolean_funcs(prop, "rna_MeshDeformModifier_is_bound_get", NULL);
2492 RNA_def_property_ui_text(prop, "Bound", "Whether geometry has been bound to control cage");
2493 RNA_def_property_clear_flag(prop, PROP_EDITABLE);
2495 prop = RNA_def_property(srna, "invert_vertex_group", PROP_BOOLEAN, PROP_NONE);
2496 RNA_def_property_boolean_sdna(prop, NULL, "flag", MOD_MDEF_INVERT_VGROUP);
2497 RNA_def_property_ui_text(prop, "Invert", "Invert vertex group influence");
2498 RNA_def_property_update(prop, 0, "rna_Modifier_update");
2500 prop = RNA_def_property(srna, "vertex_group", PROP_STRING, PROP_NONE);
2501 RNA_def_property_string_sdna(prop, NULL, "defgrp_name");
2502 RNA_def_property_ui_text(prop, "Vertex Group", "Vertex group name");
2503 RNA_def_property_string_funcs(prop, NULL, NULL, "rna_MeshDeformModifier_defgrp_name_set");
2504 RNA_def_property_update(prop, 0, "rna_Modifier_update");
2506 prop = RNA_def_property(srna, "precision", PROP_INT, PROP_NONE);
2507 RNA_def_property_int_sdna(prop, NULL, "gridsize");
2508 RNA_def_property_range(prop, 2, 10);
2509 RNA_def_property_ui_text(prop, "Precision", "The grid size for binding");
2510 RNA_def_property_update(prop, 0, "rna_Modifier_update");
2512 prop = RNA_def_property(srna, "use_dynamic_bind", PROP_BOOLEAN, PROP_NONE);
2513 RNA_def_property_boolean_sdna(prop, NULL, "flag", MOD_MDEF_DYNAMIC_BIND);
2514 RNA_def_property_ui_text(prop, "Dynamic",
2515 "Recompute binding dynamically on top of other deformers "
2516 "(slower and more memory consuming)");
2517 RNA_def_property_update(prop, 0, "rna_Modifier_update");
2520 prop = RNA_def_property(srna, "mode", PROP_ENUM, PROP_NONE);
2521 RNA_def_property_enum_items(prop, prop_mode_items);
2522 RNA_def_property_ui_text(prop, "Mode", "Method of binding vertices are bound to cage mesh");
2523 RNA_def_property_update(prop, 0, "rna_Modifier_update");
2527 static void rna_def_modifier_explode(BlenderRNA *brna)
2532 srna = RNA_def_struct(brna, "ExplodeModifier", "Modifier");
2533 RNA_def_struct_ui_text(srna, "Explode Modifier", "Explosion effect modifier based on a particle system");
2534 RNA_def_struct_sdna(srna, "ExplodeModifierData");
2535 RNA_def_struct_ui_icon(srna, ICON_MOD_EXPLODE);
2537 prop = RNA_def_property(srna, "vertex_group", PROP_STRING, PROP_NONE);
2538 RNA_def_property_string_funcs(prop, "rna_ExplodeModifier_vgroup_get", "rna_ExplodeModifier_vgroup_length",
2539 "rna_ExplodeModifier_vgroup_set");
2540 RNA_def_property_ui_text(prop, "Vertex Group", "");
2542 prop = RNA_def_property(srna, "protect", PROP_FLOAT, PROP_NONE);
2543 RNA_def_property_range(prop, 0, 1);
2544 RNA_def_property_ui_text(prop, "Protect", "Clean vertex group edges");
2545 RNA_def_property_update(prop, 0, "rna_Modifier_update");
2547 prop = RNA_def_property(srna, "use_edge_cut", PROP_BOOLEAN, PROP_NONE);
2548 RNA_def_property_boolean_sdna(prop, NULL, "flag", eExplodeFlag_EdgeCut);
2549 RNA_def_property_ui_text(prop, "Cut Edges", "Cut face edges for nicer shrapnel");
2550 RNA_def_property_update(prop, 0, "rna_Modifier_update");
2552 prop = RNA_def_property(srna, "show_unborn", PROP_BOOLEAN, PROP_NONE);
2553 RNA_def_property_boolean_sdna(prop, NULL, "flag", eExplodeFlag_Unborn);
2554 RNA_def_property_ui_text(prop, "Unborn", "Show mesh when particles are unborn");
2555 RNA_def_property_update(prop, 0, "rna_Modifier_update");
2557 prop = RNA_def_property(srna, "show_alive", PROP_BOOLEAN, PROP_NONE);
2558 RNA_def_property_boolean_sdna(prop, NULL, "flag", eExplodeFlag_Alive);
2559 RNA_def_property_ui_text(prop, "Alive", "Show mesh when particles are alive");
2560 RNA_def_property_update(prop, 0, "rna_Modifier_update");
2562 prop = RNA_def_property(srna, "show_dead", PROP_BOOLEAN, PROP_NONE);
2563 RNA_def_property_boolean_sdna(prop, NULL, "flag", eExplodeFlag_Dead);
2564 RNA_def_property_ui_text(prop, "Dead", "Show mesh when particles are dead");
2565 RNA_def_property_update(prop, 0, "rna_Modifier_update");
2567 prop = RNA_def_property(srna, "use_size", PROP_BOOLEAN, PROP_NONE);
2568 RNA_def_property_boolean_sdna(prop, NULL, "flag", eExplodeFlag_PaSize);
2569 RNA_def_property_ui_text(prop, "Size", "Use particle size for the shrapnel");
2570 RNA_def_property_update(prop, 0, "rna_Modifier_update");
2572 prop = RNA_def_property(srna, "particle_uv", PROP_STRING, PROP_NONE);
2573 RNA_def_property_string_sdna(prop, NULL, "uvname");
2574 RNA_def_property_string_maxlength(prop, MAX_CUSTOMDATA_LAYER_NAME);
2575 RNA_def_property_ui_text(prop, "Particle UV", "UV map to change with particle age");
2576 RNA_def_property_update(prop, 0, "rna_Modifier_update");
2579 static void rna_def_modifier_cloth(BlenderRNA *brna)
2584 srna = RNA_def_struct(brna, "ClothModifier", "Modifier");
2585 RNA_def_struct_ui_text(srna, "Cloth Modifier", "Cloth simulation modifier");
2586 RNA_def_struct_sdna(srna, "ClothModifierData");
2587 RNA_def_struct_ui_icon(srna, ICON_MOD_CLOTH);
2589 prop = RNA_def_property(srna, "settings", PROP_POINTER, PROP_NONE);
2590 RNA_def_property_flag(prop, PROP_NEVER_NULL);
2591 RNA_def_property_pointer_sdna(prop, NULL, "sim_parms");
2592 RNA_def_property_ui_text(prop, "Cloth Settings", "");
2594 prop = RNA_def_property(srna, "collision_settings", PROP_POINTER, PROP_NONE);
2595 RNA_def_property_flag(prop, PROP_NEVER_NULL);
2596 RNA_def_property_pointer_sdna(prop, NULL, "coll_parms");
2597 RNA_def_property_ui_text(prop, "Cloth Collision Settings", "");
2599 prop = RNA_def_property(srna, "solver_result", PROP_POINTER, PROP_NONE);
2600 RNA_def_property_struct_type(prop, "ClothSolverResult");
2601 RNA_def_property_pointer_sdna(prop, NULL, "solver_result");
2602 RNA_def_property_ui_text(prop, "Solver Result", "");
2604 prop = RNA_def_property(srna, "hair_grid_min", PROP_FLOAT, PROP_NONE);
2605 RNA_def_property_float_sdna(prop, NULL, "hair_grid_min");
2606 RNA_def_property_clear_flag(prop, PROP_EDITABLE);
2607 RNA_def_property_ui_text(prop, "Hair Grid Minimum", "");
2609 prop = RNA_def_property(srna, "hair_grid_max", PROP_FLOAT, PROP_NONE);
2610 RNA_def_property_float_sdna(prop, NULL, "hair_grid_max");
2611 RNA_def_property_clear_flag(prop, PROP_EDITABLE);
2612 RNA_def_property_ui_text(prop, "Hair Grid Maximum", "");
2614 prop = RNA_def_property(srna, "hair_grid_resolution", PROP_INT, PROP_NONE);
2615 RNA_def_property_int_sdna(prop, NULL, "hair_grid_res");
2616 RNA_def_property_clear_flag(prop, PROP_EDITABLE);
2617 RNA_def_property_ui_text(prop, "Hair Grid Resolution", "");
2620 static void rna_def_modifier_smoke(BlenderRNA *brna)
2625 static EnumPropertyItem prop_smoke_type_items[] = {
2626 {0, "NONE", 0, "None", ""},
2627 {MOD_SMOKE_TYPE_DOMAIN, "DOMAIN", 0, "Domain", ""},
2628 {MOD_SMOKE_TYPE_FLOW, "FLOW", 0, "Flow", "Inflow/Outflow"},
2629 {MOD_SMOKE_TYPE_COLL, "COLLISION", 0, "Collision", ""},
2630 {0, NULL, 0, NULL, NULL}
2633 srna = RNA_def_struct(brna, "SmokeModifier", "Modifier");
2634 RNA_def_struct_ui_text(srna, "Smoke Modifier", "Smoke simulation modifier");
2635 RNA_def_struct_sdna(srna, "SmokeModifierData");
2636 RNA_def_struct_ui_icon(srna, ICON_MOD_SMOKE);
2638 prop = RNA_def_property(srna, "domain_settings", PROP_POINTER, PROP_NONE);
2639 RNA_def_property_pointer_sdna(prop, NULL, "domain");
2640 RNA_def_property_ui_text(prop, "Domain Settings", "");
2642 prop = RNA_def_property(srna, "flow_settings", PROP_POINTER, PROP_NONE);
2643 RNA_def_property_pointer_sdna(prop, NULL, "flow");
2644 RNA_def_property_ui_text(prop, "Flow Settings", "");
2646 prop = RNA_def_property(srna, "coll_settings", PROP_POINTER, PROP_NONE);
2647 RNA_def_property_pointer_sdna(prop, NULL, "coll");
2648 RNA_def_property_ui_text(prop, "Collision Settings", "");
2650 prop = RNA_def_property(srna, "smoke_type", PROP_ENUM, PROP_NONE);
2651 RNA_def_property_enum_sdna(prop, NULL, "type");
2652 RNA_def_property_enum_items(prop, prop_smoke_type_items);
2653 RNA_def_property_ui_text(prop, "Type", "");
2654 RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
2655 RNA_def_property_update(prop, 0, "rna_Smoke_set_type");
2658 static void rna_def_modifier_dynamic_paint(BlenderRNA *brna)
2663 srna = RNA_def_struct(brna, "DynamicPaintModifier", "Modifier");
2664 RNA_def_struct_ui_text(srna, "Dynamic Paint Modifier", "Dynamic Paint modifier");
2665 RNA_def_struct_sdna(srna, "DynamicPaintModifierData");
2666 RNA_def_struct_ui_icon(srna, ICON_MOD_DYNAMICPAINT);
2668 prop = RNA_def_property(srna, "canvas_settings", PROP_POINTER, PROP_NONE);
2669 RNA_def_property_pointer_sdna(prop, NULL, "canvas");
2670 RNA_def_property_ui_text(prop, "Canvas Settings", "");
2672 prop = RNA_def_property(srna, "brush_settings", PROP_POINTER, PROP_NONE);
2673 RNA_def_property_pointer_sdna(prop, NULL, "brush");
2674 RNA_def_property_ui_text(prop, "Brush Settings", "");
2676 prop = RNA_def_property(srna, "ui_type", PROP_ENUM, PROP_NONE);
2677 RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
2678 RNA_def_property_enum_sdna(prop, NULL, "type");
2679 RNA_def_property_enum_items(prop, rna_enum_prop_dynamicpaint_type_items);
2680 RNA_def_property_ui_text(prop, "Type", "");
2683 static void rna_def_modifier_collision(BlenderRNA *brna)
2688 srna = RNA_def_struct(brna, "CollisionModifier", "Modifier");
2689 RNA_def_struct_ui_text(srna, "Collision Modifier",
2690 "Collision modifier defining modifier stack position used for collision");
2691 RNA_def_struct_sdna(srna, "CollisionModifierData");
2692 RNA_def_struct_ui_icon(srna, ICON_MOD_PHYSICS);
2694 prop = RNA_def_property(srna, "settings", PROP_POINTER, PROP_NONE);
2695 RNA_def_property_flag(prop, PROP_NEVER_NULL);
2696 RNA_def_property_struct_type(prop, "CollisionSettings");
2697 RNA_def_property_pointer_funcs(prop, "rna_CollisionModifier_settings_get", NULL, NULL, NULL);
2698 RNA_def_property_ui_text(prop, "Settings", "");
2701 static void rna_def_modifier_bevel(BlenderRNA *brna)
2706 static EnumPropertyItem prop_limit_method_items[] = {
2707 {0, "NONE", 0, "None", "Bevel the entire mesh by a constant amount"},
2708 {MOD_BEVEL_ANGLE, "ANGLE", 0, "Angle", "Only bevel edges with sharp enough angles between faces"},
2709 {MOD_BEVEL_WEIGHT, "WEIGHT", 0, "Weight",
2710 "Use bevel weights to determine how much bevel is applied in edge mode"},
2711 {MOD_BEVEL_VGROUP, "VGROUP", 0, "Vertex Group",
2712 "Use vertex group weights to select whether vertex or edge is beveled"},
2713 {0, NULL, 0, NULL, NULL}
2716 static EnumPropertyItem prop_val_type_items[] = {
2717 {MOD_BEVEL_AMT_OFFSET, "OFFSET", 0, "Offset", "Amount is offset of new edges from original"},
2718 {MOD_BEVEL_AMT_WIDTH, "WIDTH", 0, "Width", "Amount is width of new face"},
2719 {MOD_BEVEL_AMT_DEPTH, "DEPTH", 0, "Depth", "Amount is perpendicular distance from original edge to bevel face"},
2720 {MOD_BEVEL_AMT_PERCENT, "PERCENT", 0, "Percent", "Amount is percent of adjacent edge length"},
2721 {0, NULL, 0, NULL, NULL}
2724 /* TO BE DEPRECATED */
2725 static EnumPropertyItem prop_edge_weight_method_items[] = {
2726 {0, "AVERAGE", 0, "Average", ""},
2727 {MOD_BEVEL_EMIN, "SHARPEST", 0, "Sharpest", ""},
2728 {MOD_BEVEL_EMAX, "LARGEST", 0, "Largest", ""},
2729 {0, NULL, 0, NULL, NULL}
2732 srna = RNA_def_struct(brna, "BevelModifier", "Modifier");
2733 RNA_def_struct_ui_text(srna, "Bevel Modifier", "Bevel modifier to make edges and vertices more rounded");
2734 RNA_def_struct_sdna(srna, "BevelModifierData");
2735 RNA_def_struct_ui_icon(srna, ICON_MOD_BEVEL);
2737 prop = RNA_def_property(srna, "width", PROP_FLOAT, PROP_DISTANCE);
2738 RNA_def_property_float_sdna(prop, NULL, "value");
2739 RNA_def_property_range(prop, 0, FLT_MAX);
2740 RNA_def_property_ui_range(prop, 0.0f, 100.0f, 0.1, 4);
2741 RNA_def_property_ui_text(prop, "Width", "Bevel value/amount");
2742 RNA_def_property_update(prop, 0, "rna_Modifier_update");
2744 prop = RNA_def_property(srna, "segments", PROP_INT, PROP_NONE);
2745 RNA_def_property_int_sdna(prop, NULL, "res");
2746 RNA_def_property_range(prop, 1, 100);
2747 RNA_def_property_ui_text(prop, "Segments", "Number of segments for round edges/verts");
2748 RNA_def_property_update(prop, 0, "rna_Modifier_update");
2750 prop = RNA_def_property(srna, "use_only_vertices", PROP_BOOLEAN, PROP_NONE);
2751 RNA_def_property_boolean_sdna(prop, NULL, "flags", MOD_BEVEL_VERT);
2752 RNA_def_property_ui_text(prop, "Only Vertices", "Bevel verts/corners, not edges");
2753 RNA_def_property_update(prop, 0, "rna_Modifier_update");
2755 prop = RNA_def_property(srna, "limit_method", PROP_ENUM, PROP_NONE);
2756 RNA_def_property_enum_sdna(prop, NULL, "lim_flags");
2757 RNA_def_property_enum_items(prop, prop_limit_method_items);
2758 RNA_def_property_ui_text(prop, "Limit Method", "");
2759 RNA_def_property_update(prop, 0, "rna_Modifier_update");
2761 /* TO BE DEPRECATED */
2762 prop = RNA_def_property(srna, "edge_weight_method", PROP_ENUM, PROP_NONE);
2763 RNA_def_property_enum_sdna(prop, NULL, "e_flags");
2764 RNA_def_property_enum_items(prop, prop_edge_weight_method_items);
2765 RNA_def_property_ui_text(prop, "Edge Weight Method", "What edge weight to use for weighting a vertex");
2766 RNA_def_property_update(prop, 0, "rna_Modifier_update");
2768 prop = RNA_def_property(srna, "angle_limit", PROP_FLOAT, PROP_ANGLE);
2769 RNA_def_property_float_sdna(prop, NULL, "bevel_angle");
2770 RNA_def_property_range(prop, 0.0f, DEG2RADF(180.0f));
2771 RNA_def_property_ui_range(prop, 0.0f, DEG2RADF(180.0f), 10, 2);
2772 RNA_def_property_ui_text(prop, "Angle", "Angle above which to bevel edges");
2773 RNA_def_property_update(prop, 0, "rna_Modifier_update");
2775 prop = RNA_def_property(srna, "vertex_group", PROP_STRING, PROP_NONE);
2776 RNA_def_property_string_sdna(prop, NULL, "defgrp_name");
2777 RNA_def_property_ui_text(prop, "Vertex Group", "Vertex group name");
2778 RNA_def_property_string_funcs(prop, NULL, NULL, "rna_BevelModifier_defgrp_name_set");
2779 RNA_def_property_update(prop, 0, "rna_Modifier_update");
2781 prop = RNA_def_property(srna, "use_clamp_overlap", PROP_BOOLEAN, PROP_NONE);
2782 RNA_def_property_boolean_negative_sdna(prop, NULL, "flags", MOD_BEVEL_OVERLAP_OK);
2783 RNA_def_property_ui_text(prop, "Clamp Overlap", "Clamp the width to avoid overlap");
2784 RNA_def_property_update(prop, 0, "rna_Modifier_update");
2786 prop = RNA_def_property(srna, "offset_type", PROP_ENUM, PROP_NONE);
2787 RNA_def_property_enum_sdna(prop, NULL, "val_flags");
2788 RNA_def_property_enum_items(prop, prop_val_type_items);
2789 RNA_def_property_ui_text(prop, "Amount Type", "What distance Width measures");
2790 RNA_def_property_update(prop, 0, "rna_Modifier_update");
2792 prop = RNA_def_property(srna, "profile", PROP_FLOAT, PROP_FACTOR);
2793 RNA_def_property_range(prop, 0.0f, 1.0f);
2794 RNA_def_property_ui_range(prop, 0.15f, 1.0f, 0.05, 2);
2795 RNA_def_property_ui_text(prop, "Profile", "The profile shape (0.5 = round)");
2796 RNA_def_property_update(prop, 0, "rna_Modifier_update");
2798 prop = RNA_def_property(srna, "material", PROP_INT, PROP_NONE);
2799 RNA_def_property_int_sdna(prop, NULL, "mat");
2800 RNA_def_property_range(prop, -1, SHRT_MAX);
2801 RNA_def_property_ui_text(prop, "Material", "Material index of generated faces, -1 for automatic");
2802 RNA_def_property_update(prop, 0, "rna_Modifier_update");
2804 prop = RNA_def_property(srna, "loop_slide", PROP_BOOLEAN, PROP_NONE);
2805 RNA_def_property_boolean_negative_sdna(prop, NULL, "flags", MOD_BEVEL_EVEN_WIDTHS);
2806 RNA_def_property_ui_text(prop, "Loop Slide", "Prefer sliding along edges to having even widths");
2807 RNA_def_property_update(prop, 0, "rna_Modifier_update");
2810 static void rna_def_modifier_shrinkwrap(BlenderRNA *brna)
2815 static EnumPropertyItem shrink_type_items[] = {
2816 {MOD_SHRINKWRAP_NEAREST_SURFACE, "NEAREST_SURFACEPOINT", 0, "Nearest Surface Point",
2817 "Shrink the mesh to the nearest target surface"},
2818 {MOD_SHRINKWRAP_PROJECT, "PROJECT", 0, "Project",
2819 "Shrink the mesh to the nearest target surface along a given axis"},
2820 {MOD_SHRINKWRAP_NEAREST_VERTEX, "NEAREST_VERTEX", 0, "Nearest Vertex",
2821 "Shrink the mesh to the nearest target vertex"},
2822 {0, NULL, 0, NULL, NULL}
2825 static EnumPropertyItem shrink_face_cull_items[] = {
2826 {0, "OFF", 0, "Off", "No culling"},
2827 {MOD_SHRINKWRAP_CULL_TARGET_FRONTFACE, "FRONT", 0, "Front", "No projection when in front of the face"},
2828 {MOD_SHRINKWRAP_CULL_TARGET_BACKFACE, "BACK", 0, "Back", "No projection when behind the face"},
2829 {0, NULL, 0, NULL, NULL}
2832 srna = RNA_def_struct(brna, "ShrinkwrapModifier", "Modifier");
2833 RNA_def_struct_ui_text(srna, "Shrinkwrap Modifier",
2834 "Shrink wrapping modifier to shrink wrap and object to a target");
2835 RNA_def_struct_sdna(srna, "ShrinkwrapModifierData");
2836 RNA_def_struct_ui_icon(srna, ICON_MOD_SHRINKWRAP);
2838 prop = RNA_def_property(srna, "wrap_method", PROP_ENUM, PROP_NONE);
2839 RNA_def_property_enum_sdna(prop, NULL, "shrinkType");
2840 RNA_def_property_enum_items(prop, shrink_type_items);
2841 RNA_def_property_ui_text(prop, "Mode", "");
2842 RNA_def_property_update(prop, 0, "rna_Modifier_update");
2844 prop = RNA_def_property(srna, "cull_face", PROP_ENUM, PROP_NONE);
2845 RNA_def_property_enum_sdna(prop, NULL, "shrinkOpts");
2846 RNA_def_property_enum_items(prop, shrink_face_cull_items);
2847 RNA_def_property_enum_funcs(prop, "rna_ShrinkwrapModifier_face_cull_get",
2848 "rna_ShrinkwrapModifier_face_cull_set", NULL);
2849 RNA_def_property_ui_text(prop, "Face Cull",
2850 "Stop vertices from projecting to a face on the target when facing towards/away");
2851 RNA_def_property_update(prop, 0, "rna_Modifier_update");
2853 prop = RNA_def_property(srna, "target", PROP_POINTER, PROP_NONE);
2854 RNA_def_property_ui_text(prop, "Target", "Mesh target to shrink to");
2855 RNA_def_property_pointer_funcs(prop, NULL, "rna_ShrinkwrapModifier_target_set", NULL, "rna_Mesh_object_poll");
2856 RNA_def_property_flag(prop, PROP_EDITABLE | PROP_ID_SELF_CHECK);
2857 RNA_def_property_update(prop, 0, "rna_Modifier_dependency_update");
2859 prop = RNA_def_property(srna, "auxiliary_target", PROP_POINTER, PROP_NONE);
2860 RNA_def_property_pointer_sdna(prop, NULL, "auxTarget");
2861 RNA_def_property_ui_text(prop, "Auxiliary Target", "Additional mesh target to shrink to");
2862 RNA_def_property_pointer_funcs(prop, NULL, "rna_ShrinkwrapModifier_auxTarget_set", NULL, "rna_Mesh_object_poll");
2863 RNA_def_property_flag(prop, PROP_EDITABLE | PROP_ID_SELF_CHECK);
2864 RNA_def_property_update(prop, 0, "rna_Modifier_dependency_update");
2866 prop = RNA_def_property(srna, "vertex_group", PROP_STRING, PROP_NONE);
2867 RNA_def_property_string_sdna(prop, NULL, "vgroup_name");
2868 RNA_def_property_ui_text(prop, "Vertex Group", "Vertex group name");
2869 RNA_def_property_string_funcs(prop, NULL, NULL, "rna_ShrinkwrapModifier_vgroup_name_set");
2870 RNA_def_property_update(prop, 0, "rna_Modifier_update");
2872 prop = RNA_def_property(srna, "offset", PROP_FLOAT, PROP_NONE);
2873 RNA_def_property_float_sdna(prop, NULL, "keepDist");
2874 RNA_def_property_range(prop, -FLT_MAX, FLT_MAX);
2875 RNA_def_property_ui_range(prop, -100, 100, 1, 2);
2876 RNA_def_property_ui_text(prop, "Offset", "Distance to keep from the target");
2877 RNA_def_property_update(prop, 0, "rna_Modifier_update");
2879 prop = RNA_def_property(srna, "project_limit", PROP_FLOAT, PROP_NONE);
2880 RNA_def_property_float_sdna(prop, NULL, "projLimit");
2881 RNA_def_property_range(prop, 0.0, FLT_MAX);
2882 RNA_def_property_ui_range(prop, 0, 100, 1, 2);
2883 RNA_def_property_ui_text(prop, "Project Limit", "Limit the distance used for projection (zero disables)");
2884 RNA_def_property_update(prop, 0, "rna_Modifier_update");
2886 prop = RNA_def_property(srna, "use_project_x", PROP_BOOLEAN, PROP_NONE);
2887 RNA_def_property_boolean_sdna(prop, NULL, "projAxis", MOD_SHRINKWRAP_PROJECT_OVER_X_AXIS);
2888 RNA_def_property_ui_text(prop, "X", "");
2889 RNA_def_property_update(prop, 0, "rna_Modifier_update");
2891 prop = RNA_def_property(srna, "use_project_y", PROP_BOOLEAN, PROP_NONE);
2892 RNA_def_property_boolean_sdna(prop, NULL, "projAxis", MOD_SHRINKWRAP_PROJECT_OVER_Y_AXIS);
2893 RNA_def_property_ui_text(prop, "Y", "");
2894 RNA_def_property_update(prop, 0, "rna_Modifier_update");
2896 prop = RNA_def_property(srna, "use_project_z", PROP_BOOLEAN, PROP_NONE);
2897 RNA_def_property_boolean_sdna(prop, NULL, "projAxis", MOD_SHRINKWRAP_PROJECT_OVER_Z_AXIS);
2898 RNA_def_property_ui_text(prop, "Z", "");
2899 RNA_def_property_update(prop, 0, "rna_Modifier_update");
2901 prop = RNA_def_property(srna, "subsurf_levels", PROP_INT, PROP_NONE);
2902 RNA_def_property_int_sdna(prop, NULL, "subsurfLevels");
2903 RNA_def_property_range(prop, 0, 6);
2904 RNA_def_property_ui_range(prop, 0, 6, 1, -1);
2905 RNA_def_property_ui_text(prop, "Subsurf Levels",
2906 "Number of subdivisions that must be performed before extracting vertices' "
2907 "positions and normals");
2908 RNA_def_property_update(prop, 0, "rna_Modifier_update");
2910 prop = RNA_def_property(srna, "use_negative_direction", PROP_BOOLEAN, PROP_NONE);
2911 RNA_def_property_boolean_sdna(prop, NULL, "shrinkOpts", MOD_SHRINKWRAP_PROJECT_ALLOW_NEG_DIR);
2912 RNA_def_property_ui_text(prop, "Negative", "Allow vertices to move in the negative direction of axis");
2913 RNA_def_property_update(prop, 0, "rna_Modifier_update");
2915 prop = RNA_def_property(srna, "use_positive_direction", PROP_BOOLEAN, PROP_NONE);
2916 RNA_def_property_boolean_sdna(prop, NULL, "shrinkOpts", MOD_SHRINKWRAP_PROJECT_ALLOW_POS_DIR);
2917 RNA_def_property_ui_text(prop, "Positive", "Allow vertices to move in the positive direction of axis");
2918 RNA_def_property_update(prop, 0, "rna_Modifier_update");
2920 prop = RNA_def_property(srna, "use_keep_above_surface", PROP_BOOLEAN, PROP_NONE);
2921 RNA_def_property_boolean_sdna(prop, NULL, "shrinkOpts", MOD_SHRINKWRAP_KEEP_ABOVE_SURFACE);
2922 RNA_def_property_ui_text(prop, "Keep Above Surface", "");
2923 RNA_def_property_update(prop, 0, "rna_Modifier_update");
2925 prop = RNA_def_property(srna, "invert_vertex_group", PROP_BOOLEAN, PROP_NONE);
2926 RNA_def_property_boolean_sdna(prop, NULL, "shrinkOpts", MOD_SHRINKWRAP_INVERT_VGROUP);
2927 RNA_def_property_ui_text(prop, "Invert", "Invert vertex group influence");
2928 RNA_def_property_update(prop, 0, "rna_Modifier_update");
2931 static void rna_def_modifier_fluidsim(BlenderRNA *brna)
2936 srna = RNA_def_struct(brna, "FluidSimulationModifier", "Modifier");
2937 RNA_def_struct_ui_text(srna, "Fluid Simulation Modifier", "Fluid simulation modifier");
2938 RNA_def_struct_sdna(srna, "FluidsimModifierData");
2939 RNA_def_struct_ui_icon(srna, ICON_MOD_FLUIDSIM);
2941 prop = RNA_def_property(srna, "settings", PROP_POINTER, PROP_NONE);
2942 RNA_def_property_flag(prop, PROP_NEVER_NULL);
2943 RNA_def_property_pointer_sdna(prop, NULL, "fss");
2944 RNA_def_property_ui_text(prop, "Settings", "Settings for how this object is used in the fluid simulation");
2947 static void rna_def_modifier_mask(BlenderRNA *brna)
2952 static EnumPropertyItem modifier_mask_mode_items[] = {
2953 {MOD_MASK_MODE_VGROUP, "VERTEX_GROUP", 0, "Vertex Group", ""},
2954 {MOD_MASK_MODE_ARM, "ARMATURE", 0, "Armature", ""},
2955 {0, NULL, 0, NULL, NULL}
2958 srna = RNA_def_struct(brna, "MaskModifier", "Modifier");
2959 RNA_def_struct_ui_text(srna, "Mask Modifier", "Mask modifier to hide parts of the mesh");
2960 RNA_def_struct_sdna(srna, "MaskModifierData");
2961 RNA_def_struct_ui_icon(srna, ICON_MOD_MASK);
2963 prop = RNA_def_property(srna, "mode", PROP_ENUM, PROP_NONE);
2964 RNA_def_property_enum_items(prop, modifier_mask_mode_items);
2965 RNA_def_property_ui_text(prop, "Mode", "");
2966 RNA_def_property_update(prop, 0, "rna_Modifier_update");
2968 prop = RNA_def_property(srna, "armature", PROP_POINTER, PROP_NONE);
2969 RNA_def_property_pointer_sdna(prop, NULL, "ob_arm");
2970 RNA_def_property_ui_text(prop, "Armature", "Armature to use as source of bones to mask");
2971 RNA_def_property_pointer_funcs(prop, NULL, "rna_MaskModifier_ob_arm_set", NULL, "rna_Armature_object_poll");
2972 RNA_def_property_flag(prop, PROP_EDITABLE | PROP_ID_SELF_CHECK);
2973 RNA_def_property_update(prop, 0, "rna_Modifier_dependency_update");
2975 prop = RNA_def_property(srna, "vertex_group", PROP_STRING, PROP_NONE);
2976 RNA_def_property_string_sdna(prop, NULL, "vgroup");
2977 RNA_def_property_ui_text(prop, "Vertex Group", "Vertex group name");
2978 RNA_def_property_string_funcs(prop, NULL, NULL, "rna_MaskModifier_vgroup_set");
2979 RNA_def_property_update(prop, 0, "rna_Modifier_update");
2981 prop = RNA_def_property(srna, "invert_vertex_group", PROP_BOOLEAN, PROP_NONE);
2982 RNA_def_property_boolean_sdna(prop, NULL, "flag", MOD_MASK_INV);
2983 RNA_def_property_ui_text(prop, "Invert", "Use vertices that are not part of region defined");
2984 RNA_def_property_update(prop, 0, "rna_Modifier_update");
2987 static void rna_def_modifier_simpledeform(BlenderRNA *brna)
2992 static EnumPropertyItem simple_deform_mode_items[] = {
2993 {MOD_SIMPLEDEFORM_MODE_TWIST, "TWIST", 0, "Twist", "Rotate around the Z axis of the modifier space"},
2994 {MOD_SIMPLEDEFORM_MODE_BEND, "BEND", 0, "Bend", "Bend the mesh over the Z axis of the modifier space"},
2995 {MOD_SIMPLEDEFORM_MODE_TAPER, "TAPER", 0, "Taper", "Linearly scale along Z axis of the modifier space"},
2996 {MOD_SIMPLEDEFORM_MODE_STRETCH, "STRETCH", 0, "Stretch",
2997 "Stretch the object along the Z axis of the modifier space"},
2998 {0, NULL, 0, NULL, NULL}
3001 srna = RNA_def_struct(brna, "SimpleDeformModifier", "Modifier");
3002 RNA_def_struct_ui_text(srna, "SimpleDeform Modifier",
3003 "Simple deformation modifier to apply effects such as twisting and bending");
3004 RNA_def_struct_sdna(srna, "SimpleDeformModifierData");
3005 RNA_def_struct_ui_icon(srna, ICON_MOD_SIMPLEDEFORM);
3007 prop = RNA_def_property(srna, "deform_method", PROP_ENUM, PROP_NONE);
3008 RNA_def_property_enum_sdna(prop, NULL, "mode");
3009 RNA_def_property_enum_items(prop, simple_deform_mode_items);
3010 RNA_def_property_ui_text(prop, "Mode", "");
3011 RNA_def_property_update(prop, 0, "rna_Modifier_update");
3013 prop = RNA_def_property(srna, "vertex_group", PROP_STRING, PROP_NONE);
3014 RNA_def_property_string_sdna(prop, NULL, "vgroup_name");
3015 RNA_def_property_ui_text(prop, "Vertex Group", "Vertex group name");
3016 RNA_def_property_string_funcs(prop, NULL, NULL, "rna_SimpleDeformModifier_vgroup_name_set");
3017 RNA_def_property_update(prop, 0, "rna_Modifier_update");
3019 prop = RNA_def_property(srna, "origin", PROP_POINTER, PROP_NONE);
3020 RNA_def_property_ui_text(prop, "Origin", "Offset the origin and orientation of the deformation");
3021 RNA_def_property_flag(prop, PROP_EDITABLE | PROP_ID_SELF_CHECK);
3022 RNA_def_property_update(prop, 0, "rna_Modifier_dependency_update");
3024 prop = RNA_def_property(srna, "factor", PROP_FLOAT, PROP_NONE);
3025 RNA_def_property_range(prop, -FLT_MAX, FLT_MAX);
3026 RNA_def_property_ui_range(prop, -10.0, 10.0, 1.0, 3);
3027 RNA_def_property_ui_text(prop, "Factor", "Amount to deform object");
3028 RNA_def_property_update(prop, 0, "rna_Modifier_update");
3030 prop = RNA_def_property(srna, "angle", PROP_FLOAT, PROP_ANGLE);
3031 RNA_def_property_float_sdna(prop, NULL, "factor");
3032 RNA_def_property_range(prop, -FLT_MAX, FLT_MAX);
3033 RNA_def_property_float_default(prop, DEG2RADF(45.0f));
3034 RNA_def_property_ui_range(prop, DEG2RAD(-360.0), DEG2RAD(360.0), 10.0, 3);
3035 RNA_def_property_ui_text(prop, "Angle", "Angle of deformation");
3036 RNA_def_property_update(prop, 0, "rna_Modifier_update");
3038 prop = RNA_def_property(srna, "limits", PROP_FLOAT, PROP_NONE);
3039 RNA_def_property_float_sdna(prop, NULL, "limit");
3040 RNA_def_property_array(prop, 2);
3041 RNA_def_property_range(prop, 0, 1);
3042 RNA_def_property_ui_range(prop, 0, 1, 5, 2);
3043 RNA_def_property_ui_text(prop, "Limits", "Lower/Upper limits for deform");
3044 RNA_def_property_update(prop, 0, "rna_Modifier_update");
3046 prop = RNA_def_property(srna, "lock_x", PROP_BOOLEAN, PROP_NONE);
3047 RNA_def_property_boolean_sdna(prop, NULL, "axis", MOD_SIMPLEDEFORM_LOCK_AXIS_X);
3048 RNA_def_property_ui_text(prop, "Lock X Axis", "Do not allow deformation along the X axis");
3049 RNA_def_property_update(prop, 0, "rna_Modifier_update");
3051 prop = RNA_def_property(srna, "lock_y", PROP_BOOLEAN, PROP_NONE);
3052 RNA_def_property_boolean_sdna(prop, NULL, "axis", MOD_SIMPLEDEFORM_LOCK_AXIS_Y);
3053 RNA_def_property_ui_text(prop, "Lock Y Axis", "Do not allow deformation along the Y axis");
3054 RNA_def_property_update(prop, 0, "rna_Modifier_update");
3056 prop = RNA_def_property(srna, "invert_vertex_group", PROP_BOOLEAN, PROP_NONE);
3057 RNA_def_property_boolean_sdna(prop, NULL, "flag", MOD_SIMPLEDEFORM_FLAG_INVERT_VGROUP);
3058 RNA_def_property_ui_text(prop, "Invert", "Invert vertex group influence");
3059 RNA_def_property_update(prop, 0, "rna_Modifier_update");
3062 static void rna_def_modifier_surface(BlenderRNA *brna)
3066 srna = RNA_def_struct(brna, "SurfaceModifier", "Modifier");
3067 RNA_def_struct_ui_text(srna, "Surface Modifier",
3068 "Surface modifier defining modifier stack position used for surface fields");
3069 RNA_def_struct_sdna(srna, "SurfaceModifierData");
3070 RNA_def_struct_ui_icon(srna, ICON_MOD_PHYSICS);
3073 static void rna_def_modifier_solidify(BlenderRNA *brna)
3078 srna = RNA_def_struct(brna, "SolidifyModifier", "Modifier");
3079 RNA_def_struct_ui_text(srna, "Solidify Modifier",
3080 "Create a solid skin by extruding, compensating for sharp angles");
3081 RNA_def_struct_sdna(srna, "SolidifyModifierData");
3082 RNA_def_struct_ui_icon(srna, ICON_MOD_SOLIDIFY);
3084 prop = RNA_def_property(srna, "thickness", PROP_FLOAT, PROP_DISTANCE);
3085 RNA_def_property_float_sdna(prop, NULL, "offset");
3086 RNA_def_property_range(prop, -FLT_MAX, FLT_MAX);
3087 RNA_def_property_ui_range(prop, -10, 10, 0.1, 4);
3088 RNA_def_property_ui_text(prop, "Thickness", "Thickness of the shell");
3089 RNA_def_property_update(prop, 0, "rna_Modifier_update");
3091 prop = RNA_def_property(srna, "thickness_clamp", PROP_FLOAT, PROP_FACTOR);
3092 RNA_def_property_float_sdna(prop, NULL, "offset_clamp");
3093 RNA_def_property_range(prop, 0, 100.0);
3094 RNA_def_property_ui_range(prop, 0, 2.0, 0.1, 4);
3095 RNA_def_property_ui_text(prop, "Clamp", "Offset clamp based on geometry scale");
3096 RNA_def_property_update(prop, 0, "rna_Modifier_update");
3098 prop = RNA_def_property(srna, "thickness_vertex_group", PROP_FLOAT, PROP_FACTOR);
3099 RNA_def_property_float_sdna(prop, NULL, "offset_fac_vg");
3100 RNA_def_property_range(prop, 0.0, 1.0);
3101 RNA_def_property_ui_range(prop, 0, 1, 0.1, 3);
3102 RNA_def_property_ui_text(prop, "Vertex Group Factor",
3103 "Thickness factor to use for zero vertex group influence");
3104 RNA_def_property_update(prop, 0, "rna_Modifier_update");
3106 prop = RNA_def_property(srna, "offset", PROP_FLOAT, PROP_FACTOR);
3107 RNA_def_property_float_sdna(prop, NULL, "offset_fac");
3108 RNA_def_property_range(prop, -FLT_MAX, FLT_MAX);
3109 RNA_def_property_ui_range(prop, -1, 1, 0.1, 4);
3110 RNA_def_property_ui_text(prop, "Offset", "Offset the thickness from the center");
3111 RNA_def_property_update(prop, 0, "rna_Modifier_update");
3113 prop = RNA_def_property(srna, "edge_crease_inner", PROP_FLOAT, PROP_FACTOR);
3114 RNA_def_property_float_sdna(prop, NULL, "crease_inner");
3115 RNA_def_property_range(prop, 0, 1);
3116 RNA_def_property_ui_range(prop, 0, 1, 0.1, 3);
3117 RNA_def_property_ui_text(prop, "Inner Crease", "Assign a crease to inner edges");
3118 RNA_def_property_update(prop, 0, "rna_Modifier_update");
3120 prop = RNA_def_property(srna, "edge_crease_outer", PROP_FLOAT, PROP_FACTOR);
3121 RNA_def_property_float_sdna(prop, NULL, "crease_outer");
3122 RNA_def_property_range(prop, 0, 1);
3123 RNA_def_property_ui_range(prop, 0, 1, 0.1, 3);
3124 RNA_def_property_ui_text(prop, "Outer Crease", "Assign a crease to outer edges");
3125 RNA_def_property_update(prop, 0, "rna_Modifier_update");
3127 prop = RNA_def_property(srna, "edge_crease_rim", PROP_FLOAT, PROP_FACTOR);
3128 RNA_def_property_float_sdna(prop, NULL, "crease_rim");
3129 RNA_def_property_range(prop, 0, 1);
3130 RNA_def_property_ui_range(prop, 0, 1, 0.1, 3);
3131 RNA_def_property_ui_text(prop, "Rim Crease", "Assign a crease to the edges making up the rim");
3132 RNA_def_property_update(prop, 0, "rna_Modifier_update");
3134 prop = RNA_def_property(srna, "material_offset", PROP_INT, PROP_NONE);
3135 RNA_def_property_int_sdna(prop, NULL, "mat_ofs");
3136 RNA_def_property_range(prop, SHRT_MIN, SHRT_MAX);
3137 RNA_def_property_ui_text(prop, "Material Offset", "Offset material index of generated faces");
3138 RNA_def_property_update(prop, 0, "rna_Modifier_update");
3140 prop = RNA_def_property(srna, "material_offset_rim", PROP_INT, PROP_NONE);
3141 RNA_def_property_int_sdna(prop, NULL, "mat_ofs_rim");
3142 RNA_def_property_range(prop, SHRT_MIN, SHRT_MAX);
3143 RNA_def_property_ui_text(prop, "Rim Material Offset", "Offset material index of generated rim faces");
3144 RNA_def_property_update(prop, 0, "rna_Modifier_update");
3146 prop = RNA_def_property(srna, "vertex_group", PROP_STRING, PROP_NONE);
3147 RNA_def_property_string_sdna(prop, NULL, "defgrp_name");
3148 RNA_def_property_ui_text(prop, "Vertex Group", "Vertex group name");
3149 RNA_def_property_string_funcs(prop, NULL, NULL, "rna_SolidifyModifier_defgrp_name_set");
3150 RNA_def_property_update(prop, 0, "rna_Modifier_update");
3152 prop = RNA_def_property(srna, "use_rim", PROP_BOOLEAN, PROP_NONE);
3153 RNA_def_property_boolean_sdna(prop, NULL, "flag", MOD_SOLIDIFY_RIM);
3154 RNA_def_property_ui_text(prop, "Fill Rim",