Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'source/blender/makesrna/intern/rna_particle.c')
-rw-r--r--source/blender/makesrna/intern/rna_particle.c144
1 files changed, 141 insertions, 3 deletions
diff --git a/source/blender/makesrna/intern/rna_particle.c b/source/blender/makesrna/intern/rna_particle.c
index c0ce8f21870..a6bbbfcb8b4 100644
--- a/source/blender/makesrna/intern/rna_particle.c
+++ b/source/blender/makesrna/intern/rna_particle.c
@@ -35,6 +35,7 @@
#include "DNA_meshdata_types.h"
#include "DNA_modifier_types.h"
#include "DNA_cloth_types.h"
+#include "DNA_key_types.h"
#include "DNA_particle_types.h"
#include "DNA_object_force.h"
#include "DNA_object_types.h"
@@ -97,9 +98,12 @@ static EnumPropertyItem part_draw_as_items[] = {
#ifdef RNA_RUNTIME
static EnumPropertyItem part_hair_draw_as_items[] = {
- {PART_DRAW_NOT, "NONE", 0, "None", ""},
- {PART_DRAW_REND, "RENDER", 0, "Rendered", ""},
- {PART_DRAW_PATH, "PATH", 0, "Path", ""},
+ {PART_DRAW_NOT, "NONE", 0, "None", "No hair drawing"},
+ {PART_DRAW_REND, "RENDER", 0, "Rendered", "Approximate render result in the viewport"},
+ {PART_DRAW_PATH, "PATH", 0, "Path", "Show path of hair particles"},
+#ifdef USE_PARTICLE_HULL_DRAWING
+ {PART_DRAW_HULL, "HULL", 0, "Hull", "Show convex hull of child particle paths"},
+#endif
{0, NULL, 0, NULL, NULL}
};
#endif
@@ -127,6 +131,7 @@ static EnumPropertyItem part_hair_ren_as_items[] = {
#ifdef RNA_RUNTIME
+#include "BLI_listbase.h"
#include "BLI_math.h"
#include "BKE_context.h"
@@ -137,12 +142,17 @@ static EnumPropertyItem part_hair_ren_as_items[] = {
#include "BKE_DerivedMesh.h"
#include "BKE_cdderivedmesh.h"
#include "BKE_effect.h"
+#include "BKE_key.h"
#include "BKE_material.h"
#include "BKE_modifier.h"
#include "BKE_particle.h"
#include "BKE_pointcache.h"
#include "BKE_texture.h"
+#include "RNA_access.h"
+
+#include "ED_particle.h"
+
/* use for object space hair get/set */
static void rna_ParticleHairKey_location_object_info(PointerRNA *ptr, ParticleSystemModifierData **psmd_pt,
ParticleData **pa_pt)
@@ -735,6 +745,7 @@ static void rna_Particle_hair_dynamics(Main *bmain, Scene *scene, PointerRNA *pt
DAG_id_tag_update(&ob->id, OB_RECALC_DATA);
}
+
static PointerRNA rna_particle_settings_get(PointerRNA *ptr)
{
ParticleSystem *psys = (ParticleSystem *)ptr->data;
@@ -763,6 +774,64 @@ static void rna_particle_settings_set(PointerRNA *ptr, PointerRNA value)
psys->recalc |= PSYS_RECALC_TYPE;
}
}
+
+static void rna_Particle_active_shape_update(Main *bmain, Scene *scene, PointerRNA *ptr)
+{
+ Object *ob = ptr->id.data;
+ ParticleSystem *psys = ptr->data;
+
+ if (PE_shapekey_load(ob, psys)) {
+ WM_main_add_notifier(NC_SCENE | ND_PARTICLE | NS_MODE_PARTICLE, ptr->id.data);
+ }
+
+ rna_Particle_redo(bmain, scene, ptr);
+}
+
+static void rna_Particle_active_shape_key_index_range(PointerRNA *ptr, int *min, int *max,
+ int *UNUSED(softmin), int *UNUSED(softmax))
+{
+ ParticleSystem *psys = ptr->data;
+ Key *key = psys->key;
+
+ *min = 0;
+ if (key) {
+ *max = BLI_listbase_count(&key->block) - 1;
+ if (*max < 0) *max = 0;
+ }
+ else {
+ *max = 0;
+ }
+}
+
+static int rna_Particle_active_shape_key_index_get(PointerRNA *ptr)
+{
+ ParticleSystem *psys = ptr->data;
+
+ return MAX2(psys->shapenr - 1, 0);
+}
+
+static void rna_Particle_active_shape_key_index_set(PointerRNA *ptr, int value)
+{
+ ParticleSystem *psys = ptr->data;
+
+ psys->shapenr = value + 1;
+}
+
+static PointerRNA rna_Particle_active_shape_key_get(PointerRNA *ptr)
+{
+ ParticleSystem *psys = ptr->data;
+ Key *key = psys->key;
+ KeyBlock *kb;
+ PointerRNA keyptr;
+
+ if (key == NULL)
+ return PointerRNA_NULL;
+
+ kb = BLI_findlink(&key->block, psys->shapenr - 1);
+ RNA_pointer_create((ID *)key, &RNA_ShapeKey, kb, &keyptr);
+ return keyptr;
+}
+
static void rna_Particle_abspathtime_update(Main *bmain, Scene *scene, PointerRNA *ptr)
{
ParticleSettings *settings = (ParticleSettings *)ptr->data;
@@ -1834,6 +1903,16 @@ static void rna_def_particle_settings_mtex(BlenderRNA *brna)
RNA_def_property_ui_text(prop, "Length", "Affect the child hair length");
RNA_def_property_update(prop, 0, "rna_Particle_redo_child");
+ prop = RNA_def_property(srna, "use_map_shapekey", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "mapto", PAMAP_SHAPEKEY);
+ RNA_def_property_ui_text(prop, "Shape Key", "Affect the blend factor of a hair shape key");
+ RNA_def_property_update(prop, 0, "rna_Particle_reset");
+
+ prop = RNA_def_property(srna, "use_map_particle_color", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "mapto", PAMAP_COLOR);
+ RNA_def_property_ui_text(prop, "Color", "Affect the particle color");
+ RNA_def_property_update(prop, 0, "rna_Particle_reset");
+
/* influence factors */
prop = RNA_def_property(srna, "time_factor", PROP_FLOAT, PROP_NONE);
@@ -1915,6 +1994,23 @@ static void rna_def_particle_settings_mtex(BlenderRNA *brna)
RNA_def_property_ui_range(prop, 0, 1, 10, 3);
RNA_def_property_ui_text(prop, "Rough Factor", "Amount texture affects child roughness");
RNA_def_property_update(prop, 0, "rna_Particle_redo_child");
+
+ prop = RNA_def_property(srna, "shapekey_factor", PROP_FLOAT, PROP_NONE);
+ RNA_def_property_float_sdna(prop, NULL, "shapefac");
+ RNA_def_property_ui_range(prop, 0, 1, 10, 3);
+ RNA_def_property_ui_text(prop, "Shape Key Factor", "Amount texture affects shape key blend value");
+ RNA_def_property_update(prop, 0, "rna_Particle_reset");
+
+ prop = RNA_def_property(srna, "shapekey", PROP_STRING, PROP_NONE);
+ RNA_def_property_string_sdna(prop, NULL, "shapekey");
+ RNA_def_property_ui_text(prop, "Shape Key", "Name of the shape key affected by the texture");
+ RNA_def_property_update(prop, 0, "rna_Particle_reset");
+
+ prop = RNA_def_property(srna, "particle_color_factor", PROP_FLOAT, PROP_NONE);
+ RNA_def_property_float_sdna(prop, NULL, "pacolfac");
+ RNA_def_property_ui_range(prop, 0, 1, 10, 3);
+ RNA_def_property_ui_text(prop, "Particle Color Factor", "Amount texture affects particle color");
+ RNA_def_property_update(prop, 0, "rna_Particle_redo_child");
}
static void rna_def_particle_settings(BlenderRNA *brna)
@@ -2033,6 +2129,10 @@ static void rna_def_particle_settings(BlenderRNA *brna)
{PART_DRAW_COL_MAT, "MATERIAL", 0, "Material", ""},
{PART_DRAW_COL_VEL, "VELOCITY", 0, "Velocity", ""},
{PART_DRAW_COL_ACC, "ACCELERATION", 0, "Acceleration", ""},
+#ifdef USE_PARTICLE_HULL_DRAWING
+ {PART_DRAW_COL_PARENT, "PARENT", 0, "Parent", ""},
+#endif
+ {PART_DRAW_COL_TEX, "TEXTURE", 0, "Texture", ""},
{0, NULL, 0, NULL, NULL}
};
@@ -2861,6 +2961,20 @@ static void rna_def_particle_settings(BlenderRNA *brna)
RNA_def_property_ui_text(prop, "Clump Noise Size", "Size of clump noise");
RNA_def_property_update(prop, 0, "rna_Particle_redo_child");
+ prop = RNA_def_property(srna, "clump_noise_random", PROP_FLOAT, PROP_NONE);
+ RNA_def_property_float_sdna(prop, NULL, "clump_noise_random");
+ RNA_def_property_range(prop, -100000.0f, 100000.0f);
+ RNA_def_property_ui_range(prop, 0.0f, 10.0f, 0.1f, 3);
+ RNA_def_property_ui_text(prop, "Clump Noise Random", "Random offset of clump noise");
+ RNA_def_property_update(prop, 0, "rna_Particle_redo_child");
+
+ prop = RNA_def_property(srna, "clump_noise_random_size", PROP_FLOAT, PROP_NONE);
+ RNA_def_property_float_sdna(prop, NULL, "clump_noise_random_size");
+ RNA_def_property_range(prop, 0.00001f, 100000.0f);
+ RNA_def_property_ui_range(prop, 0.01f, 10.0f, 0.1f, 3);
+ RNA_def_property_ui_text(prop, "Clump Noise Random Size", "Size of clump noise offset");
+ RNA_def_property_update(prop, 0, "rna_Particle_redo_child");
+
/* kink */
prop = RNA_def_property(srna, "kink_amplitude", PROP_FLOAT, PROP_NONE);
RNA_def_property_float_sdna(prop, NULL, "kink_amp");
@@ -3253,6 +3367,30 @@ static void rna_def_particle_system(BlenderRNA *brna)
RNA_def_property_ui_text(prop, "Hair Dynamics", "Enable hair dynamics using cloth simulation");
RNA_def_property_update(prop, 0, "rna_Particle_hair_dynamics");
+ prop = RNA_def_property(srna, "hair_preview_factor", PROP_FLOAT, PROP_PERCENTAGE);
+ RNA_def_property_float_sdna(prop, NULL, "hair_preview_factor");
+ RNA_def_property_range(prop, 0.0f, 100.0f);
+ RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
+ RNA_def_property_ui_text(prop, "Preview Factor", "Part of hair particles to use for simulation preview");
+ RNA_def_property_update(prop, 0, "rna_Particle_reset");
+
+ prop = RNA_def_property(srna, "shape_keys", PROP_POINTER, PROP_NONE);
+ RNA_def_property_pointer_sdna(prop, NULL, "key");
+ RNA_def_property_ui_text(prop, "Shape Keys", "");
+
+ prop = RNA_def_property(srna, "active_shape_key", PROP_POINTER, PROP_NONE);
+ RNA_def_property_struct_type(prop, "ShapeKey");
+ RNA_def_property_pointer_funcs(prop, "rna_Particle_active_shape_key_get", NULL, NULL, NULL);
+ RNA_def_property_ui_text(prop, "Active Shape Key", "Current shape key");
+
+ prop = RNA_def_property(srna, "active_shape_key_index", PROP_INT, PROP_NONE);
+ RNA_def_property_int_sdna(prop, NULL, "shapenr");
+ RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
+ RNA_def_property_int_funcs(prop, "rna_Particle_active_shape_key_index_get", "rna_Particle_active_shape_key_index_set",
+ "rna_Particle_active_shape_key_index_range");
+ RNA_def_property_ui_text(prop, "Active Shape Key Index", "Current shape key index");
+ RNA_def_property_update(prop, 0, "rna_Particle_active_shape_update");
+
prop = RNA_def_property(srna, "cloth", PROP_POINTER, PROP_NONE);
RNA_def_property_pointer_sdna(prop, NULL, "clmd");
RNA_def_property_struct_type(prop, "ClothModifier");