From e0e3038b1e7aec26da7161defa5a34b5d9373b5c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Cl=C3=A9ment=20Foucault?= Date: Tue, 29 May 2018 11:20:37 +0200 Subject: Hair Particles: DNA: Add properties for new GPU hairs. Hair Particles shape properties are ported from cycles. Thoses properties have the same defaults and have a do_version of their own. Cycles will use theses properties instead of its custom ones. Some realtime engine specific settings are also added to scene->r because it's much easier to control as global values. Bumping Version number so cycles can do its own do_version on top of the default settings. --- source/blender/makesrna/intern/rna_particle.c | 32 +++++++++++++++++++++++++++ source/blender/makesrna/intern/rna_scene.c | 19 ++++++++++++++-- 2 files changed, 49 insertions(+), 2 deletions(-) (limited to 'source/blender/makesrna') diff --git a/source/blender/makesrna/intern/rna_particle.c b/source/blender/makesrna/intern/rna_particle.c index 17e9a6604fd..52c97130ada 100644 --- a/source/blender/makesrna/intern/rna_particle.c +++ b/source/blender/makesrna/intern/rna_particle.c @@ -3147,6 +3147,38 @@ static void rna_def_particle_settings(BlenderRNA *brna) RNA_def_property_clear_flag(prop, PROP_EDITABLE); RNA_def_property_ui_text(prop, "Twist Curve", "Curve defining twist"); RNA_def_property_update(prop, 0, "rna_Particle_redo_child"); + + /* hair shape */ + prop = RNA_def_property(srna, "use_close_tip", PROP_BOOLEAN, PROP_NONE); + RNA_def_property_boolean_sdna(prop, NULL, "shape_flag", PART_SHAPE_CLOSE_TIP); + RNA_def_property_ui_text(prop, "Close Tip", "Set tip radius to zero"); + RNA_def_property_update(prop, 0, "rna_Particle_redo"); /* TODO: Only need to tell the render engine to update. */ + + prop = RNA_def_property(srna, "shape", PROP_FLOAT, PROP_FACTOR); + RNA_def_property_range(prop, -1.0f, 1.0f); + RNA_def_property_ui_text(prop, "Shape", "Strand shape parameter"); + RNA_def_property_update(prop, 0, "rna_Particle_redo"); /* TODO: Only need to tell the render engine to update. */ + + prop = RNA_def_property(srna, "root_radius", PROP_FLOAT, PROP_NONE); + RNA_def_property_float_sdna(prop, NULL, "rad_root"); + RNA_def_property_range(prop, 0.0f, FLT_MAX); + RNA_def_property_ui_range(prop, 0.0f, 10.0f, 0.1, 2); + RNA_def_property_ui_text(prop, "Root", "Strand width at the root"); + RNA_def_property_update(prop, 0, "rna_Particle_redo"); /* TODO: Only need to tell the render engine to update. */ + + prop = RNA_def_property(srna, "tip_radius", PROP_FLOAT, PROP_NONE); + RNA_def_property_float_sdna(prop, NULL, "rad_tip"); + RNA_def_property_range(prop, 0.0f, FLT_MAX); + RNA_def_property_ui_range(prop, 0.0f, 10.0f, 0.1, 2); + RNA_def_property_ui_text(prop, "Tip", "Strand width at the tip"); + RNA_def_property_update(prop, 0, "rna_Particle_redo"); /* TODO: Only need to tell the render engine to update. */ + + prop = RNA_def_property(srna, "radius_scale", PROP_FLOAT, PROP_NONE); + RNA_def_property_float_sdna(prop, NULL, "rad_scale"); + RNA_def_property_range(prop, 0.0f, FLT_MAX); + RNA_def_property_ui_range(prop, 0.0f, 10.0f, 0.1, 2); + RNA_def_property_ui_text(prop, "Scaling", "Multiplier of radius properties."); + RNA_def_property_update(prop, 0, "rna_Particle_redo"); /* TODO: Only need to tell the render engine to update. */ } static void rna_def_particle_target(BlenderRNA *brna) diff --git a/source/blender/makesrna/intern/rna_scene.c b/source/blender/makesrna/intern/rna_scene.c index d60c9b2d99b..1530c7fc483 100644 --- a/source/blender/makesrna/intern/rna_scene.c +++ b/source/blender/makesrna/intern/rna_scene.c @@ -4817,7 +4817,11 @@ static void rna_def_scene_render_data(BlenderRNA *brna) {0, NULL, 0, NULL, NULL} }; - + static const EnumPropertyItem hair_shape_type_items[] = { + {SCE_HAIR_SHAPE_STRAND, "STRAND", 0, "Strand", ""}, + {SCE_HAIR_SHAPE_STRIP, "STRIP", 0, "Strip", ""}, + {0, NULL, 0, NULL, NULL} + }; rna_def_scene_ffmpeg_settings(brna); @@ -5016,7 +5020,18 @@ static void rna_def_scene_render_data(BlenderRNA *brna) RNA_def_property_pointer_sdna(prop, NULL, "mblur_shutter_curve"); RNA_def_property_struct_type(prop, "CurveMapping"); RNA_def_property_ui_text(prop, "Shutter Curve", "Curve defining the shutter's openness over time"); - + + /* Hairs */ + prop = RNA_def_property(srna, "hair_type", PROP_ENUM, PROP_NONE); + RNA_def_property_enum_items(prop, hair_shape_type_items); + RNA_def_property_ui_text(prop, "Hair Shape Type", "Hair shape type"); + RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, "rna_Scene_glsl_update"); + + prop = RNA_def_property(srna, "hair_subdiv", PROP_INT, PROP_NONE); + RNA_def_property_range(prop, 0, 3); + RNA_def_property_ui_text(prop, "Additional Subdiv", "Additional subdivision along the hair"); + RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, "rna_Scene_glsl_update"); + /* border */ prop = RNA_def_property(srna, "use_border", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "mode", R_BORDER); -- cgit v1.2.3