forked from bartvdbraak/blender
Hair ui simplification:
* There were a lot of settings in the particle panels that made no sense for simple hair and only cluttered up the ui. * Now these settings are hidden by default unless "advanced" hair options are shown. * Without advanced options the particle velocity controls are replaced by a simple "hair length" value, which actually corresponds to the grown hair length in blender units. * Some hair effector options that are actually very useful were not shown in ui. These are now found in the "field weights" panel.
This commit is contained in:
parent
a17d81cabf
commit
44fb6bd1fa
@ -128,6 +128,7 @@ class PARTICLE_PT_context_particles(ParticleButtonsPanel, bpy.types.Panel):
|
||||
row = split.row()
|
||||
row.enabled = particle_panel_enabled(context, psys)
|
||||
row.prop(part, "regrow_hair")
|
||||
row.prop(part, "use_advanced_hair")
|
||||
row = split.row()
|
||||
row.enabled = particle_panel_enabled(context, psys)
|
||||
row.prop(part, "hair_step")
|
||||
@ -173,6 +174,10 @@ class PARTICLE_PT_emission(ParticleButtonsPanel, bpy.types.Panel):
|
||||
row.active = part.distribution != 'GRID'
|
||||
row.prop(part, "count")
|
||||
|
||||
if part.type == 'HAIR' and not part.use_advanced_hair:
|
||||
row.prop(part, "hair_length")
|
||||
return
|
||||
|
||||
if part.type != 'HAIR':
|
||||
split = layout.split()
|
||||
|
||||
@ -303,6 +308,8 @@ class PARTICLE_PT_velocity(ParticleButtonsPanel, bpy.types.Panel):
|
||||
def poll(cls, context):
|
||||
if particle_panel_poll(PARTICLE_PT_velocity, context):
|
||||
psys = context.particle_system
|
||||
if psys.settings.type == 'HAIR' and not psys.settings.use_advanced_hair:
|
||||
return False
|
||||
return psys.settings.physics_type != 'BOIDS' and not psys.point_cache.use_external
|
||||
else:
|
||||
return False
|
||||
@ -351,6 +358,8 @@ class PARTICLE_PT_rotation(ParticleButtonsPanel, bpy.types.Panel):
|
||||
def poll(cls, context):
|
||||
if particle_panel_poll(PARTICLE_PT_rotation, context):
|
||||
psys = context.particle_system
|
||||
if psys.settings.type == 'HAIR' and not psys.settings.use_advanced_hair:
|
||||
return False
|
||||
return psys.settings.physics_type != 'BOIDS' and not psys.point_cache.use_external
|
||||
else:
|
||||
return False
|
||||
@ -393,7 +402,10 @@ class PARTICLE_PT_physics(ParticleButtonsPanel, bpy.types.Panel):
|
||||
@classmethod
|
||||
def poll(cls, context):
|
||||
if particle_panel_poll(PARTICLE_PT_physics, context):
|
||||
return not context.particle_system.point_cache.use_external
|
||||
psys = context.particle_system
|
||||
if psys.settings.type == 'HAIR' and not psys.settings.use_advanced_hair:
|
||||
return False
|
||||
return not psys.point_cache.use_external
|
||||
else:
|
||||
return False
|
||||
|
||||
@ -1032,7 +1044,11 @@ class PARTICLE_PT_field_weights(ParticleButtonsPanel, bpy.types.Panel):
|
||||
effector_weights_ui(self, context, part.effector_weights)
|
||||
|
||||
if part.type == 'HAIR':
|
||||
self.layout.prop(part.effector_weights, "apply_to_hair_growing")
|
||||
row = self.layout.row()
|
||||
row.prop(part.effector_weights, "apply_to_hair_growing")
|
||||
row.prop(part, "apply_effector_to_children")
|
||||
row = self.layout.row()
|
||||
row.prop(part, "effect_hair", slider=True)
|
||||
|
||||
|
||||
class PARTICLE_PT_force_fields(ParticleButtonsPanel, bpy.types.Panel):
|
||||
|
@ -3473,7 +3473,7 @@ static void default_particle_settings(ParticleSettings *part)
|
||||
part->bb_uv_split=1;
|
||||
part->bb_align=PART_BB_VIEW;
|
||||
part->bb_split_offset=PART_BB_OFF_LINEAR;
|
||||
part->flag=PART_EDISTR|PART_TRAND;
|
||||
part->flag=PART_EDISTR|PART_TRAND|PART_HIDE_ADVANCED_HAIR;
|
||||
|
||||
part->sta= 1.0;
|
||||
part->end= 200.0;
|
||||
|
@ -304,7 +304,7 @@ typedef struct ParticleSystem{ /* note, make sure all (runtime) are NULL's in
|
||||
#define PART_ROT_DYN (1<<14) /* dynamic rotation */
|
||||
#define PART_SIZEMASS (1<<16)
|
||||
|
||||
//#define PART_HAIR_GRAVITY (1<<15)
|
||||
#define PART_HIDE_ADVANCED_HAIR (1<<15)
|
||||
|
||||
//#define PART_ABS_TIME (1<<17)
|
||||
//#define PART_GLOB_TIME (1<<18)
|
||||
|
@ -387,6 +387,18 @@ static void rna_PartSettings_end_set(struct PointerRNA *ptr, float value)
|
||||
settings->end = value;
|
||||
}
|
||||
|
||||
static void rna_PartSetting_hairlength_set(struct PointerRNA *ptr, float value)
|
||||
{
|
||||
ParticleSettings *settings = (ParticleSettings*)ptr->data;
|
||||
settings->normfac = value / 4.f;
|
||||
}
|
||||
|
||||
static float rna_PartSetting_hairlength_get(struct PointerRNA *ptr)
|
||||
{
|
||||
ParticleSettings *settings = (ParticleSettings*)ptr->data;
|
||||
return settings->normfac * 4.f;
|
||||
}
|
||||
|
||||
static void rna_PartSetting_linelentail_set(struct PointerRNA *ptr, float value)
|
||||
{
|
||||
ParticleSettings *settings = (ParticleSettings*)ptr->data;
|
||||
@ -1277,6 +1289,12 @@ static void rna_def_particle_settings(BlenderRNA *brna)
|
||||
RNA_def_property_ui_text(prop, "Mass from Size", "Multiply mass by particle size");
|
||||
RNA_def_property_update(prop, 0, "rna_Particle_reset");
|
||||
|
||||
prop= RNA_def_property(srna, "use_advanced_hair", PROP_BOOLEAN, PROP_NONE);
|
||||
RNA_def_property_boolean_negative_sdna(prop, NULL, "flag", PART_HIDE_ADVANCED_HAIR);
|
||||
RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
|
||||
RNA_def_property_ui_text(prop, "Advanced", "Use full physics calculations for growing hair");
|
||||
RNA_def_property_update(prop, 0, "rna_Particle_reset");
|
||||
|
||||
prop= RNA_def_property(srna, "lock_boids_to_surface", PROP_BOOLEAN, PROP_NONE);
|
||||
RNA_def_property_boolean_sdna(prop, NULL, "flag", PART_BOIDS_2D);
|
||||
RNA_def_property_ui_text(prop, "Boids 2D", "Constrain boids to a surface");
|
||||
@ -1294,7 +1312,7 @@ static void rna_def_particle_settings(BlenderRNA *brna)
|
||||
|
||||
prop= RNA_def_property(srna, "apply_effector_to_children", PROP_BOOLEAN, PROP_NONE);
|
||||
RNA_def_property_boolean_sdna(prop, NULL, "flag", PART_CHILD_EFFECT);
|
||||
RNA_def_property_ui_text(prop, "Children", "Apply effectors to children");
|
||||
RNA_def_property_ui_text(prop, "Effect Children", "Apply effectors to children");
|
||||
RNA_def_property_update(prop, 0, "rna_Particle_redo");
|
||||
|
||||
prop= RNA_def_property(srna, "create_long_hair_children", PROP_BOOLEAN, PROP_NONE);
|
||||
@ -1776,6 +1794,13 @@ static void rna_def_particle_settings(BlenderRNA *brna)
|
||||
RNA_def_property_ui_text(prop, "Random Phase", "Randomize rotation phase");
|
||||
RNA_def_property_update(prop, 0, "rna_Particle_reset");
|
||||
|
||||
prop= RNA_def_property(srna, "hair_length", PROP_FLOAT, PROP_NONE);
|
||||
RNA_def_property_float_funcs(prop, "rna_PartSetting_hairlength_get", "rna_PartSetting_hairlength_set", NULL);
|
||||
RNA_def_property_range(prop, 0.0f, 1000.0f);
|
||||
RNA_def_property_ui_range(prop, 0.0f, 10.0f, 1, 3);
|
||||
RNA_def_property_ui_text(prop, "Hair Length", "Length of the hair");
|
||||
RNA_def_property_update(prop, 0, "rna_Particle_reset");
|
||||
|
||||
/* physical properties */
|
||||
prop= RNA_def_property(srna, "mass", PROP_FLOAT, PROP_NONE);
|
||||
RNA_def_property_range(prop, 0.001f, 100000.0f);
|
||||
|
Loading…
Reference in New Issue
Block a user