|
Blender
V2.59
|
00001 /* 00002 * $Id: rna_sculpt_paint.c 37031 2011-05-31 02:14:25Z campbellbarton $ 00003 * 00004 * ***** BEGIN GPL LICENSE BLOCK ***** 00005 * 00006 * This program is free software; you can redistribute it and/or 00007 * modify it under the terms of the GNU General Public License 00008 * as published by the Free Software Foundation; either version 2 00009 * of the License, or (at your option) any later version. 00010 * 00011 * This program is distributed in the hope that it will be useful, 00012 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00013 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00014 * GNU General Public License for more details. 00015 * 00016 * You should have received a copy of the GNU General Public License 00017 * along with this program; if not, write to the Free Software Foundation, 00018 * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 00019 * 00020 * Contributor(s): Campbell Barton 00021 * 00022 * ***** END GPL LICENSE BLOCK ***** 00023 */ 00024 00030 #include <stdlib.h> 00031 00032 #include "RNA_define.h" 00033 00034 #include "rna_internal.h" 00035 00036 #include "DNA_ID.h" 00037 #include "DNA_scene_types.h" 00038 #include "DNA_brush_types.h" 00039 00040 #include "BKE_paint.h" 00041 00042 #include "WM_api.h" 00043 #include "WM_types.h" 00044 00045 static EnumPropertyItem particle_edit_hair_brush_items[] = { 00046 {PE_BRUSH_NONE, "NONE", 0, "None", "Don't use any brush"}, 00047 {PE_BRUSH_COMB, "COMB", 0, "Comb", "Comb hairs"}, 00048 {PE_BRUSH_SMOOTH, "SMOOTH", 0, "Smooth", "Smooth hairs"}, 00049 {PE_BRUSH_ADD, "ADD", 0, "Add", "Add hairs"}, 00050 {PE_BRUSH_LENGTH, "LENGTH", 0, "Length", "Make hairs longer or shorter"}, 00051 {PE_BRUSH_PUFF, "PUFF", 0, "Puff", "Make hairs stand up"}, 00052 {PE_BRUSH_CUT, "CUT", 0, "Cut", "Cut hairs"}, 00053 {PE_BRUSH_WEIGHT, "WEIGHT", 0, "Weight", "Weight hair particles"}, 00054 {0, NULL, 0, NULL, NULL}}; 00055 00056 #ifdef RNA_RUNTIME 00057 #include "MEM_guardedalloc.h" 00058 00059 #include "BKE_context.h" 00060 #include "BKE_pointcache.h" 00061 #include "BKE_particle.h" 00062 #include "BKE_depsgraph.h" 00063 00064 #include "ED_particle.h" 00065 00066 static EnumPropertyItem particle_edit_disconnected_hair_brush_items[] = { 00067 {PE_BRUSH_NONE, "NONE", 0, "None", "Don't use any brush"}, 00068 {PE_BRUSH_COMB, "COMB", 0, "Comb", "Comb hairs"}, 00069 {PE_BRUSH_SMOOTH, "SMOOTH", 0, "Smooth", "Smooth hairs"}, 00070 {PE_BRUSH_LENGTH, "LENGTH", 0, "Length", "Make hairs longer or shorter"}, 00071 {PE_BRUSH_CUT, "CUT", 0, "Cut", "Cut hairs"}, 00072 {PE_BRUSH_WEIGHT, "WEIGHT", 0, "Weight", "Weight hair particles"}, 00073 {0, NULL, 0, NULL, NULL}}; 00074 00075 static EnumPropertyItem particle_edit_cache_brush_items[] = { 00076 {PE_BRUSH_NONE, "NONE", 0, "None", "Don't use any brush"}, 00077 {PE_BRUSH_COMB, "COMB", 0, "Comb", "Comb paths"}, 00078 {PE_BRUSH_SMOOTH, "SMOOTH", 0, "Smooth", "Smooth paths"}, 00079 {PE_BRUSH_LENGTH, "LENGTH", 0, "Length", "Make paths longer or shorter"}, 00080 {0, NULL, 0, NULL, NULL}}; 00081 00082 static PointerRNA rna_ParticleEdit_brush_get(PointerRNA *ptr) 00083 { 00084 ParticleEditSettings *pset= (ParticleEditSettings*)ptr->data; 00085 ParticleBrushData *brush= NULL; 00086 00087 if(pset->brushtype != PE_BRUSH_NONE) 00088 brush= &pset->brush[pset->brushtype]; 00089 00090 return rna_pointer_inherit_refine(ptr, &RNA_ParticleBrush, brush); 00091 } 00092 00093 static PointerRNA rna_ParticleBrush_curve_get(PointerRNA *ptr) 00094 { 00095 return rna_pointer_inherit_refine(ptr, &RNA_CurveMapping, NULL); 00096 } 00097 00098 static void rna_ParticleEdit_redo(Main *UNUSED(bmain), Scene *scene, PointerRNA *UNUSED(ptr)) 00099 { 00100 Object *ob= (scene->basact)? scene->basact->object: NULL; 00101 PTCacheEdit *edit = PE_get_current(scene, ob); 00102 00103 if(!edit) 00104 return; 00105 00106 psys_free_path_cache(edit->psys, edit); 00107 } 00108 00109 static void rna_ParticleEdit_update(Main *UNUSED(bmain), Scene *scene, PointerRNA *UNUSED(ptr)) 00110 { 00111 Object *ob= (scene->basact)? scene->basact->object: NULL; 00112 00113 if(ob) DAG_id_tag_update(&ob->id, OB_RECALC_DATA); 00114 } 00115 static void rna_ParticleEdit_tool_set(PointerRNA *ptr, int value) 00116 { 00117 ParticleEditSettings *pset= (ParticleEditSettings*)ptr->data; 00118 00119 /* redraw hair completely if weight brush is/was used */ 00120 if((pset->brushtype == PE_BRUSH_WEIGHT || value == PE_BRUSH_WEIGHT) && pset->scene) { 00121 Object *ob = (pset->scene->basact)? pset->scene->basact->object: NULL; 00122 if(ob) { 00123 DAG_id_tag_update(&ob->id, OB_RECALC_DATA); 00124 WM_main_add_notifier(NC_OBJECT|ND_PARTICLE|NA_EDITED, NULL); 00125 } 00126 } 00127 00128 pset->brushtype = value; 00129 } 00130 static EnumPropertyItem *rna_ParticleEdit_tool_itemf(bContext *C, PointerRNA *UNUSED(ptr), PropertyRNA *UNUSED(prop), int *UNUSED(free)) 00131 { 00132 Scene *scene= CTX_data_scene(C); 00133 Object *ob= (scene->basact)? scene->basact->object: NULL; 00134 PTCacheEdit *edit = PE_get_current(scene, ob); 00135 00136 if(edit && edit->psys) { 00137 if(edit->psys->flag & PSYS_GLOBAL_HAIR) 00138 return particle_edit_disconnected_hair_brush_items; 00139 else 00140 return particle_edit_hair_brush_items; 00141 } 00142 00143 return particle_edit_cache_brush_items; 00144 } 00145 00146 static int rna_ParticleEdit_editable_get(PointerRNA *ptr) 00147 { 00148 ParticleEditSettings *pset= (ParticleEditSettings*)ptr->data; 00149 00150 return (pset->object && pset->scene && PE_get_current(pset->scene, pset->object)); 00151 } 00152 static int rna_ParticleEdit_hair_get(PointerRNA *ptr) 00153 { 00154 ParticleEditSettings *pset= (ParticleEditSettings*)ptr->data; 00155 00156 if(pset->scene) { 00157 PTCacheEdit *edit = PE_get_current(pset->scene, pset->object); 00158 00159 return (edit && edit->psys); 00160 } 00161 00162 return 0; 00163 } 00164 00165 static int rna_Brush_mode_poll(PointerRNA *ptr, PointerRNA value) 00166 { 00167 Scene *scene= (Scene *)ptr->id.data; 00168 ToolSettings *ts = scene->toolsettings; 00169 Brush *brush= value.id.data; 00170 int mode = 0; 00171 00172 /* check the origin of the Paint struct to see which paint 00173 mode to select from */ 00174 00175 if(ptr->data == &ts->imapaint) 00176 mode = OB_MODE_TEXTURE_PAINT; 00177 else if(ptr->data == ts->sculpt) 00178 mode = OB_MODE_SCULPT; 00179 else if(ptr->data == ts->vpaint) 00180 mode = OB_MODE_VERTEX_PAINT; 00181 else if(ptr->data == ts->wpaint) 00182 mode = OB_MODE_WEIGHT_PAINT; 00183 00184 return brush->ob_mode & mode; 00185 } 00186 00187 static void rna_Sculpt_update(Main *UNUSED(bmain), Scene *scene, PointerRNA *UNUSED(ptr)) 00188 { 00189 Object *ob= (scene->basact)? scene->basact->object: NULL; 00190 00191 if(ob) { 00192 DAG_id_tag_update(&ob->id, OB_RECALC_DATA); 00193 WM_main_add_notifier(NC_OBJECT|ND_MODIFIER, ob); 00194 } 00195 } 00196 00197 #else 00198 00199 static void rna_def_paint(BlenderRNA *brna) 00200 { 00201 StructRNA *srna; 00202 PropertyRNA *prop; 00203 00204 srna= RNA_def_struct(brna, "Paint", NULL); 00205 RNA_def_struct_ui_text(srna, "Paint", ""); 00206 00207 /* Global Settings */ 00208 prop= RNA_def_property(srna, "brush", PROP_POINTER, PROP_NONE); 00209 RNA_def_property_flag(prop, PROP_EDITABLE); 00210 RNA_def_property_pointer_funcs(prop, NULL, NULL, NULL, "rna_Brush_mode_poll"); 00211 RNA_def_property_ui_text(prop, "Brush", "Active Brush"); 00212 RNA_def_property_update(prop, NC_BRUSH|NA_EDITED, NULL); 00213 00214 prop= RNA_def_property(srna, "show_brush", PROP_BOOLEAN, PROP_NONE); 00215 RNA_def_property_boolean_sdna(prop, NULL, "flags", PAINT_SHOW_BRUSH); 00216 RNA_def_property_ui_text(prop, "Show Brush", ""); 00217 00218 prop= RNA_def_property(srna, "show_brush_on_surface", PROP_BOOLEAN, PROP_NONE); 00219 RNA_def_property_boolean_sdna(prop, NULL, "flags", PAINT_SHOW_BRUSH_ON_SURFACE); 00220 RNA_def_property_ui_text(prop, "Show Brush On Surface", ""); 00221 00222 prop= RNA_def_property(srna, "show_low_resolution", PROP_BOOLEAN, PROP_NONE); 00223 RNA_def_property_boolean_sdna(prop, NULL, "flags", PAINT_FAST_NAVIGATE); 00224 RNA_def_property_ui_text(prop, "Fast Navigate", "For multires, show low resolution while navigating the view"); 00225 } 00226 00227 static void rna_def_sculpt(BlenderRNA *brna) 00228 { 00229 StructRNA *srna; 00230 PropertyRNA *prop; 00231 00232 srna= RNA_def_struct(brna, "Sculpt", "Paint"); 00233 RNA_def_struct_ui_text(srna, "Sculpt", ""); 00234 00235 prop= RNA_def_property(srna, "radial_symmetry", PROP_INT, PROP_XYZ); 00236 RNA_def_property_int_sdna(prop, NULL, "radial_symm"); 00237 RNA_def_property_int_default(prop, 1); 00238 RNA_def_property_range(prop, 1, 64); 00239 RNA_def_property_ui_range(prop, 0, 32, 1, 1); 00240 RNA_def_property_ui_text(prop, "Radial Symmetry Count X Axis", "Number of times to copy strokes across the surface"); 00241 00242 prop= RNA_def_property(srna, "use_symmetry_x", PROP_BOOLEAN, PROP_NONE); 00243 RNA_def_property_boolean_sdna(prop, NULL, "flags", SCULPT_SYMM_X); 00244 RNA_def_property_ui_text(prop, "Symmetry X", "Mirror brush across the X axis"); 00245 00246 prop= RNA_def_property(srna, "use_symmetry_y", PROP_BOOLEAN, PROP_NONE); 00247 RNA_def_property_boolean_sdna(prop, NULL, "flags", SCULPT_SYMM_Y); 00248 RNA_def_property_ui_text(prop, "Symmetry Y", "Mirror brush across the Y axis"); 00249 00250 prop= RNA_def_property(srna, "use_symmetry_z", PROP_BOOLEAN, PROP_NONE); 00251 RNA_def_property_boolean_sdna(prop, NULL, "flags", SCULPT_SYMM_Z); 00252 RNA_def_property_ui_text(prop, "Symmetry Z", "Mirror brush across the Z axis"); 00253 00254 prop= RNA_def_property(srna, "lock_x", PROP_BOOLEAN, PROP_NONE); 00255 RNA_def_property_boolean_sdna(prop, NULL, "flags", SCULPT_LOCK_X); 00256 RNA_def_property_ui_text(prop, "Lock X", "Disallow changes to the X axis of vertices"); 00257 00258 prop= RNA_def_property(srna, "lock_y", PROP_BOOLEAN, PROP_NONE); 00259 RNA_def_property_boolean_sdna(prop, NULL, "flags", SCULPT_LOCK_Y); 00260 RNA_def_property_ui_text(prop, "Lock Y", "Disallow changes to the Y axis of vertices"); 00261 00262 prop= RNA_def_property(srna, "lock_z", PROP_BOOLEAN, PROP_NONE); 00263 RNA_def_property_boolean_sdna(prop, NULL, "flags", SCULPT_LOCK_Z); 00264 RNA_def_property_ui_text(prop, "Lock Z", "Disallow changes to the Z axis of vertices"); 00265 00266 prop= RNA_def_property(srna, "use_symmetry_feather", PROP_BOOLEAN, PROP_NONE); 00267 RNA_def_property_boolean_sdna(prop, NULL, "flags", SCULPT_SYMMETRY_FEATHER); 00268 RNA_def_property_ui_text(prop, "Symmetry Feathering", "Reduce the strength of the brush where it overlaps symmetrical daubs"); 00269 00270 prop= RNA_def_property(srna, "use_threaded", PROP_BOOLEAN, PROP_NONE); 00271 RNA_def_property_boolean_sdna(prop, NULL, "flags", SCULPT_USE_OPENMP); 00272 RNA_def_property_ui_text(prop, "Use OpenMP", "Take advantage of multiple CPU cores to improve sculpting performance"); 00273 00274 prop= RNA_def_property(srna, "use_deform_only", PROP_BOOLEAN, PROP_NONE); 00275 RNA_def_property_boolean_sdna(prop, NULL, "flags", SCULPT_ONLY_DEFORM); 00276 RNA_def_property_ui_text(prop, "Use Deform Only", "Use only deformation modifiers (temporary disable all constructive modifiers except multi-resolution)"); 00277 RNA_def_property_update(prop, NC_OBJECT|ND_DRAW, "rna_Sculpt_update"); 00278 } 00279 00280 static void rna_def_vertex_paint(BlenderRNA *brna) 00281 { 00282 StructRNA *srna; 00283 PropertyRNA *prop; 00284 00285 srna= RNA_def_struct(brna, "VertexPaint", "Paint"); 00286 RNA_def_struct_sdna(srna, "VPaint"); 00287 RNA_def_struct_ui_text(srna, "Vertex Paint", "Properties of vertex and weight paint mode"); 00288 00289 prop= RNA_def_property(srna, "use_all_faces", PROP_BOOLEAN, PROP_NONE); 00290 RNA_def_property_boolean_sdna(prop, NULL, "flag", VP_AREA); 00291 RNA_def_property_ui_text(prop, "All Faces", "Paint on all faces inside brush"); 00292 00293 prop= RNA_def_property(srna, "use_normal", PROP_BOOLEAN, PROP_NONE); 00294 RNA_def_property_boolean_sdna(prop, NULL, "flag", VP_NORMALS); 00295 RNA_def_property_ui_text(prop, "Normals", "Applies the vertex normal before painting"); 00296 00297 prop= RNA_def_property(srna, "use_spray", PROP_BOOLEAN, PROP_NONE); 00298 RNA_def_property_boolean_sdna(prop, NULL, "flag", VP_SPRAY); 00299 RNA_def_property_ui_text(prop, "Spray", "Keep applying paint effect while holding mouse"); 00300 } 00301 00302 static void rna_def_image_paint(BlenderRNA *brna) 00303 { 00304 StructRNA *srna; 00305 PropertyRNA *prop; 00306 00307 srna= RNA_def_struct(brna, "ImagePaint", "Paint"); 00308 RNA_def_struct_sdna(srna, "ImagePaintSettings"); 00309 RNA_def_struct_ui_text(srna, "Image Paint", "Properties of image and texture painting mode"); 00310 00311 /* booleans */ 00312 prop= RNA_def_property(srna, "use_projection", PROP_BOOLEAN, PROP_NONE); 00313 RNA_def_property_boolean_negative_sdna(prop, NULL, "flag", IMAGEPAINT_PROJECT_DISABLE); 00314 RNA_def_property_ui_text(prop, "Project Paint", "Use projection painting for improved consistency in the brush strokes"); 00315 00316 prop= RNA_def_property(srna, "use_occlude", PROP_BOOLEAN, PROP_NONE); 00317 RNA_def_property_boolean_negative_sdna(prop, NULL, "flag", IMAGEPAINT_PROJECT_XRAY); 00318 RNA_def_property_ui_text(prop, "Occlude", "Only paint onto the faces directly under the brush (slower)"); 00319 00320 prop= RNA_def_property(srna, "use_backface_culling", PROP_BOOLEAN, PROP_NONE); 00321 RNA_def_property_boolean_negative_sdna(prop, NULL, "flag", IMAGEPAINT_PROJECT_BACKFACE); 00322 RNA_def_property_ui_text(prop, "Cull", "Ignore faces pointing away from the view (faster)"); 00323 00324 prop= RNA_def_property(srna, "use_normal_falloff", PROP_BOOLEAN, PROP_NONE); 00325 RNA_def_property_boolean_negative_sdna(prop, NULL, "flag", IMAGEPAINT_PROJECT_FLAT); 00326 RNA_def_property_ui_text(prop, "Normal", "Paint most on faces pointing towards the view"); 00327 00328 prop= RNA_def_property(srna, "use_stencil_layer", PROP_BOOLEAN, PROP_NONE); 00329 RNA_def_property_boolean_sdna(prop, NULL, "flag", IMAGEPAINT_PROJECT_LAYER_STENCIL); 00330 RNA_def_property_ui_text(prop, "Stencil Layer", "Set the mask layer from the UV layer buttons"); 00331 00332 prop= RNA_def_property(srna, "invert_stencil", PROP_BOOLEAN, PROP_NONE); 00333 RNA_def_property_boolean_sdna(prop, NULL, "flag", IMAGEPAINT_PROJECT_LAYER_STENCIL_INV); 00334 RNA_def_property_ui_text(prop, "Invert", "Invert the stencil layer"); 00335 00336 prop= RNA_def_property(srna, "use_clone_layer", PROP_BOOLEAN, PROP_NONE); 00337 RNA_def_property_boolean_sdna(prop, NULL, "flag", IMAGEPAINT_PROJECT_LAYER_CLONE); 00338 RNA_def_property_ui_text(prop, "Clone Layer", "Use another UV layer as clone source, otherwise use 3D the cursor as the source"); 00339 00340 /* integers */ 00341 00342 prop= RNA_def_property(srna, "seam_bleed", PROP_INT, PROP_UNSIGNED); 00343 RNA_def_property_ui_range(prop, 0, 8, 0, 0); 00344 RNA_def_property_ui_text(prop, "Bleed", "Extend paint beyond the faces UVs to reduce seams (in pixels, slower)"); 00345 00346 prop= RNA_def_property(srna, "normal_angle", PROP_INT, PROP_UNSIGNED); 00347 RNA_def_property_range(prop, 0, 90); 00348 RNA_def_property_ui_text(prop, "Angle", "Paint most on faces pointing towards the view according to this angle"); 00349 00350 prop= RNA_def_int_array(srna, "screen_grab_size", 2, NULL, 0, 0, "screen_grab_size", "Size to capture the image for re-projecting", 0, 0); 00351 RNA_def_property_range(prop, 512, 16384); 00352 } 00353 00354 static void rna_def_particle_edit(BlenderRNA *brna) 00355 { 00356 StructRNA *srna; 00357 PropertyRNA *prop; 00358 00359 static EnumPropertyItem select_mode_items[] = { 00360 {SCE_SELECT_PATH, "PATH", ICON_PARTICLE_PATH, "Path", "Path edit mode"}, 00361 {SCE_SELECT_POINT, "POINT", ICON_PARTICLE_POINT, "Point", "Point select mode"}, 00362 {SCE_SELECT_END, "TIP", ICON_PARTICLE_TIP, "Tip", "Tip select mode"}, 00363 {0, NULL, 0, NULL, NULL}}; 00364 00365 static EnumPropertyItem puff_mode[] = { 00366 {0, "ADD", 0, "Add", "Make hairs more puffy"}, 00367 {1, "SUB", 0, "Sub", "Make hairs less puffy"}, 00368 {0, NULL, 0, NULL, NULL}}; 00369 00370 static EnumPropertyItem length_mode[] = { 00371 {0, "GROW", 0, "Grow", "Make hairs longer"}, 00372 {1, "SHRINK", 0, "Shrink", "Make hairs shorter"}, 00373 {0, NULL, 0, NULL, NULL}}; 00374 00375 static EnumPropertyItem edit_type_items[]= { 00376 {PE_TYPE_PARTICLES, "PARTICLES", 0, "Particles", ""}, 00377 {PE_TYPE_SOFTBODY, "SOFT_BODY", 0, "Soft body", ""}, 00378 {PE_TYPE_CLOTH, "CLOTH", 0, "Cloth", ""}, 00379 {0, NULL, 0, NULL, NULL} 00380 }; 00381 00382 00383 /* edit */ 00384 00385 srna= RNA_def_struct(brna, "ParticleEdit", NULL); 00386 RNA_def_struct_sdna(srna, "ParticleEditSettings"); 00387 RNA_def_struct_ui_text(srna, "Particle Edit", "Properties of particle editing mode"); 00388 00389 prop= RNA_def_property(srna, "tool", PROP_ENUM, PROP_NONE); 00390 RNA_def_property_enum_sdna(prop, NULL, "brushtype"); 00391 RNA_def_property_enum_items(prop, particle_edit_hair_brush_items); 00392 RNA_def_property_enum_funcs(prop, NULL, "rna_ParticleEdit_tool_set", "rna_ParticleEdit_tool_itemf"); 00393 RNA_def_property_ui_text(prop, "Tool", ""); 00394 00395 prop= RNA_def_property(srna, "select_mode", PROP_ENUM, PROP_NONE); 00396 RNA_def_property_enum_bitflag_sdna(prop, NULL, "selectmode"); 00397 RNA_def_property_enum_items(prop, select_mode_items); 00398 RNA_def_property_ui_text(prop, "Selection Mode", "Particle select and display mode"); 00399 RNA_def_property_update(prop, NC_OBJECT|ND_DRAW, "rna_ParticleEdit_update"); 00400 00401 prop= RNA_def_property(srna, "use_preserve_length", PROP_BOOLEAN, PROP_NONE); 00402 RNA_def_property_boolean_sdna(prop, NULL, "flag", PE_KEEP_LENGTHS); 00403 RNA_def_property_ui_text(prop, "Keep Lengths", "Keep path lengths constant"); 00404 00405 prop= RNA_def_property(srna, "use_preserve_root", PROP_BOOLEAN, PROP_NONE); 00406 RNA_def_property_boolean_sdna(prop, NULL, "flag", PE_LOCK_FIRST); 00407 RNA_def_property_ui_text(prop, "Keep Root", "Keep root keys unmodified"); 00408 00409 prop= RNA_def_property(srna, "use_emitter_deflect", PROP_BOOLEAN, PROP_NONE); 00410 RNA_def_property_boolean_sdna(prop, NULL, "flag", PE_DEFLECT_EMITTER); 00411 RNA_def_property_ui_text(prop, "Deflect Emitter", "Keep paths from intersecting the emitter"); 00412 00413 prop= RNA_def_property(srna, "emitter_distance", PROP_FLOAT, PROP_UNSIGNED); 00414 RNA_def_property_float_sdna(prop, NULL, "emitterdist"); 00415 RNA_def_property_ui_range(prop, 0.0f, 10.0f, 10, 3); 00416 RNA_def_property_ui_text(prop, "Emitter Distance", "Distance to keep particles away from the emitter"); 00417 00418 prop= RNA_def_property(srna, "use_fade_time", PROP_BOOLEAN, PROP_NONE); 00419 RNA_def_property_boolean_sdna(prop, NULL, "flag", PE_FADE_TIME); 00420 RNA_def_property_ui_text(prop, "Fade Time", "Fade paths and keys further away from current frame"); 00421 RNA_def_property_update(prop, NC_OBJECT|ND_DRAW, "rna_ParticleEdit_update"); 00422 00423 prop= RNA_def_property(srna, "use_auto_velocity", PROP_BOOLEAN, PROP_NONE); 00424 RNA_def_property_boolean_sdna(prop, NULL, "flag", PE_AUTO_VELOCITY); 00425 RNA_def_property_ui_text(prop, "Auto Velocity", "Calculate point velocities automatically"); 00426 00427 prop= RNA_def_property(srna, "show_particles", PROP_BOOLEAN, PROP_NONE); 00428 RNA_def_property_boolean_sdna(prop, NULL, "flag", PE_DRAW_PART); 00429 RNA_def_property_ui_text(prop, "Draw Particles", "Draw actual particles"); 00430 RNA_def_property_update(prop, NC_OBJECT|ND_DRAW, "rna_ParticleEdit_redo"); 00431 00432 prop= RNA_def_property(srna, "use_default_interpolate", PROP_BOOLEAN, PROP_NONE); 00433 RNA_def_property_boolean_sdna(prop, NULL, "flag", PE_INTERPOLATE_ADDED); 00434 RNA_def_property_ui_text(prop, "Interpolate", "Interpolate new particles from the existing ones"); 00435 00436 prop= RNA_def_property(srna, "default_key_count", PROP_INT, PROP_NONE); 00437 RNA_def_property_int_sdna(prop, NULL, "totaddkey"); 00438 RNA_def_property_range(prop, 2, SHRT_MAX); 00439 RNA_def_property_ui_range(prop, 2, 20, 10, 3); 00440 RNA_def_property_ui_text(prop, "Keys", "How many keys to make new particles with"); 00441 00442 prop= RNA_def_property(srna, "brush", PROP_POINTER, PROP_NONE); 00443 RNA_def_property_struct_type(prop, "ParticleBrush"); 00444 RNA_def_property_pointer_funcs(prop, "rna_ParticleEdit_brush_get", NULL, NULL, NULL); 00445 RNA_def_property_ui_text(prop, "Brush", ""); 00446 00447 prop= RNA_def_property(srna, "draw_step", PROP_INT, PROP_NONE); 00448 RNA_def_property_range(prop, 2, 10); 00449 RNA_def_property_ui_text(prop, "Steps", "How many steps to draw the path with"); 00450 RNA_def_property_update(prop, NC_OBJECT|ND_DRAW, "rna_ParticleEdit_redo"); 00451 00452 prop= RNA_def_property(srna, "fade_frames", PROP_INT, PROP_NONE); 00453 RNA_def_property_range(prop, 2, 100); 00454 RNA_def_property_ui_text(prop, "Frames", "How many frames to fade"); 00455 RNA_def_property_update(prop, NC_OBJECT|ND_DRAW, "rna_ParticleEdit_update"); 00456 00457 prop= RNA_def_property(srna, "type", PROP_ENUM, PROP_NONE); 00458 RNA_def_property_enum_sdna(prop, NULL, "edittype"); 00459 RNA_def_property_enum_items(prop, edit_type_items); 00460 RNA_def_property_ui_text(prop, "Type", ""); 00461 RNA_def_property_update(prop, NC_OBJECT|ND_DRAW, "rna_ParticleEdit_redo"); 00462 00463 prop= RNA_def_property(srna, "is_editable", PROP_BOOLEAN, PROP_NONE); 00464 RNA_def_property_boolean_funcs(prop, "rna_ParticleEdit_editable_get", NULL); 00465 RNA_def_property_clear_flag(prop, PROP_EDITABLE); 00466 RNA_def_property_ui_text(prop, "Editable", "A valid edit mode exists"); 00467 00468 prop= RNA_def_property(srna, "is_hair", PROP_BOOLEAN, PROP_NONE); 00469 RNA_def_property_boolean_funcs(prop, "rna_ParticleEdit_hair_get", NULL); 00470 RNA_def_property_clear_flag(prop, PROP_EDITABLE); 00471 RNA_def_property_ui_text(prop, "Hair", "Editing hair"); 00472 00473 prop= RNA_def_property(srna, "object", PROP_POINTER, PROP_NONE); 00474 RNA_def_property_clear_flag(prop, PROP_EDITABLE); 00475 RNA_def_property_ui_text(prop, "Object", "The edited object"); 00476 00477 00478 /* brush */ 00479 00480 srna= RNA_def_struct(brna, "ParticleBrush", NULL); 00481 RNA_def_struct_sdna(srna, "ParticleBrushData"); 00482 RNA_def_struct_ui_text(srna, "Particle Brush", "Particle editing brush"); 00483 00484 prop= RNA_def_property(srna, "size", PROP_INT, PROP_DISTANCE); 00485 RNA_def_property_range(prop, 1, SHRT_MAX); 00486 RNA_def_property_ui_range(prop, 1, 100, 10, 3); 00487 RNA_def_property_ui_text(prop, "Radius", "Radius of the brush in pixels"); 00488 00489 prop= RNA_def_property(srna, "strength", PROP_FLOAT, PROP_FACTOR); 00490 RNA_def_property_range(prop, 0.001, 1.0); 00491 RNA_def_property_ui_text(prop, "Strength", "Brush strength"); 00492 00493 prop= RNA_def_property(srna, "count", PROP_INT, PROP_NONE); 00494 RNA_def_property_range(prop, 1, 1000); 00495 RNA_def_property_ui_range(prop, 1, 100, 10, 3); 00496 RNA_def_property_ui_text(prop, "Count", "Particle count"); 00497 00498 prop= RNA_def_property(srna, "steps", PROP_INT, PROP_NONE); 00499 RNA_def_property_int_sdna(prop, NULL, "step"); 00500 RNA_def_property_range(prop, 1, SHRT_MAX); 00501 RNA_def_property_ui_range(prop, 1, 50, 10, 3); 00502 RNA_def_property_ui_text(prop, "Steps", "Brush steps"); 00503 00504 prop= RNA_def_property(srna, "puff_mode", PROP_ENUM, PROP_NONE); 00505 RNA_def_property_enum_sdna(prop, NULL, "invert"); 00506 RNA_def_property_enum_items(prop, puff_mode); 00507 RNA_def_property_ui_text(prop, "Puff Mode", ""); 00508 00509 prop= RNA_def_property(srna, "use_puff_volume", PROP_BOOLEAN, PROP_NONE); 00510 RNA_def_property_boolean_sdna(prop, NULL, "flag", PE_BRUSH_DATA_PUFF_VOLUME); 00511 RNA_def_property_ui_text(prop, "Puff Volume", "Apply puff to unselected end-points, (helps maintain hair volume when puffing root)"); 00512 00513 prop= RNA_def_property(srna, "length_mode", PROP_ENUM, PROP_NONE); 00514 RNA_def_property_enum_sdna(prop, NULL, "invert"); 00515 RNA_def_property_enum_items(prop, length_mode); 00516 RNA_def_property_ui_text(prop, "Length Mode", ""); 00517 00518 /* dummy */ 00519 prop= RNA_def_property(srna, "curve", PROP_POINTER, PROP_NONE); 00520 RNA_def_property_struct_type(prop, "CurveMapping"); 00521 RNA_def_property_pointer_funcs(prop, "rna_ParticleBrush_curve_get", NULL, NULL, NULL); 00522 RNA_def_property_ui_text(prop, "Curve", ""); 00523 } 00524 00525 void RNA_def_sculpt_paint(BlenderRNA *brna) 00526 { 00527 rna_def_paint(brna); 00528 rna_def_sculpt(brna); 00529 rna_def_vertex_paint(brna); 00530 rna_def_image_paint(brna); 00531 rna_def_particle_edit(brna); 00532 } 00533 00534 #endif 00535