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:
authorLukas Tönne <lukas.toenne@gmail.com>2016-12-28 19:30:58 +0300
committerLukas Tönne <lukas.toenne@gmail.com>2016-12-28 19:30:58 +0300
commit6ecab6dd8e48d564a2b43e0e81e79d079e8b4c77 (patch)
tree618e2d24eb34a05a81f726dd52eb2b7468e9296d /source/blender/makesrna
parent605263177b8eea24c1449e4dbf0138175ec3dddf (diff)
Revert particle system and point cache removal in blender2.8 branch.
This reverts commit 5aa19be91263a249ffae75573e3b32f24269d890 and b4a721af694817fa921b119df83d33ede7d7fed0. Due to postponement of particle system rewrite it was decided to put particle code back into the 2.8 branch for the time being.
Diffstat (limited to 'source/blender/makesrna')
-rw-r--r--source/blender/makesrna/RNA_access.h24
-rw-r--r--source/blender/makesrna/RNA_enum_types.h1
-rw-r--r--source/blender/makesrna/intern/CMakeLists.txt2
-rw-r--r--source/blender/makesrna/intern/makesrna.c2
-rw-r--r--source/blender/makesrna/intern/rna_ID.c12
-rw-r--r--source/blender/makesrna/intern/rna_action.c6
-rw-r--r--source/blender/makesrna/intern/rna_boid.c674
-rw-r--r--source/blender/makesrna/intern/rna_color.c8
-rw-r--r--source/blender/makesrna/intern/rna_context.c1
-rw-r--r--source/blender/makesrna/intern/rna_dynamicpaint.c63
-rw-r--r--source/blender/makesrna/intern/rna_fluidsim.c48
-rw-r--r--source/blender/makesrna/intern/rna_internal.h2
-rw-r--r--source/blender/makesrna/intern/rna_main.c7
-rw-r--r--source/blender/makesrna/intern/rna_main_api.c46
-rw-r--r--source/blender/makesrna/intern/rna_modifier.c124
-rw-r--r--source/blender/makesrna/intern/rna_nodetree.c39
-rw-r--r--source/blender/makesrna/intern/rna_object.c80
-rw-r--r--source/blender/makesrna/intern/rna_object_api.c49
-rw-r--r--source/blender/makesrna/intern/rna_object_force.c594
-rw-r--r--source/blender/makesrna/intern/rna_particle.c3573
-rw-r--r--source/blender/makesrna/intern/rna_rigidbody.c17
-rw-r--r--source/blender/makesrna/intern/rna_scene.c33
-rw-r--r--source/blender/makesrna/intern/rna_sculpt_paint.c322
-rw-r--r--source/blender/makesrna/intern/rna_smoke.c102
-rw-r--r--source/blender/makesrna/intern/rna_space.c19
-rw-r--r--source/blender/makesrna/intern/rna_texture.c45
-rw-r--r--source/blender/makesrna/intern/rna_userdef.c4
27 files changed, 5776 insertions, 121 deletions
diff --git a/source/blender/makesrna/RNA_access.h b/source/blender/makesrna/RNA_access.h
index 7f20ac4acb2..f97a5735c94 100644
--- a/source/blender/makesrna/RNA_access.h
+++ b/source/blender/makesrna/RNA_access.h
@@ -78,6 +78,15 @@ extern StructRNA RNA_BezierSplinePoint;
extern StructRNA RNA_BlendData;
extern StructRNA RNA_BlendTexture;
extern StructRNA RNA_BlenderRNA;
+extern StructRNA RNA_BoidRule;
+extern StructRNA RNA_BoidRuleAverageSpeed;
+extern StructRNA RNA_BoidRuleAvoid;
+extern StructRNA RNA_BoidRuleAvoidCollision;
+extern StructRNA RNA_BoidRuleFight;
+extern StructRNA RNA_BoidRuleFollowLeader;
+extern StructRNA RNA_BoidRuleGoal;
+extern StructRNA RNA_BoidSettings;
+extern StructRNA RNA_BoidState;
extern StructRNA RNA_Bone;
extern StructRNA RNA_BoneGroup;
extern StructRNA RNA_BooleanModifier;
@@ -91,6 +100,7 @@ extern StructRNA RNA_CacheFile;
extern StructRNA RNA_Camera;
extern StructRNA RNA_CastModifier;
extern StructRNA RNA_ChildOfConstraint;
+extern StructRNA RNA_ChildParticle;
extern StructRNA RNA_ClampToConstraint;
extern StructRNA RNA_ClothCollisionSettings;
extern StructRNA RNA_ClothModifier;
@@ -450,7 +460,21 @@ extern StructRNA RNA_PaintCurve;
extern StructRNA RNA_Palette;
extern StructRNA RNA_PaletteColor;
extern StructRNA RNA_Panel;
+extern StructRNA RNA_Particle;
+extern StructRNA RNA_ParticleBrush;
+extern StructRNA RNA_ParticleDupliWeight;
+extern StructRNA RNA_ParticleEdit;
+extern StructRNA RNA_ParticleFluidSettings;
+extern StructRNA RNA_ParticleHairKey;
+extern StructRNA RNA_ParticleInstanceModifier;
+extern StructRNA RNA_ParticleKey;
+extern StructRNA RNA_ParticleSettings;
+extern StructRNA RNA_ParticleSettingsTextureSlot;
+extern StructRNA RNA_ParticleSystem;
+extern StructRNA RNA_ParticleSystemModifier;
+extern StructRNA RNA_ParticleTarget;
extern StructRNA RNA_PivotConstraint;
+extern StructRNA RNA_PointCache;
extern StructRNA RNA_PointDensity;
extern StructRNA RNA_PointDensityTexture;
extern StructRNA RNA_PointLamp;
diff --git a/source/blender/makesrna/RNA_enum_types.h b/source/blender/makesrna/RNA_enum_types.h
index 27da7392cbd..1c9b3593d17 100644
--- a/source/blender/makesrna/RNA_enum_types.h
+++ b/source/blender/makesrna/RNA_enum_types.h
@@ -59,6 +59,7 @@ extern EnumPropertyItem rna_enum_space_type_items[];
extern EnumPropertyItem rna_enum_region_type_items[];
extern EnumPropertyItem rna_enum_object_modifier_type_items[];
extern EnumPropertyItem rna_enum_constraint_type_items[];
+extern EnumPropertyItem rna_enum_boidrule_type_items[];
extern EnumPropertyItem rna_enum_sequence_modifier_type_items[];
extern EnumPropertyItem rna_enum_modifier_triangulate_quad_method_items[];
diff --git a/source/blender/makesrna/intern/CMakeLists.txt b/source/blender/makesrna/intern/CMakeLists.txt
index cc3fd2ce324..0f3ea27a7f9 100644
--- a/source/blender/makesrna/intern/CMakeLists.txt
+++ b/source/blender/makesrna/intern/CMakeLists.txt
@@ -36,6 +36,7 @@ set(DEFSRC
rna_animation.c
rna_animviz.c
rna_armature.c
+ rna_boid.c
rna_brush.c
rna_cachefile.c
rna_camera.c
@@ -69,6 +70,7 @@ set(DEFSRC
rna_object_force.c
rna_packedfile.c
rna_palette.c
+ rna_particle.c
rna_pose.c
rna_property.c
rna_render.c
diff --git a/source/blender/makesrna/intern/makesrna.c b/source/blender/makesrna/intern/makesrna.c
index d9c5865b219..4552c773097 100644
--- a/source/blender/makesrna/intern/makesrna.c
+++ b/source/blender/makesrna/intern/makesrna.c
@@ -3311,6 +3311,7 @@ static RNAProcessItem PROCESS_ITEMS[] = {
{"rna_animviz.c", NULL, RNA_def_animviz},
{"rna_actuator.c", "rna_actuator_api.c", RNA_def_actuator},
{"rna_armature.c", "rna_armature_api.c", RNA_def_armature},
+ {"rna_boid.c", NULL, RNA_def_boid},
{"rna_brush.c", NULL, RNA_def_brush},
{"rna_cachefile.c", NULL, RNA_def_cachefile},
{"rna_camera.c", "rna_camera_api.c", RNA_def_camera},
@@ -3342,6 +3343,7 @@ static RNAProcessItem PROCESS_ITEMS[] = {
{"rna_object_force.c", NULL, RNA_def_object_force},
{"rna_packedfile.c", NULL, RNA_def_packedfile},
{"rna_palette.c", NULL, RNA_def_palette},
+ {"rna_particle.c", NULL, RNA_def_particle},
{"rna_pose.c", "rna_pose_api.c", RNA_def_pose},
{"rna_property.c", NULL, RNA_def_gameproperty},
{"rna_render.c", NULL, RNA_def_render},
diff --git a/source/blender/makesrna/intern/rna_ID.c b/source/blender/makesrna/intern/rna_ID.c
index 0c4eb9ceb66..671902c5cc7 100644
--- a/source/blender/makesrna/intern/rna_ID.c
+++ b/source/blender/makesrna/intern/rna_ID.c
@@ -73,6 +73,7 @@ EnumPropertyItem rna_enum_id_type_items[] = {
{ID_OB, "OBJECT", ICON_OBJECT_DATA, "Object", ""},
{ID_PC, "PAINTCURVE", ICON_CURVE_BEZCURVE, "Paint Curve", ""},
{ID_PAL, "PALETTE", ICON_COLOR, "Palette", ""},
+ {ID_PA, "PARTICLE", ICON_PARTICLE_DATA, "Particle", ""},
{ID_SCE, "SCENE", ICON_SCENE_DATA, "Scene", ""},
{ID_SCR, "SCREEN", ICON_SPLITSCREEN, "Screen", ""},
{ID_SO, "SOUND", ICON_PLAY_AUDIO, "Sound", ""},
@@ -158,6 +159,7 @@ short RNA_type_to_ID_code(StructRNA *type)
if (RNA_struct_is_a(type, &RNA_Mask)) return ID_MSK;
if (RNA_struct_is_a(type, &RNA_NodeTree)) return ID_NT;
if (RNA_struct_is_a(type, &RNA_Object)) return ID_OB;
+ if (RNA_struct_is_a(type, &RNA_ParticleSettings)) return ID_PA;
if (RNA_struct_is_a(type, &RNA_Palette)) return ID_PAL;
if (RNA_struct_is_a(type, &RNA_PaintCurve)) return ID_PC;
if (RNA_struct_is_a(type, &RNA_Scene)) return ID_SCE;
@@ -197,6 +199,7 @@ StructRNA *ID_code_to_RNA_type(short idcode)
case ID_MSK: return &RNA_Mask;
case ID_NT: return &RNA_NodeTree;
case ID_OB: return &RNA_Object;
+ case ID_PA: return &RNA_ParticleSettings;
case ID_PAL: return &RNA_Palette;
case ID_PC: return &RNA_PaintCurve;
case ID_SCE: return &RNA_Scene;
@@ -313,6 +316,15 @@ static void rna_ID_update_tag(ID *id, ReportList *reports, int flag)
return;
}
break;
+ /* Could add particle updates later */
+#if 0
+ case ID_PA:
+ if (flag & ~(OB_RECALC_ALL | PSYS_RECALC)) {
+ BKE_report(reports, RPT_ERROR, "'Refresh' incompatible with ParticleSettings ID type");
+ return;
+ }
+ break;
+#endif
default:
BKE_report(reports, RPT_ERROR, "This ID type is not compatible with any 'refresh' options");
return;
diff --git a/source/blender/makesrna/intern/rna_action.c b/source/blender/makesrna/intern/rna_action.c
index cd45cad00b9..0c4c7ddac81 100644
--- a/source/blender/makesrna/intern/rna_action.c
+++ b/source/blender/makesrna/intern/rna_action.c
@@ -476,6 +476,12 @@ static void rna_def_dopesheet(BlenderRNA *brna)
RNA_def_property_ui_icon(prop, ICON_SCENE_DATA, 0);
RNA_def_property_update(prop, NC_ANIMATION | ND_ANIMCHAN | NA_EDITED, NULL);
+ prop = RNA_def_property(srna, "show_particles", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_negative_sdna(prop, NULL, "filterflag", ADS_FILTER_NOPART);
+ RNA_def_property_ui_text(prop, "Display Particle", "Include visualization of particle related animation data");
+ RNA_def_property_ui_icon(prop, ICON_PARTICLE_DATA, 0);
+ RNA_def_property_update(prop, NC_ANIMATION | ND_ANIMCHAN | NA_EDITED, NULL);
+
prop = RNA_def_property(srna, "show_metaballs", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_boolean_negative_sdna(prop, NULL, "filterflag", ADS_FILTER_NOMBA);
RNA_def_property_ui_text(prop, "Display Metaball", "Include visualization of metaball related animation data");
diff --git a/source/blender/makesrna/intern/rna_boid.c b/source/blender/makesrna/intern/rna_boid.c
new file mode 100644
index 00000000000..72f67b86c23
--- /dev/null
+++ b/source/blender/makesrna/intern/rna_boid.c
@@ -0,0 +1,674 @@
+/*
+ * ***** BEGIN GPL LICENSE BLOCK *****
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ * The Original Code is Copyright (C) 2009 by Janne Karhu.
+ * All rights reserved.
+ *
+ * The Original Code is: all of this file.
+ *
+ * Contributor(s): none yet.
+ *
+ * ***** END GPL LICENSE BLOCK *****
+ */
+
+/** \file blender/makesrna/intern/rna_boid.c
+ * \ingroup RNA
+ */
+
+#include <float.h>
+#include <limits.h>
+#include <stdlib.h>
+
+#include "DNA_scene_types.h"
+#include "DNA_boid_types.h"
+#include "DNA_object_types.h"
+#include "DNA_particle_types.h"
+
+#include "BLI_utildefines.h"
+
+#include "RNA_define.h"
+#include "RNA_enum_types.h"
+
+#include "rna_internal.h"
+
+#include "WM_api.h"
+#include "WM_types.h"
+
+EnumPropertyItem rna_enum_boidrule_type_items[] = {
+ {eBoidRuleType_Goal, "GOAL", 0, "Goal", "Go to assigned object or loudest assigned signal source"},
+ {eBoidRuleType_Avoid, "AVOID", 0, "Avoid", "Get away from assigned object or loudest assigned signal source"},
+ {eBoidRuleType_AvoidCollision, "AVOID_COLLISION", 0, "Avoid Collision",
+ "Maneuver to avoid collisions with other boids and deflector objects in "
+ "near future"},
+ {eBoidRuleType_Separate, "SEPARATE", 0, "Separate", "Keep from going through other boids"},
+ {eBoidRuleType_Flock, "FLOCK", 0, "Flock", "Move to center of neighbors and match their velocity"},
+ {eBoidRuleType_FollowLeader, "FOLLOW_LEADER", 0, "Follow Leader", "Follow a boid or assigned object"},
+ {eBoidRuleType_AverageSpeed, "AVERAGE_SPEED", 0, "Average Speed", "Maintain speed, flight level or wander"},
+ {eBoidRuleType_Fight, "FIGHT", 0, "Fight", "Go to closest enemy and attack when in range"},
+#if 0
+ {eBoidRuleType_Protect, "PROTECT", 0, "Protect", "Go to enemy closest to target and attack when in range"},
+ {eBoidRuleType_Hide, "HIDE", 0, "Hide", "Find a deflector move to it's other side from closest enemy"},
+ {eBoidRuleType_FollowPath, "FOLLOW_PATH", 0, "Follow Path",
+ "Move along a assigned curve or closest curve in a group"},
+ {eBoidRuleType_FollowWall, "FOLLOW_WALL", 0, "Follow Wall",
+ "Move next to a deflector object's in direction of it's tangent"},
+#endif
+ {0, NULL, 0, NULL, NULL}
+};
+
+#ifndef RNA_RUNTIME
+static EnumPropertyItem boidruleset_type_items[] = {
+ {eBoidRulesetType_Fuzzy, "FUZZY", 0, "Fuzzy",
+ "Rules are gone through top to bottom (only the first rule which effect is above "
+ "fuzziness threshold is evaluated)"},
+ {eBoidRulesetType_Random, "RANDOM", 0, "Random", "A random rule is selected for each boid"},
+ {eBoidRulesetType_Average, "AVERAGE", 0, "Average", "All rules are averaged"},
+ {0, NULL, 0, NULL, NULL}
+};
+#endif
+
+
+#ifdef RNA_RUNTIME
+
+#include "BLI_math_base.h"
+
+#include "BKE_context.h"
+#include "BKE_depsgraph.h"
+#include "BKE_particle.h"
+
+static void rna_Boids_reset(Main *UNUSED(bmain), Scene *UNUSED(scene), PointerRNA *ptr)
+{
+ if (ptr->type == &RNA_ParticleSystem) {
+ ParticleSystem *psys = (ParticleSystem *)ptr->data;
+
+ psys->recalc = PSYS_RECALC_RESET;
+
+ DAG_id_tag_update(ptr->id.data, OB_RECALC_DATA);
+ }
+ else
+ DAG_id_tag_update(ptr->id.data, OB_RECALC_DATA | PSYS_RECALC_RESET);
+
+ WM_main_add_notifier(NC_OBJECT | ND_PARTICLE | NA_EDITED, NULL);
+}
+static void rna_Boids_reset_deps(Main *bmain, Scene *UNUSED(scene), PointerRNA *ptr)
+{
+ if (ptr->type == &RNA_ParticleSystem) {
+ ParticleSystem *psys = (ParticleSystem *)ptr->data;
+
+ psys->recalc = PSYS_RECALC_RESET;
+
+ DAG_id_tag_update(ptr->id.data, OB_RECALC_DATA);
+ }
+ else
+ DAG_id_tag_update(ptr->id.data, OB_RECALC_DATA | PSYS_RECALC_RESET);
+
+ DAG_relations_tag_update(bmain);
+
+ WM_main_add_notifier(NC_OBJECT | ND_PARTICLE | NA_EDITED, NULL);
+}
+
+static StructRNA *rna_BoidRule_refine(struct PointerRNA *ptr)
+{
+ BoidRule *rule = (BoidRule *)ptr->data;
+
+ switch (rule->type) {
+ case eBoidRuleType_Goal:
+ return &RNA_BoidRuleGoal;
+ case eBoidRuleType_Avoid:
+ return &RNA_BoidRuleAvoid;
+ case eBoidRuleType_AvoidCollision:
+ return &RNA_BoidRuleAvoidCollision;
+ case eBoidRuleType_FollowLeader:
+ return &RNA_BoidRuleFollowLeader;
+ case eBoidRuleType_AverageSpeed:
+ return &RNA_BoidRuleAverageSpeed;
+ case eBoidRuleType_Fight:
+ return &RNA_BoidRuleFight;
+ default:
+ return &RNA_BoidRule;
+ }
+}
+
+static char *rna_BoidRule_path(PointerRNA *ptr)
+{
+ BoidRule *rule = (BoidRule *)ptr->data;
+ char name_esc[sizeof(rule->name) * 2];
+
+ BLI_strescape(name_esc, rule->name, sizeof(name_esc));
+
+ return BLI_sprintfN("rules[\"%s\"]", name_esc); /* XXX not unique */
+}
+
+static PointerRNA rna_BoidState_active_boid_rule_get(PointerRNA *ptr)
+{
+ BoidState *state = (BoidState *)ptr->data;
+ BoidRule *rule = (BoidRule *)state->rules.first;
+
+ for (; rule; rule = rule->next) {
+ if (rule->flag & BOIDRULE_CURRENT)
+ return rna_pointer_inherit_refine(ptr, &RNA_BoidRule, rule);
+ }
+ return rna_pointer_inherit_refine(ptr, &RNA_BoidRule, NULL);
+}
+static void rna_BoidState_active_boid_rule_index_range(PointerRNA *ptr, int *min, int *max,
+ int *UNUSED(softmin), int *UNUSED(softmax))
+{
+ BoidState *state = (BoidState *)ptr->data;
+ *min = 0;
+ *max = max_ii(0, BLI_listbase_count(&state->rules) - 1);
+}
+
+static int rna_BoidState_active_boid_rule_index_get(PointerRNA *ptr)
+{
+ BoidState *state = (BoidState *)ptr->data;
+ BoidRule *rule = (BoidRule *)state->rules.first;
+ int i = 0;
+
+ for (; rule; rule = rule->next, i++) {
+ if (rule->flag & BOIDRULE_CURRENT)
+ return i;
+ }
+ return 0;
+}
+
+static void rna_BoidState_active_boid_rule_index_set(struct PointerRNA *ptr, int value)
+{
+ BoidState *state = (BoidState *)ptr->data;
+ BoidRule *rule = (BoidRule *)state->rules.first;
+ int i = 0;
+
+ for (; rule; rule = rule->next, i++) {
+ if (i == value)
+ rule->flag |= BOIDRULE_CURRENT;
+ else
+ rule->flag &= ~BOIDRULE_CURRENT;
+ }
+}
+
+static int particle_id_check(PointerRNA *ptr)
+{
+ ID *id = ptr->id.data;
+
+ return (GS(id->name) == ID_PA);
+}
+
+static char *rna_BoidSettings_path(PointerRNA *ptr)
+{
+ BoidSettings *boids = (BoidSettings *)ptr->data;
+
+ if (particle_id_check(ptr)) {
+ ParticleSettings *part = (ParticleSettings *)ptr->id.data;
+
+ if (part->boids == boids)
+ return BLI_sprintfN("boids");
+ }
+ return NULL;
+}
+
+static PointerRNA rna_BoidSettings_active_boid_state_get(PointerRNA *ptr)
+{
+ BoidSettings *boids = (BoidSettings *)ptr->data;
+ BoidState *state = (BoidState *)boids->states.first;
+
+ for (; state; state = state->next) {
+ if (state->flag & BOIDSTATE_CURRENT)
+ return rna_pointer_inherit_refine(ptr, &RNA_BoidState, state);
+ }
+ return rna_pointer_inherit_refine(ptr, &RNA_BoidState, NULL);
+}
+static void rna_BoidSettings_active_boid_state_index_range(PointerRNA *ptr, int *min, int *max,
+ int *UNUSED(softmin), int *UNUSED(softmax))
+{
+ BoidSettings *boids = (BoidSettings *)ptr->data;
+ *min = 0;
+ *max = max_ii(0, BLI_listbase_count(&boids->states) - 1);
+}
+
+static int rna_BoidSettings_active_boid_state_index_get(PointerRNA *ptr)
+{
+ BoidSettings *boids = (BoidSettings *)ptr->data;
+ BoidState *state = (BoidState *)boids->states.first;
+ int i = 0;
+
+ for (; state; state = state->next, i++) {
+ if (state->flag & BOIDSTATE_CURRENT)
+ return i;
+ }
+ return 0;
+}
+
+static void rna_BoidSettings_active_boid_state_index_set(struct PointerRNA *ptr, int value)
+{
+ BoidSettings *boids = (BoidSettings *)ptr->data;
+ BoidState *state = (BoidState *)boids->states.first;
+ int i = 0;
+
+ for (; state; state = state->next, i++) {
+ if (i == value)
+ state->flag |= BOIDSTATE_CURRENT;
+ else
+ state->flag &= ~BOIDSTATE_CURRENT;
+ }
+}
+
+#else
+
+static void rna_def_boidrule_goal(BlenderRNA *brna)
+{
+ StructRNA *srna;
+ PropertyRNA *prop;
+
+ srna = RNA_def_struct(brna, "BoidRuleGoal", "BoidRule");
+ RNA_def_struct_ui_text(srna, "Goal", "");
+ RNA_def_struct_sdna(srna, "BoidRuleGoalAvoid");
+
+ prop = RNA_def_property(srna, "object", PROP_POINTER, PROP_NONE);
+ RNA_def_property_pointer_sdna(prop, NULL, "ob");
+ RNA_def_property_flag(prop, PROP_EDITABLE);
+ RNA_def_property_ui_text(prop, "Object", "Goal object");
+ RNA_def_property_update(prop, 0, "rna_Boids_reset_deps");
+
+ prop = RNA_def_property(srna, "use_predict", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "options", BRULE_GOAL_AVOID_PREDICT);
+ RNA_def_property_ui_text(prop, "Predict", "Predict target movement");
+ RNA_def_property_update(prop, 0, "rna_Boids_reset");
+}
+
+static void rna_def_boidrule_avoid(BlenderRNA *brna)
+{
+ StructRNA *srna;
+ PropertyRNA *prop;
+
+ srna = RNA_def_struct(brna, "BoidRuleAvoid", "BoidRule");
+ RNA_def_struct_ui_text(srna, "Avoid", "");
+ RNA_def_struct_sdna(srna, "BoidRuleGoalAvoid");
+
+ prop = RNA_def_property(srna, "object", PROP_POINTER, PROP_NONE);
+ RNA_def_property_pointer_sdna(prop, NULL, "ob");
+ RNA_def_property_flag(prop, PROP_EDITABLE);
+ RNA_def_property_ui_text(prop, "Object", "Object to avoid");
+ RNA_def_property_update(prop, 0, "rna_Boids_reset_deps");
+
+ prop = RNA_def_property(srna, "use_predict", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "options", BRULE_GOAL_AVOID_PREDICT);
+ RNA_def_property_ui_text(prop, "Predict", "Predict target movement");
+ RNA_def_property_update(prop, 0, "rna_Boids_reset");
+
+ prop = RNA_def_property(srna, "fear_factor", PROP_FLOAT, PROP_NONE);
+ RNA_def_property_range(prop, 0.0f, 100.0f);
+ RNA_def_property_ui_text(prop, "Fear factor", "Avoid object if danger from it is above this threshold");
+ RNA_def_property_update(prop, 0, "rna_Boids_reset");
+}
+
+static void rna_def_boidrule_avoid_collision(BlenderRNA *brna)
+{
+ StructRNA *srna;
+ PropertyRNA *prop;
+
+ srna = RNA_def_struct(brna, "BoidRuleAvoidCollision", "BoidRule");
+ RNA_def_struct_ui_text(srna, "Avoid Collision", "");
+
+ prop = RNA_def_property(srna, "use_avoid", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "options", BRULE_ACOLL_WITH_BOIDS);
+ RNA_def_property_ui_text(prop, "Boids", "Avoid collision with other boids");
+ RNA_def_property_update(prop, 0, "rna_Boids_reset");
+
+ prop = RNA_def_property(srna, "use_avoid_collision", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "options", BRULE_ACOLL_WITH_DEFLECTORS);
+ RNA_def_property_ui_text(prop, "Deflectors", "Avoid collision with deflector objects");
+ RNA_def_property_update(prop, 0, "rna_Boids_reset");
+
+ prop = RNA_def_property(srna, "look_ahead", PROP_FLOAT, PROP_NONE);
+ RNA_def_property_range(prop, 0.0f, 100.0f);
+ RNA_def_property_ui_text(prop, "Look ahead", "Time to look ahead in seconds");
+ RNA_def_property_update(prop, 0, "rna_Boids_reset");
+}
+
+static void rna_def_boidrule_follow_leader(BlenderRNA *brna)
+{
+ StructRNA *srna;
+ PropertyRNA *prop;
+
+ srna = RNA_def_struct(brna, "BoidRuleFollowLeader", "BoidRule");
+ RNA_def_struct_ui_text(srna, "Follow Leader", "");
+
+ prop = RNA_def_property(srna, "object", PROP_POINTER, PROP_NONE);
+ RNA_def_property_pointer_sdna(prop, NULL, "ob");
+ RNA_def_property_flag(prop, PROP_EDITABLE);
+ RNA_def_property_ui_text(prop, "Object", "Follow this object instead of a boid");
+ RNA_def_property_update(prop, 0, "rna_Boids_reset_deps");
+
+ prop = RNA_def_property(srna, "distance", PROP_FLOAT, PROP_NONE);
+ RNA_def_property_range(prop, 0.0f, 100.0f);
+ RNA_def_property_ui_text(prop, "Distance", "Distance behind leader to follow");
+ RNA_def_property_update(prop, 0, "rna_Boids_reset");
+
+ prop = RNA_def_property(srna, "queue_count", PROP_INT, PROP_NONE);
+ RNA_def_property_int_sdna(prop, NULL, "queue_size");
+ RNA_def_property_range(prop, 0.0f, 100.0f);
+ RNA_def_property_ui_text(prop, "Queue Size", "How many boids in a line");
+ RNA_def_property_update(prop, 0, "rna_Boids_reset");
+
+ prop = RNA_def_property(srna, "use_line", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "options", BRULE_LEADER_IN_LINE);
+ RNA_def_property_ui_text(prop, "Line", "Follow leader in a line");
+ RNA_def_property_update(prop, 0, "rna_Boids_reset");
+}
+
+static void rna_def_boidrule_average_speed(BlenderRNA *brna)
+{
+ StructRNA *srna;
+ PropertyRNA *prop;
+
+ srna = RNA_def_struct(brna, "BoidRuleAverageSpeed", "BoidRule");
+ RNA_def_struct_ui_text(srna, "Average Speed", "");
+
+ prop = RNA_def_property(srna, "wander", PROP_FLOAT, PROP_NONE);
+ RNA_def_property_range(prop, 0.0f, 1.0f);
+ RNA_def_property_ui_text(prop, "Wander", "How fast velocity's direction is randomized");
+ RNA_def_property_update(prop, 0, "rna_Boids_reset");
+
+ prop = RNA_def_property(srna, "level", PROP_FLOAT, PROP_NONE);
+ RNA_def_property_range(prop, 0.0f, 1.0f);
+ RNA_def_property_ui_text(prop, "Level", "How much velocity's z-component is kept constant");
+ RNA_def_property_update(prop, 0, "rna_Boids_reset");
+
+ prop = RNA_def_property(srna, "speed", PROP_FLOAT, PROP_NONE);
+ RNA_def_property_range(prop, 0.0f, 1.0f);
+ RNA_def_property_ui_text(prop, "Speed", "Percentage of maximum speed");
+ RNA_def_property_update(prop, 0, "rna_Boids_reset");
+}
+
+static void rna_def_boidrule_fight(BlenderRNA *brna)
+{
+ StructRNA *srna;
+ PropertyRNA *prop;
+
+ srna = RNA_def_struct(brna, "BoidRuleFight", "BoidRule");
+ RNA_def_struct_ui_text(srna, "Fight", "");
+
+ prop = RNA_def_property(srna, "distance", PROP_FLOAT, PROP_NONE);
+ RNA_def_property_range(prop, 0.0f, 100.0f);
+ RNA_def_property_ui_text(prop, "Fight Distance", "Attack boids at max this distance");
+ RNA_def_property_update(prop, 0, "rna_Boids_reset");
+
+ prop = RNA_def_property(srna, "flee_distance", PROP_FLOAT, PROP_NONE);
+ RNA_def_property_range(prop, 0.0f, 100.0f);
+ RNA_def_property_ui_text(prop, "Flee Distance", "Flee to this distance");
+ RNA_def_property_update(prop, 0, "rna_Boids_reset");
+}
+
+static void rna_def_boidrule(BlenderRNA *brna)
+{
+ StructRNA *srna;
+ PropertyRNA *prop;
+
+ /* data */
+ srna = RNA_def_struct(brna, "BoidRule", NULL);
+ RNA_def_struct_ui_text(srna, "Boid Rule", "");
+ RNA_def_struct_refine_func(srna, "rna_BoidRule_refine");
+ RNA_def_struct_path_func(srna, "rna_BoidRule_path");
+
+ /* strings */
+ prop = RNA_def_property(srna, "name", PROP_STRING, PROP_NONE);
+ RNA_def_property_ui_text(prop, "Name", "Boid rule name");
+ RNA_def_struct_name_property(srna, prop);
+
+ /* enums */
+ prop = RNA_def_property(srna, "type", PROP_ENUM, PROP_NONE);
+ RNA_def_property_clear_flag(prop, PROP_EDITABLE);
+ RNA_def_property_enum_sdna(prop, NULL, "type");
+ RNA_def_property_enum_items(prop, rna_enum_boidrule_type_items);
+ RNA_def_property_ui_text(prop, "Type", "");
+
+ /* flags */
+ prop = RNA_def_property(srna, "use_in_air", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "flag", BOIDRULE_IN_AIR);
+ RNA_def_property_ui_text(prop, "In Air", "Use rule when boid is flying");
+ RNA_def_property_update(prop, 0, "rna_Boids_reset");
+
+ prop = RNA_def_property(srna, "use_on_land", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "flag", BOIDRULE_ON_LAND);
+ RNA_def_property_ui_text(prop, "On Land", "Use rule when boid is on land");
+ RNA_def_property_update(prop, 0, "rna_Boids_reset");
+
+ /*prop = RNA_def_property(srna, "show_expanded", PROP_BOOLEAN, PROP_NONE); */
+ /*RNA_def_property_boolean_sdna(prop, NULL, "mode", eModifierMode_Expanded); */
+ /*RNA_def_property_ui_text(prop, "Expanded", "Set modifier expanded in the user interface"); */
+
+ /* types */
+ rna_def_boidrule_goal(brna);
+ rna_def_boidrule_avoid(brna);
+ rna_def_boidrule_avoid_collision(brna);
+ rna_def_boidrule_follow_leader(brna);
+ rna_def_boidrule_average_speed(brna);
+ rna_def_boidrule_fight(brna);
+}
+
+static void rna_def_boidstate(BlenderRNA *brna)
+{
+ StructRNA *srna;
+ PropertyRNA *prop;
+
+ srna = RNA_def_struct(brna, "BoidState", NULL);
+ RNA_def_struct_ui_text(srna, "Boid State", "Boid state for boid physics");
+
+ prop = RNA_def_property(srna, "name", PROP_STRING, PROP_NONE);
+ RNA_def_property_ui_text(prop, "Name", "Boid state name");
+ RNA_def_struct_name_property(srna, prop);
+
+ prop = RNA_def_property(srna, "ruleset_type", PROP_ENUM, PROP_NONE);
+ RNA_def_property_enum_items(prop, boidruleset_type_items);
+ RNA_def_property_ui_text(prop, "Rule Evaluation", "How the rules in the list are evaluated");
+
+ prop = RNA_def_property(srna, "rules", PROP_COLLECTION, PROP_NONE);
+ RNA_def_property_struct_type(prop, "BoidRule");
+ RNA_def_property_ui_text(prop, "Boid Rules", "");
+
+ prop = RNA_def_property(srna, "active_boid_rule", PROP_POINTER, PROP_NONE);
+ RNA_def_property_struct_type(prop, "BoidRule");
+ RNA_def_property_pointer_funcs(prop, "rna_BoidState_active_boid_rule_get", NULL, NULL, NULL);
+ RNA_def_property_ui_text(prop, "Active Boid Rule", "");
+
+ prop = RNA_def_property(srna, "active_boid_rule_index", PROP_INT, PROP_UNSIGNED);
+ RNA_def_property_int_funcs(prop, "rna_BoidState_active_boid_rule_index_get",
+ "rna_BoidState_active_boid_rule_index_set",
+ "rna_BoidState_active_boid_rule_index_range");
+ RNA_def_property_ui_text(prop, "Active Boid Rule Index", "");
+
+ prop = RNA_def_property(srna, "rule_fuzzy", PROP_FLOAT, PROP_NONE);
+ RNA_def_property_float_sdna(prop, NULL, "rule_fuzziness");
+ RNA_def_property_range(prop, 0.0, 1.0);
+ RNA_def_property_ui_text(prop, "Rule Fuzziness", "");
+ RNA_def_property_update(prop, 0, "rna_Boids_reset");
+
+ prop = RNA_def_property(srna, "volume", PROP_FLOAT, PROP_NONE);
+ RNA_def_property_range(prop, 0.0, 100.0);
+ RNA_def_property_ui_text(prop, "Volume", "");
+ RNA_def_property_update(prop, 0, "rna_Boids_reset");
+
+ prop = RNA_def_property(srna, "falloff", PROP_FLOAT, PROP_NONE);
+ RNA_def_property_range(prop, 0.0, 10.0);
+ RNA_def_property_ui_text(prop, "Falloff", "");
+ RNA_def_property_update(prop, 0, "rna_Boids_reset");
+}
+static void rna_def_boid_settings(BlenderRNA *brna)
+{
+ StructRNA *srna;
+ PropertyRNA *prop;
+
+ srna = RNA_def_struct(brna, "BoidSettings", NULL);
+ RNA_def_struct_path_func(srna, "rna_BoidSettings_path");
+ RNA_def_struct_ui_text(srna, "Boid Settings", "Settings for boid physics");
+
+ prop = RNA_def_property(srna, "land_smooth", PROP_FLOAT, PROP_NONE);
+ RNA_def_property_float_sdna(prop, NULL, "landing_smoothness");
+ RNA_def_property_range(prop, 0.0, 10.0);
+ RNA_def_property_ui_text(prop, "Landing Smoothness", "How smoothly the boids land");
+ RNA_def_property_update(prop, 0, "rna_Boids_reset");
+
+ prop = RNA_def_property(srna, "bank", PROP_FLOAT, PROP_NONE);
+ RNA_def_property_float_sdna(prop, NULL, "banking");
+ RNA_def_property_range(prop, 0.0, 2.0);
+ RNA_def_property_ui_text(prop, "Banking", "Amount of rotation around velocity vector on turns");
+ RNA_def_property_update(prop, 0, "rna_Boids_reset");
+
+ prop = RNA_def_property(srna, "pitch", PROP_FLOAT, PROP_NONE);
+ RNA_def_property_float_sdna(prop, NULL, "pitch");
+ RNA_def_property_range(prop, 0.0, 2.0);
+ RNA_def_property_ui_text(prop, "Pitch", "Amount of rotation around side vector");
+ RNA_def_property_update(prop, 0, "rna_Boids_reset");
+
+ prop = RNA_def_property(srna, "height", PROP_FLOAT, PROP_NONE);
+ RNA_def_property_range(prop, 0.0, 2.0);
+ RNA_def_property_ui_text(prop, "Height", "Boid height relative to particle size");
+ RNA_def_property_update(prop, 0, "rna_Boids_reset");
+
+ /* states */
+ prop = RNA_def_property(srna, "states", PROP_COLLECTION, PROP_NONE);
+ RNA_def_property_struct_type(prop, "BoidState");
+ RNA_def_property_ui_text(prop, "Boid States", "");
+
+ prop = RNA_def_property(srna, "active_boid_state", PROP_POINTER, PROP_NONE);
+ RNA_def_property_struct_type(prop, "BoidRule");
+ RNA_def_property_pointer_funcs(prop, "rna_BoidSettings_active_boid_state_get", NULL, NULL, NULL);
+ RNA_def_property_ui_text(prop, "Active Boid Rule", "");
+
+ prop = RNA_def_property(srna, "active_boid_state_index", PROP_INT, PROP_UNSIGNED);
+ RNA_def_property_int_funcs(prop, "rna_BoidSettings_active_boid_state_index_get",
+ "rna_BoidSettings_active_boid_state_index_set",
+ "rna_BoidSettings_active_boid_state_index_range");
+ RNA_def_property_ui_text(prop, "Active Boid State Index", "");
+
+ /* character properties */
+ prop = RNA_def_property(srna, "health", PROP_FLOAT, PROP_NONE);
+ RNA_def_property_range(prop, 0.0, 100.0);
+ RNA_def_property_ui_text(prop, "Health", "Initial boid health when born");
+ RNA_def_property_update(prop, 0, "rna_Boids_reset");
+
+ prop = RNA_def_property(srna, "strength", PROP_FLOAT, PROP_NONE);
+ RNA_def_property_range(prop, 0.0, 100.0);
+ RNA_def_property_ui_text(prop, "Strength", "Maximum caused damage on attack per second");
+ RNA_def_property_update(prop, 0, "rna_Boids_reset");
+
+ prop = RNA_def_property(srna, "aggression", PROP_FLOAT, PROP_NONE);
+ RNA_def_property_range(prop, 0.0, 100.0);
+ RNA_def_property_ui_text(prop, "Aggression", "Boid will fight this times stronger enemy");
+ RNA_def_property_update(prop, 0, "rna_Boids_reset");
+
+ prop = RNA_def_property(srna, "accuracy", PROP_FLOAT, PROP_NONE);
+ RNA_def_property_range(prop, 0.0, 1.0);
+ RNA_def_property_ui_text(prop, "Accuracy", "Accuracy of attack");
+ RNA_def_property_update(prop, 0, "rna_Boids_reset");
+
+ prop = RNA_def_property(srna, "range", PROP_FLOAT, PROP_NONE);
+ RNA_def_property_range(prop, 0.0, 100.0);
+ RNA_def_property_ui_text(prop, "Range", "Maximum distance from which a boid can attack");
+ RNA_def_property_update(prop, 0, "rna_Boids_reset");
+
+ /* physical properties */
+ prop = RNA_def_property(srna, "air_speed_min", PROP_FLOAT, PROP_NONE);
+ RNA_def_property_float_sdna(prop, NULL, "air_min_speed");
+ RNA_def_property_range(prop, 0.0, 1.0);
+ RNA_def_property_ui_text(prop, "Min Air Speed", "Minimum speed in air (relative to maximum speed)");
+ RNA_def_property_update(prop, 0, "rna_Boids_reset");
+
+ prop = RNA_def_property(srna, "air_speed_max", PROP_FLOAT, PROP_NONE);
+ RNA_def_property_float_sdna(prop, NULL, "air_max_speed");
+ RNA_def_property_range(prop, 0.0, 100.0);
+ RNA_def_property_ui_text(prop, "Max Air Speed", "Maximum speed in air");
+ RNA_def_property_update(prop, 0, "rna_Boids_reset");
+
+ prop = RNA_def_property(srna, "air_acc_max", PROP_FLOAT, PROP_NONE);
+ RNA_def_property_float_sdna(prop, NULL, "air_max_acc");
+ RNA_def_property_range(prop, 0.0, 1.0);
+ RNA_def_property_ui_text(prop, "Max Air Acceleration", "Maximum acceleration in air (relative to maximum speed)");
+ RNA_def_property_update(prop, 0, "rna_Boids_reset");
+
+ prop = RNA_def_property(srna, "air_ave_max", PROP_FLOAT, PROP_NONE);
+ RNA_def_property_float_sdna(prop, NULL, "air_max_ave");
+ RNA_def_property_range(prop, 0.0, 1.0);
+ RNA_def_property_ui_text(prop, "Max Air Angular Velocity",
+ "Maximum angular velocity in air (relative to 180 degrees)");
+ RNA_def_property_update(prop, 0, "rna_Boids_reset");
+
+ prop = RNA_def_property(srna, "air_personal_space", PROP_FLOAT, PROP_NONE);
+ RNA_def_property_range(prop, 0.0, 10.0);
+ RNA_def_property_ui_text(prop, "Air Personal Space", "Radius of boids personal space in air (% of particle size)");
+ RNA_def_property_update(prop, 0, "rna_Boids_reset");
+
+ prop = RNA_def_property(srna, "land_jump_speed", PROP_FLOAT, PROP_NONE);
+ RNA_def_property_range(prop, 0.0, 100.0);
+ RNA_def_property_ui_text(prop, "Jump Speed", "Maximum speed for jumping");
+ RNA_def_property_update(prop, 0, "rna_Boids_reset");
+
+ prop = RNA_def_property(srna, "land_speed_max", PROP_FLOAT, PROP_NONE);
+ RNA_def_property_float_sdna(prop, NULL, "land_max_speed");
+ RNA_def_property_range(prop, 0.0, 100.0);
+ RNA_def_property_ui_text(prop, "Max Land Speed", "Maximum speed on land");
+ RNA_def_property_update(prop, 0, "rna_Boids_reset");
+
+ prop = RNA_def_property(srna, "land_acc_max", PROP_FLOAT, PROP_NONE);
+ RNA_def_property_float_sdna(prop, NULL, "land_max_acc");
+ RNA_def_property_range(prop, 0.0, 1.0);
+ RNA_def_property_ui_text(prop, "Max Land Acceleration",
+ "Maximum acceleration on land (relative to maximum speed)");
+ RNA_def_property_update(prop, 0, "rna_Boids_reset");
+
+ prop = RNA_def_property(srna, "land_ave_max", PROP_FLOAT, PROP_NONE);
+ RNA_def_property_float_sdna(prop, NULL, "land_max_ave");
+ RNA_def_property_range(prop, 0.0, 1.0);
+ RNA_def_property_ui_text(prop, "Max Land Angular Velocity",
+ "Maximum angular velocity on land (relative to 180 degrees)");
+ RNA_def_property_update(prop, 0, "rna_Boids_reset");
+
+ prop = RNA_def_property(srna, "land_personal_space", PROP_FLOAT, PROP_NONE);
+ RNA_def_property_range(prop, 0.0, 10.0);
+ RNA_def_property_ui_text(prop, "Land Personal Space",
+ "Radius of boids personal space on land (% of particle size)");
+ RNA_def_property_update(prop, 0, "rna_Boids_reset");
+
+ prop = RNA_def_property(srna, "land_stick_force", PROP_FLOAT, PROP_NONE);
+ RNA_def_property_range(prop, 0.0, 1000.0);
+ RNA_def_property_ui_text(prop, "Land Stick Force", "How strong a force must be to start effecting a boid on land");
+ RNA_def_property_update(prop, 0, "rna_Boids_reset");
+
+ /* options */
+ prop = RNA_def_property(srna, "use_flight", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "options", BOID_ALLOW_FLIGHT);
+ RNA_def_property_ui_text(prop, "Allow Flight", "Allow boids to move in air");
+ RNA_def_property_update(prop, 0, "rna_Boids_reset");
+
+ prop = RNA_def_property(srna, "use_land", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "options", BOID_ALLOW_LAND);
+ RNA_def_property_ui_text(prop, "Allow Land", "Allow boids to move on land");
+ RNA_def_property_update(prop, 0, "rna_Boids_reset");
+
+ prop = RNA_def_property(srna, "use_climb", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "options", BOID_ALLOW_CLIMB);
+ RNA_def_property_ui_text(prop, "Allow Climbing", "Allow boids to climb goal objects");
+ RNA_def_property_update(prop, 0, "rna_Boids_reset");
+}
+
+void RNA_def_boid(BlenderRNA *brna)
+{
+ rna_def_boidrule(brna);
+ rna_def_boidstate(brna);
+ rna_def_boid_settings(brna);
+}
+
+#endif
diff --git a/source/blender/makesrna/intern/rna_color.c b/source/blender/makesrna/intern/rna_color.c
index b8051c4d0a2..d3cd3d12c4d 100644
--- a/source/blender/makesrna/intern/rna_color.c
+++ b/source/blender/makesrna/intern/rna_color.c
@@ -47,6 +47,7 @@
#include "DNA_movieclip_types.h"
#include "DNA_node_types.h"
#include "DNA_object_types.h"
+#include "DNA_particle_types.h"
#include "DNA_sequence_types.h"
#include "MEM_guardedalloc.h"
@@ -345,6 +346,13 @@ static void rna_ColorRamp_update(Main *bmain, Scene *UNUSED(scene), PointerRNA *
WM_main_add_notifier(NC_LINESTYLE, linestyle);
break;
}
+ case ID_PA:
+ {
+ ParticleSettings *part = ptr->id.data;
+
+ DAG_id_tag_update(&part->id, OB_RECALC_DATA | PSYS_RECALC_REDO);
+ WM_main_add_notifier(NC_OBJECT | ND_PARTICLE | NA_EDITED, part);
+ }
default:
break;
}
diff --git a/source/blender/makesrna/intern/rna_context.c b/source/blender/makesrna/intern/rna_context.c
index 1021aa60654..d7a679e9702 100644
--- a/source/blender/makesrna/intern/rna_context.c
+++ b/source/blender/makesrna/intern/rna_context.c
@@ -147,6 +147,7 @@ void RNA_def_context(BlenderRNA *brna)
{CTX_MODE_PAINT_WEIGHT, "PAINT_WEIGHT", 0, "Weight Paint", ""},
{CTX_MODE_PAINT_VERTEX, "PAINT_VERTEX", 0, "Vertex Paint", ""},
{CTX_MODE_PAINT_TEXTURE, "PAINT_TEXTURE", 0, "Texture Paint", ""},
+ {CTX_MODE_PARTICLE, "PARTICLE", 0, "Particle", ""},
{CTX_MODE_OBJECT, "OBJECT", 0, "Object", ""},
{0, NULL, 0, NULL, NULL}
};
diff --git a/source/blender/makesrna/intern/rna_dynamicpaint.c b/source/blender/makesrna/intern/rna_dynamicpaint.c
index 4cf6b027b06..4bb7f3a9ffd 100644
--- a/source/blender/makesrna/intern/rna_dynamicpaint.c
+++ b/source/blender/makesrna/intern/rna_dynamicpaint.c
@@ -56,6 +56,7 @@ EnumPropertyItem rna_enum_prop_dynamicpaint_type_items[] = {
#include "BKE_context.h"
#include "BKE_depsgraph.h"
+#include "BKE_particle.h"
static char *rna_DynamicPaintCanvasSettings_path(PointerRNA *ptr)
@@ -100,6 +101,11 @@ static void rna_DynamicPaint_redoModifier(Main *UNUSED(bmain), Scene *UNUSED(sce
DAG_id_tag_update(ptr->id.data, OB_RECALC_DATA);
}
+static void rna_DynamicPaintSurfaces_updateFrames(Main *UNUSED(bmain), Scene *UNUSED(scene), PointerRNA *ptr)
+{
+ dynamicPaint_cacheUpdateFrames((DynamicPaintSurface *)ptr->data);
+}
+
static void rna_DynamicPaintSurface_reset(Main *bmain, Scene *scene, PointerRNA *ptr)
{
dynamicPaint_resetSurface(scene, (DynamicPaintSurface *)ptr->data);
@@ -178,20 +184,20 @@ static void rna_DynamicPaint_surfaces_begin(CollectionPropertyIterator *iter, Po
rna_iterator_listbase_begin(iter, &canvas->surfaces, NULL);
}
-static int rna_Surface_active_index_get(PointerRNA *ptr)
+static int rna_Surface_active_point_index_get(PointerRNA *ptr)
{
DynamicPaintCanvasSettings *canvas = (DynamicPaintCanvasSettings *)ptr->data;
return canvas->active_sur;
}
-static void rna_Surface_active_index_set(struct PointerRNA *ptr, int value)
+static void rna_Surface_active_point_index_set(struct PointerRNA *ptr, int value)
{
DynamicPaintCanvasSettings *canvas = (DynamicPaintCanvasSettings *)ptr->data;
canvas->active_sur = value;
return;
}
-static void rna_Surface_active_range(PointerRNA *ptr, int *min, int *max,
+static void rna_Surface_active_point_range(PointerRNA *ptr, int *min, int *max,
int *UNUSED(softmin), int *UNUSED(softmax))
{
DynamicPaintCanvasSettings *canvas = (DynamicPaintCanvasSettings *)ptr->data;
@@ -216,7 +222,7 @@ static void rna_DynamicPaint_uvlayer_set(PointerRNA *ptr, const char *value)
}
}
-/* is cache used */
+/* is point cache used */
static int rna_DynamicPaint_is_cache_user_get(PointerRNA *ptr)
{
DynamicPaintSurface *surface = (DynamicPaintSurface *)ptr->data;
@@ -305,9 +311,9 @@ static void rna_def_canvas_surfaces(BlenderRNA *brna, PropertyRNA *cprop)
prop = RNA_def_property(srna, "active_index", PROP_INT, PROP_UNSIGNED);
RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
- RNA_def_property_int_funcs(prop, "rna_Surface_active_index_get", "rna_Surface_active_index_set",
- "rna_Surface_active_range");
- RNA_def_property_ui_text(prop, "Active Surface Index", "");
+ RNA_def_property_int_funcs(prop, "rna_Surface_active_point_index_get", "rna_Surface_active_point_index_set",
+ "rna_Surface_active_point_range");
+ RNA_def_property_ui_text(prop, "Active Point Cache Index", "");
prop = RNA_def_property(srna, "active", PROP_POINTER, PROP_NONE);
RNA_def_property_struct_type(prop, "DynamicPaintSurface");
@@ -467,7 +473,7 @@ static void rna_def_canvas_surface(BlenderRNA *brna)
RNA_def_property_range(prop, 1.0, MAXFRAMEF);
RNA_def_property_ui_range(prop, 1.0, 9999, 1, -1);
RNA_def_property_ui_text(prop, "Start Frame", "Simulation start frame");
- RNA_def_property_update(prop, NC_OBJECT | ND_MODIFIER, NULL);
+ RNA_def_property_update(prop, NC_OBJECT | ND_MODIFIER, "rna_DynamicPaintSurfaces_updateFrames");
prop = RNA_def_property(srna, "frame_end", PROP_INT, PROP_NONE);
RNA_def_property_int_sdna(prop, NULL, "end_frame");
@@ -475,7 +481,7 @@ static void rna_def_canvas_surface(BlenderRNA *brna)
RNA_def_property_range(prop, 1.0, MAXFRAMEF);
RNA_def_property_ui_range(prop, 1.0, 9999.0, 1, -1);
RNA_def_property_ui_text(prop, "End Frame", "Simulation end frame");
- RNA_def_property_update(prop, NC_OBJECT | ND_MODIFIER, NULL);
+ RNA_def_property_update(prop, NC_OBJECT | ND_MODIFIER, "rna_DynamicPaintSurfaces_updateFrames");
prop = RNA_def_property(srna, "frame_substeps", PROP_INT, PROP_NONE);
RNA_def_property_int_sdna(prop, NULL, "substeps");
@@ -716,6 +722,13 @@ static void rna_def_canvas_surface(BlenderRNA *brna)
RNA_def_property_boolean_sdna(prop, NULL, "flags", MOD_DPAINT_WAVE_OPEN_BORDERS);
RNA_def_property_ui_text(prop, "Open Borders", "Pass waves through mesh edges");
+
+ /* cache */
+ prop = RNA_def_property(srna, "point_cache", PROP_POINTER, PROP_NONE);
+ RNA_def_property_flag(prop, PROP_NEVER_NULL);
+ RNA_def_property_pointer_sdna(prop, NULL, "pointcache");
+ RNA_def_property_ui_text(prop, "Point Cache", "");
+
/* is cache used */
prop = RNA_def_property(srna, "is_cache_user", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_boolean_funcs(prop, "rna_DynamicPaint_is_cache_user_get", NULL);
@@ -942,6 +955,38 @@ static void rna_def_dynamic_paint_brush_settings(BlenderRNA *brna)
RNA_def_property_boolean_sdna(prop, NULL, "flags", MOD_DPAINT_NEGATE_VOLUME);
RNA_def_property_ui_text(prop, "Negate Volume", "Negate influence inside the volume");
RNA_def_property_update(prop, NC_OBJECT | ND_MODIFIER, "rna_DynamicPaint_redoModifier");
+
+
+ /*
+ * Particle
+ */
+ prop = RNA_def_property(srna, "particle_system", PROP_POINTER, PROP_NONE);
+ RNA_def_property_pointer_sdna(prop, NULL, "psys");
+ RNA_def_property_struct_type(prop, "ParticleSystem");
+ RNA_def_property_flag(prop, PROP_EDITABLE);
+ RNA_def_property_ui_text(prop, "Particle Systems", "The particle system to paint with");
+ RNA_def_property_update(prop, NC_OBJECT | ND_MODIFIER, "rna_DynamicPaint_reset_dependency");
+
+
+ prop = RNA_def_property(srna, "use_particle_radius", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "flags", MOD_DPAINT_PART_RAD);
+ RNA_def_property_ui_text(prop, "Use Particle Radius", "Use radius from particle settings");
+ RNA_def_property_update(prop, NC_OBJECT | ND_MODIFIER, "rna_DynamicPaint_redoModifier");
+
+ prop = RNA_def_property(srna, "solid_radius", PROP_FLOAT, PROP_NONE);
+ RNA_def_property_float_sdna(prop, NULL, "particle_radius");
+ RNA_def_property_range(prop, 0.01, 10.0);
+ RNA_def_property_ui_range(prop, 0.01, 2.0, 5, 3);
+ RNA_def_property_ui_text(prop, "Solid Radius", "Radius that will be painted solid");
+ RNA_def_property_update(prop, NC_OBJECT | ND_MODIFIER, "rna_DynamicPaint_redoModifier");
+
+ prop = RNA_def_property(srna, "smooth_radius", PROP_FLOAT, PROP_NONE);
+ RNA_def_property_float_sdna(prop, NULL, "particle_smooth");
+ RNA_def_property_range(prop, 0.0, 10.0);
+ RNA_def_property_ui_range(prop, 0.0, 1.0, 5, -1);
+ RNA_def_property_ui_text(prop, "Smooth Radius", "Smooth falloff added after solid radius");
+ RNA_def_property_update(prop, NC_OBJECT | ND_MODIFIER, "rna_DynamicPaint_redoModifier");
+
/*
* Color ramps
diff --git a/source/blender/makesrna/intern/rna_fluidsim.c b/source/blender/makesrna/intern/rna_fluidsim.c
index 06dec0998a5..091950a8e66 100644
--- a/source/blender/makesrna/intern/rna_fluidsim.c
+++ b/source/blender/makesrna/intern/rna_fluidsim.c
@@ -43,14 +43,16 @@
#include "MEM_guardedalloc.h"
-#include "DNA_object_types.h"
#include "DNA_scene_types.h"
+#include "DNA_particle_types.h"
#include "BKE_depsgraph.h"
#include "BKE_fluidsim.h"
#include "BKE_global.h"
#include "BKE_main.h"
#include "BKE_modifier.h"
+#include "BKE_particle.h"
+#include "BKE_pointcache.h"
static StructRNA *rna_FluidSettings_refine(struct PointerRNA *ptr)
{
@@ -119,10 +121,54 @@ static void rna_FluidSettings_update_type(Main *bmain, Scene *scene, PointerRNA
{
Object *ob = (Object *)ptr->id.data;
FluidsimModifierData *fluidmd;
+ ParticleSystemModifierData *psmd;
+ ParticleSystem *psys, *next_psys;
+ ParticleSettings *part;
fluidmd = (FluidsimModifierData *)modifiers_findByType(ob, eModifierType_Fluidsim);
fluidmd->fss->flag &= ~OB_FLUIDSIM_REVERSE; /* clear flag */
+ /* remove fluidsim particle system */
+ if (fluidmd->fss->type & OB_FLUIDSIM_PARTICLE) {
+ for (psys = ob->particlesystem.first; psys; psys = psys->next)
+ if (psys->part->type == PART_FLUID)
+ break;
+
+ if (ob->type == OB_MESH && !psys) {
+ /* add particle system */
+ part = psys_new_settings("ParticleSettings", bmain);
+ psys = MEM_callocN(sizeof(ParticleSystem), "particle_system");
+
+ part->type = PART_FLUID;
+ psys->part = part;
+ psys->pointcache = BKE_ptcache_add(&psys->ptcaches);
+ BLI_strncpy(psys->name, "FluidParticles", sizeof(psys->name));
+ BLI_addtail(&ob->particlesystem, psys);
+
+ /* add modifier */
+ psmd = (ParticleSystemModifierData *)modifier_new(eModifierType_ParticleSystem);
+ BLI_strncpy(psmd->modifier.name, "FluidParticleSystem", sizeof(psmd->modifier.name));
+ psmd->psys = psys;
+ BLI_addtail(&ob->modifiers, psmd);
+ modifier_unique_name(&ob->modifiers, (ModifierData *)psmd);
+ }
+ }
+ else {
+ for (psys = ob->particlesystem.first; psys; psys = next_psys) {
+ next_psys = psys->next;
+ if (psys->part->type == PART_FLUID) {
+ /* clear modifier */
+ psmd = psys_get_modifier(ob, psys);
+ BLI_remlink(&ob->modifiers, psmd);
+ modifier_free((ModifierData *)psmd);
+
+ /* clear particle system */
+ BLI_remlink(&ob->particlesystem, psys);
+ psys_free(ob, psys);
+ }
+ }
+ }
+
rna_fluid_update(bmain, scene, ptr);
}
diff --git a/source/blender/makesrna/intern/rna_internal.h b/source/blender/makesrna/intern/rna_internal.h
index c406aa987e5..76455adbc78 100644
--- a/source/blender/makesrna/intern/rna_internal.h
+++ b/source/blender/makesrna/intern/rna_internal.h
@@ -164,6 +164,7 @@ void RNA_def_object(struct BlenderRNA *brna);
void RNA_def_object_force(struct BlenderRNA *brna);
void RNA_def_packedfile(struct BlenderRNA *brna);
void RNA_def_palette(struct BlenderRNA *brna);
+void RNA_def_particle(struct BlenderRNA *brna);
void RNA_def_pose(struct BlenderRNA *brna);
void RNA_def_render(struct BlenderRNA *brna);
void RNA_def_rigidbody(struct BlenderRNA *brna);
@@ -326,6 +327,7 @@ void RNA_def_main_speakers(BlenderRNA *brna, PropertyRNA *cprop);
void RNA_def_main_sounds(BlenderRNA *brna, PropertyRNA *cprop);
void RNA_def_main_armatures(BlenderRNA *brna, PropertyRNA *cprop);
void RNA_def_main_actions(BlenderRNA *brna, PropertyRNA *cprop);
+void RNA_def_main_particles(BlenderRNA *brna, PropertyRNA *cprop);
void RNA_def_main_palettes(BlenderRNA *brna, PropertyRNA *cprop);
void RNA_def_main_gpencil(BlenderRNA *brna, PropertyRNA *cprop);
void RNA_def_main_movieclips(BlenderRNA *brna, PropertyRNA *cprop);
diff --git a/source/blender/makesrna/intern/rna_main.c b/source/blender/makesrna/intern/rna_main.c
index d5d6f609a03..94687b6fd46 100644
--- a/source/blender/makesrna/intern/rna_main.c
+++ b/source/blender/makesrna/intern/rna_main.c
@@ -239,6 +239,12 @@ static void rna_Main_brush_begin(CollectionPropertyIterator *iter, PointerRNA *p
rna_iterator_listbase_begin(iter, &bmain->brush, NULL);
}
+static void rna_Main_particle_begin(CollectionPropertyIterator *iter, PointerRNA *ptr)
+{
+ Main *bmain = (Main *)ptr->data;
+ rna_iterator_listbase_begin(iter, &bmain->particle, NULL);
+}
+
static void rna_Main_palettes_begin(CollectionPropertyIterator *iter, PointerRNA *ptr)
{
Main *bmain = (Main *)ptr->data;
@@ -354,6 +360,7 @@ void RNA_def_main(BlenderRNA *brna)
{"sounds", "Sound", "rna_Main_sound_begin", "Sounds", "Sound data-blocks", RNA_def_main_sounds},
{"armatures", "Armature", "rna_Main_armature_begin", "Armatures", "Armature data-blocks", RNA_def_main_armatures},
{"actions", "Action", "rna_Main_action_begin", "Actions", "Action data-blocks", RNA_def_main_actions},
+ {"particles", "ParticleSettings", "rna_Main_particle_begin", "Particles", "Particle data-blocks", RNA_def_main_particles},
{"palettes", "Palette", "rna_Main_palettes_begin", "Palettes", "Palette data-blocks", RNA_def_main_palettes},
{"grease_pencil", "GreasePencil", "rna_Main_gpencil_begin", "Grease Pencil", "Grease Pencil data-blocks", RNA_def_main_gpencil},
{"movieclips", "MovieClip", "rna_Main_movieclips_begin", "Movie Clips", "Movie Clip data-blocks", RNA_def_main_movieclips},
diff --git a/source/blender/makesrna/intern/rna_main_api.c b/source/blender/makesrna/intern/rna_main_api.c
index d8169e529aa..673f7acbd6a 100644
--- a/source/blender/makesrna/intern/rna_main_api.c
+++ b/source/blender/makesrna/intern/rna_main_api.c
@@ -74,6 +74,7 @@
#include "BKE_lattice.h"
#include "BKE_mball.h"
#include "BKE_world.h"
+#include "BKE_particle.h"
#include "BKE_paint.h"
#include "BKE_font.h"
#include "BKE_node.h"
@@ -99,6 +100,7 @@
#include "DNA_lattice_types.h"
#include "DNA_meta_types.h"
#include "DNA_world_types.h"
+#include "DNA_particle_types.h"
#include "DNA_vfont_types.h"
#include "DNA_node_types.h"
#include "DNA_movieclip_types.h"
@@ -442,6 +444,13 @@ static bAction *rna_Main_actions_new(Main *bmain, const char *name)
return act;
}
+static ParticleSettings *rna_Main_particles_new(Main *bmain, const char *name)
+{
+ ParticleSettings *part = psys_new_settings(name, bmain);
+ id_us_min(&part->id);
+ return part;
+}
+
static Palette *rna_Main_palettes_new(Main *bmain, const char *name)
{
Palette *palette = BKE_palette_add(bmain, name);
@@ -520,6 +529,7 @@ RNA_MAIN_ID_TAG_FUNCS_DEF(speakers, speaker, ID_SPK)
RNA_MAIN_ID_TAG_FUNCS_DEF(sounds, sound, ID_SO)
RNA_MAIN_ID_TAG_FUNCS_DEF(armatures, armature, ID_AR)
RNA_MAIN_ID_TAG_FUNCS_DEF(actions, action, ID_AC)
+RNA_MAIN_ID_TAG_FUNCS_DEF(particles, particle, ID_PA)
RNA_MAIN_ID_TAG_FUNCS_DEF(palettes, palettes, ID_PAL)
RNA_MAIN_ID_TAG_FUNCS_DEF(gpencil, gpencil, ID_GD)
RNA_MAIN_ID_TAG_FUNCS_DEF(movieclips, movieclip, ID_MC)
@@ -1468,6 +1478,42 @@ void RNA_def_main_actions(BlenderRNA *brna, PropertyRNA *cprop)
RNA_def_property_clear_flag(prop, PROP_EDITABLE);
RNA_def_property_boolean_funcs(prop, "rna_Main_actions_is_updated_get", NULL);
}
+void RNA_def_main_particles(BlenderRNA *brna, PropertyRNA *cprop)
+{
+ StructRNA *srna;
+ FunctionRNA *func;
+ PropertyRNA *parm;
+ PropertyRNA *prop;
+
+ RNA_def_property_srna(cprop, "BlendDataParticles");
+ srna = RNA_def_struct(brna, "BlendDataParticles", NULL);
+ RNA_def_struct_sdna(srna, "Main");
+ RNA_def_struct_ui_text(srna, "Main Particle Settings", "Collection of particle settings");
+
+ func = RNA_def_function(srna, "new", "rna_Main_particles_new");
+ RNA_def_function_ui_description(func, "Add a new particle settings instance to the main database");
+ parm = RNA_def_string(func, "name", "ParticleSettings", 0, "", "New name for the data-block");
+ RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);
+ /* return type */
+ parm = RNA_def_pointer(func, "particle", "ParticleSettings", "", "New particle settings data-block");
+ RNA_def_function_return(func, parm);
+
+ func = RNA_def_function(srna, "remove", "rna_Main_ID_remove");
+ RNA_def_function_flag(func, FUNC_USE_REPORTS);
+ RNA_def_function_ui_description(func, "Remove a particle settings instance from the current blendfile");
+ parm = RNA_def_pointer(func, "particle", "ParticleSettings", "", "Particle Settings to remove");
+ RNA_def_parameter_flags(parm, PROP_NEVER_NULL, PARM_REQUIRED | PARM_RNAPTR);
+ RNA_def_parameter_clear_flags(parm, PROP_THICK_WRAP, 0);
+ RNA_def_boolean(func, "do_unlink", true, "", "Unlink all usages of those particle settings before deleting them");
+
+ func = RNA_def_function(srna, "tag", "rna_Main_particles_tag");
+ parm = RNA_def_boolean(func, "value", 0, "Value", "");
+ RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);
+
+ prop = RNA_def_property(srna, "is_updated", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_clear_flag(prop, PROP_EDITABLE);
+ RNA_def_property_boolean_funcs(prop, "rna_Main_particles_is_updated_get", NULL);
+}
void RNA_def_main_palettes(BlenderRNA *brna, PropertyRNA *cprop)
{
diff --git a/source/blender/makesrna/intern/rna_modifier.c b/source/blender/makesrna/intern/rna_modifier.c
index 5d78df105da..c4f0db38a16 100644
--- a/source/blender/makesrna/intern/rna_modifier.c
+++ b/source/blender/makesrna/intern/rna_modifier.c
@@ -114,6 +114,8 @@ EnumPropertyItem rna_enum_object_modifier_type_items[] = {
{eModifierType_Explode, "EXPLODE", ICON_MOD_EXPLODE, "Explode", ""},
{eModifierType_Fluidsim, "FLUID_SIMULATION", ICON_MOD_FLUIDSIM, "Fluid Simulation", ""},
{eModifierType_Ocean, "OCEAN", ICON_MOD_OCEAN, "Ocean", ""},
+ {eModifierType_ParticleInstance, "PARTICLE_INSTANCE", ICON_MOD_PARTICLES, "Particle Instance", ""},
+ {eModifierType_ParticleSystem, "PARTICLE_SYSTEM", ICON_MOD_PARTICLES, "Particle System", ""},
{eModifierType_Smoke, "SMOKE", ICON_MOD_SMOKE, "Smoke", ""},
{eModifierType_Softbody, "SOFT_BODY", ICON_MOD_SOFT, "Soft Body", ""},
{eModifierType_Surface, "SURFACE", ICON_MOD_PHYSICS, "Surface", ""},
@@ -277,6 +279,7 @@ EnumPropertyItem rna_enum_axis_flag_xyz_items[] = {
#ifdef RNA_RUNTIME
+#include "DNA_particle_types.h"
#include "DNA_curve_types.h"
#include "DNA_smoke_types.h"
@@ -286,6 +289,7 @@ EnumPropertyItem rna_enum_axis_flag_xyz_items[] = {
#include "BKE_library.h"
#include "BKE_modifier.h"
#include "BKE_object.h"
+#include "BKE_particle.h"
#ifdef WITH_ALEMBIC
# include "ABC_alembic.h"
@@ -338,6 +342,10 @@ static StructRNA *rna_Modifier_refine(struct PointerRNA *ptr)
return &RNA_CastModifier;
case eModifierType_MeshDeform:
return &RNA_MeshDeformModifier;
+ case eModifierType_ParticleSystem:
+ return &RNA_ParticleSystemModifier;
+ case eModifierType_ParticleInstance:
+ return &RNA_ParticleInstanceModifier;
case eModifierType_Explode:
return &RNA_ExplodeModifier;
case eModifierType_Cloth:
@@ -699,6 +707,12 @@ static PointerRNA rna_SoftBodyModifier_settings_get(PointerRNA *ptr)
return rna_pointer_inherit_refine(ptr, &RNA_SoftBodySettings, ob->soft);
}
+static PointerRNA rna_SoftBodyModifier_point_cache_get(PointerRNA *ptr)
+{
+ Object *ob = (Object *)ptr->id.data;
+ return rna_pointer_inherit_refine(ptr, &RNA_PointCache, ob->soft->pointcache);
+}
+
static PointerRNA rna_CollisionModifier_settings_get(PointerRNA *ptr)
{
Object *ob = (Object *)ptr->id.data;
@@ -1886,6 +1900,12 @@ static void rna_def_modifier_softbody(BlenderRNA *brna)
RNA_def_property_struct_type(prop, "SoftBodySettings");
RNA_def_property_pointer_funcs(prop, "rna_SoftBodyModifier_settings_get", NULL, NULL, NULL);
RNA_def_property_ui_text(prop, "Soft Body Settings", "");
+
+ prop = RNA_def_property(srna, "point_cache", PROP_POINTER, PROP_NONE);
+ RNA_def_property_flag(prop, PROP_NEVER_NULL);
+ RNA_def_property_struct_type(prop, "PointCache");
+ RNA_def_property_pointer_funcs(prop, "rna_SoftBodyModifier_point_cache_get", NULL, NULL, NULL);
+ RNA_def_property_ui_text(prop, "Soft Body Point Cache", "");
}
static void rna_def_modifier_boolean(BlenderRNA *brna)
@@ -2557,6 +2577,104 @@ static void rna_def_modifier_meshdeform(BlenderRNA *brna)
#endif
}
+static void rna_def_modifier_particlesystem(BlenderRNA *brna)
+{
+ StructRNA *srna;
+ PropertyRNA *prop;
+
+ srna = RNA_def_struct(brna, "ParticleSystemModifier", "Modifier");
+ RNA_def_struct_ui_text(srna, "ParticleSystem Modifier", "Particle system simulation modifier");
+ RNA_def_struct_sdna(srna, "ParticleSystemModifierData");
+ RNA_def_struct_ui_icon(srna, ICON_MOD_PARTICLES);
+
+ prop = RNA_def_property(srna, "particle_system", PROP_POINTER, PROP_NONE);
+ RNA_def_property_flag(prop, PROP_NEVER_NULL);
+ RNA_def_property_pointer_sdna(prop, NULL, "psys");
+ RNA_def_property_ui_text(prop, "Particle System", "Particle System that this modifier controls");
+}
+
+static void rna_def_modifier_particleinstance(BlenderRNA *brna)
+{
+ StructRNA *srna;
+ PropertyRNA *prop;
+
+ srna = RNA_def_struct(brna, "ParticleInstanceModifier", "Modifier");
+ RNA_def_struct_ui_text(srna, "ParticleInstance Modifier", "Particle system instancing modifier");
+ RNA_def_struct_sdna(srna, "ParticleInstanceModifierData");
+ RNA_def_struct_ui_icon(srna, ICON_MOD_PARTICLES);
+
+ prop = RNA_def_property(srna, "object", PROP_POINTER, PROP_NONE);
+ RNA_def_property_pointer_sdna(prop, NULL, "ob");
+ RNA_def_property_pointer_funcs(prop, NULL, NULL, NULL, "rna_Mesh_object_poll");
+ RNA_def_property_ui_text(prop, "Object", "Object that has the particle system");
+ RNA_def_property_flag(prop, PROP_EDITABLE | PROP_ID_SELF_CHECK);
+ RNA_def_property_update(prop, 0, "rna_Modifier_dependency_update");
+
+ prop = RNA_def_property(srna, "particle_system_index", PROP_INT, PROP_NONE);
+ RNA_def_property_int_sdna(prop, NULL, "psys");
+ RNA_def_property_range(prop, 1, 10);
+ RNA_def_property_ui_text(prop, "Particle System Number", "");
+ RNA_def_property_update(prop, 0, "rna_Modifier_update");
+
+ prop = RNA_def_property(srna, "axis", PROP_ENUM, PROP_NONE);
+ RNA_def_property_enum_sdna(prop, NULL, "axis");
+ RNA_def_property_enum_items(prop, rna_enum_axis_xyz_items);
+ RNA_def_property_ui_text(prop, "Axis", "Pole axis for rotation");
+ RNA_def_property_update(prop, 0, "rna_Modifier_update");
+
+ prop = RNA_def_property(srna, "use_normal", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "flag", eParticleInstanceFlag_Parents);
+ RNA_def_property_ui_text(prop, "Normal", "Create instances from normal particles");
+ RNA_def_property_update(prop, 0, "rna_Modifier_update");
+
+ prop = RNA_def_property(srna, "use_children", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "flag", eParticleInstanceFlag_Children);
+ RNA_def_property_ui_text(prop, "Children", "Create instances from child particles");
+ RNA_def_property_update(prop, 0, "rna_Modifier_update");
+
+ prop = RNA_def_property(srna, "use_path", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "flag", eParticleInstanceFlag_Path);
+ RNA_def_property_ui_text(prop, "Path", "Create instances along particle paths");
+ RNA_def_property_update(prop, 0, "rna_Modifier_update");
+
+ prop = RNA_def_property(srna, "show_unborn", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "flag", eParticleInstanceFlag_Unborn);
+ RNA_def_property_ui_text(prop, "Unborn", "Show instances when particles are unborn");
+ RNA_def_property_update(prop, 0, "rna_Modifier_update");
+
+ prop = RNA_def_property(srna, "show_alive", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "flag", eParticleInstanceFlag_Alive);
+ RNA_def_property_ui_text(prop, "Alive", "Show instances when particles are alive");
+ RNA_def_property_update(prop, 0, "rna_Modifier_update");
+
+ prop = RNA_def_property(srna, "show_dead", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "flag", eParticleInstanceFlag_Dead);
+ RNA_def_property_ui_text(prop, "Dead", "Show instances when particles are dead");
+ RNA_def_property_update(prop, 0, "rna_Modifier_update");
+
+ prop = RNA_def_property(srna, "use_preserve_shape", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "flag", eParticleInstanceFlag_KeepShape);
+ RNA_def_property_ui_text(prop, "Keep Shape", "Don't stretch the object");
+ RNA_def_property_update(prop, 0, "rna_Modifier_update");
+
+ prop = RNA_def_property(srna, "use_size", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "flag", eParticleInstanceFlag_UseSize);
+ RNA_def_property_ui_text(prop, "Size", "Use particle size to scale the instances");
+ RNA_def_property_update(prop, 0, "rna_Modifier_update");
+
+ prop = RNA_def_property(srna, "position", PROP_FLOAT, PROP_NONE);
+ RNA_def_property_float_sdna(prop, NULL, "position");
+ RNA_def_property_range(prop, 0.0, 1.0);
+ RNA_def_property_ui_text(prop, "Position", "Position along path");
+ RNA_def_property_update(prop, 0, "rna_Modifier_update");
+
+ prop = RNA_def_property(srna, "random_position", PROP_FLOAT, PROP_NONE);
+ RNA_def_property_float_sdna(prop, NULL, "random_position");
+ RNA_def_property_range(prop, 0.0, 1.0);
+ RNA_def_property_ui_text(prop, "Random Position", "Randomize position along path");
+ RNA_def_property_update(prop, 0, "rna_Modifier_update");
+}
+
static void rna_def_modifier_explode(BlenderRNA *brna)
{
StructRNA *srna;
@@ -2633,6 +2751,10 @@ static void rna_def_modifier_cloth(BlenderRNA *brna)
RNA_def_property_struct_type(prop, "ClothSolverResult");
RNA_def_property_pointer_sdna(prop, NULL, "solver_result");
RNA_def_property_ui_text(prop, "Solver Result", "");
+
+ prop = RNA_def_property(srna, "point_cache", PROP_POINTER, PROP_NONE);
+ RNA_def_property_flag(prop, PROP_NEVER_NULL);
+ RNA_def_property_ui_text(prop, "Point Cache", "");
prop = RNA_def_property(srna, "hair_grid_min", PROP_FLOAT, PROP_NONE);
RNA_def_property_float_sdna(prop, NULL, "hair_grid_min");
@@ -4665,6 +4787,8 @@ void RNA_def_modifier(BlenderRNA *brna)
rna_def_modifier_correctivesmooth(brna);
rna_def_modifier_cast(brna);
rna_def_modifier_meshdeform(brna);
+ rna_def_modifier_particlesystem(brna);
+ rna_def_modifier_particleinstance(brna);
rna_def_modifier_explode(brna);
rna_def_modifier_cloth(brna);
rna_def_modifier_collision(brna);
diff --git a/source/blender/makesrna/intern/rna_nodetree.c b/source/blender/makesrna/intern/rna_nodetree.c
index 5f322485ca5..a9e78428212 100644
--- a/source/blender/makesrna/intern/rna_nodetree.c
+++ b/source/blender/makesrna/intern/rna_nodetree.c
@@ -38,6 +38,7 @@
#include "DNA_mesh_types.h"
#include "DNA_node_types.h"
#include "DNA_object_types.h"
+#include "DNA_particle_types.h"
#include "DNA_text_types.h"
#include "DNA_texture_types.h"
@@ -3012,6 +3013,36 @@ static void rna_CompositorNodeScale_update(Main *bmain, Scene *scene, PointerRNA
rna_Node_update(bmain, scene, ptr);
}
+static PointerRNA rna_ShaderNodePointDensity_psys_get(PointerRNA *ptr)
+{
+ bNode *node = ptr->data;
+ NodeShaderTexPointDensity *shader_point_density = node->storage;
+ Object *ob = (Object *)node->id;
+ ParticleSystem *psys = NULL;
+ PointerRNA value;
+
+ if (ob && shader_point_density->particle_system) {
+ psys = BLI_findlink(&ob->particlesystem, shader_point_density->particle_system - 1);
+ }
+
+ RNA_pointer_create(&ob->id, &RNA_ParticleSystem, psys, &value);
+ return value;
+}
+
+static void rna_ShaderNodePointDensity_psys_set(PointerRNA *ptr, PointerRNA value)
+{
+ bNode *node = ptr->data;
+ NodeShaderTexPointDensity *shader_point_density = node->storage;
+ Object *ob = (Object *)node->id;
+
+ if (ob && value.id.data == ob) {
+ shader_point_density->particle_system = BLI_findindex(&ob->particlesystem, value.data) + 1;
+ }
+ else {
+ shader_point_density->particle_system = 0;
+ }
+}
+
static int point_density_particle_color_source_from_shader(NodeShaderTexPointDensity *shader_point_density)
{
switch (shader_point_density->color_source) {
@@ -4061,6 +4092,14 @@ static void def_sh_tex_pointdensity(StructRNA *srna)
RNA_def_property_ui_text(prop, "Point Source", "Point data to use as renderable point density");
RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
+ prop = RNA_def_property(srna, "particle_system", PROP_POINTER, PROP_NONE);
+ RNA_def_property_ui_text(prop, "Particle System", "Particle System to render as points");
+ RNA_def_property_struct_type(prop, "ParticleSystem");
+ RNA_def_property_pointer_funcs(prop, "rna_ShaderNodePointDensity_psys_get",
+ "rna_ShaderNodePointDensity_psys_set", NULL, NULL);
+ RNA_def_property_flag(prop, PROP_EDITABLE);
+ RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
+
prop = RNA_def_property(srna, "resolution", PROP_INT, PROP_NONE);
RNA_def_property_range(prop, 1, 32768);
RNA_def_property_ui_text(prop, "Resolution", "Resolution used by the texture holding the point density");
diff --git a/source/blender/makesrna/intern/rna_object.c b/source/blender/makesrna/intern/rna_object.c
index 4f82fa0d1ec..0cffba47f16 100644
--- a/source/blender/makesrna/intern/rna_object.c
+++ b/source/blender/makesrna/intern/rna_object.c
@@ -68,6 +68,7 @@ EnumPropertyItem rna_enum_object_mode_items[] = {
{OB_MODE_VERTEX_PAINT, "VERTEX_PAINT", ICON_VPAINT_HLT, "Vertex Paint", ""},
{OB_MODE_WEIGHT_PAINT, "WEIGHT_PAINT", ICON_WPAINT_HLT, "Weight Paint", ""},
{OB_MODE_TEXTURE_PAINT, "TEXTURE_PAINT", ICON_TPAINT_HLT, "Texture Paint", ""},
+ {OB_MODE_PARTICLE_EDIT, "PARTICLE_EDIT", ICON_PARTICLEMODE, "Particle Edit", ""},
{OB_MODE_GPENCIL, "GPENCIL_EDIT", ICON_GREASEPENCIL, "Edit Strokes", "Edit Grease Pencil Strokes"},
{0, NULL, 0, NULL, NULL}
};
@@ -187,10 +188,12 @@ EnumPropertyItem rna_enum_object_axis_items[] = {
#include "BKE_object.h"
#include "BKE_material.h"
#include "BKE_mesh.h"
+#include "BKE_particle.h"
#include "BKE_scene.h"
#include "BKE_deform.h"
#include "ED_object.h"
+#include "ED_particle.h"
#include "ED_curve.h"
#include "ED_lattice.h"
@@ -724,6 +727,34 @@ static int rna_Object_active_material_editable(PointerRNA *ptr, const char **UNU
return is_editable ? PROP_EDITABLE : 0;
}
+
+static void rna_Object_active_particle_system_index_range(PointerRNA *ptr, int *min, int *max,
+ int *UNUSED(softmin), int *UNUSED(softmax))
+{
+ Object *ob = (Object *)ptr->id.data;
+ *min = 0;
+ *max = max_ii(0, BLI_listbase_count(&ob->particlesystem) - 1);
+}
+
+static int rna_Object_active_particle_system_index_get(PointerRNA *ptr)
+{
+ Object *ob = (Object *)ptr->id.data;
+ return psys_get_current_num(ob);
+}
+
+static void rna_Object_active_particle_system_index_set(PointerRNA *ptr, int value)
+{
+ Object *ob = (Object *)ptr->id.data;
+ psys_set_current_num(ob, value);
+}
+
+static void rna_Object_particle_update(Main *UNUSED(bmain), Scene *scene, PointerRNA *ptr)
+{
+ Object *ob = (Object *)ptr->id.data;
+
+ PE_current_changed(scene, ob);
+}
+
/* rotation - axis-angle */
static void rna_Object_rotation_axis_angle_get(PointerRNA *ptr, float *value)
{
@@ -1044,6 +1075,13 @@ static void rna_GameObjectSettings_physics_type_set(PointerRNA *ptr, int value)
WM_main_add_notifier(NC_OBJECT | ND_DRAW, ptr->id.data);
}
+static PointerRNA rna_Object_active_particle_system_get(PointerRNA *ptr)
+{
+ Object *ob = (Object *)ptr->id.data;
+ ParticleSystem *psys = psys_get_current(ob);
+ return rna_pointer_inherit_refine(ptr, &RNA_ParticleSystem, psys);
+}
+
static PointerRNA rna_Object_game_settings_get(PointerRNA *ptr)
{
return rna_pointer_inherit_refine(ptr, &RNA_GameObjectSettings, ptr->id.data);
@@ -1989,6 +2027,37 @@ static void rna_def_object_modifiers(BlenderRNA *brna, PropertyRNA *cprop)
RNA_def_function_ui_description(func, "Remove all modifiers from the object");
}
+/* object.particle_systems */
+static void rna_def_object_particle_systems(BlenderRNA *brna, PropertyRNA *cprop)
+{
+ StructRNA *srna;
+
+ PropertyRNA *prop;
+
+ /* FunctionRNA *func; */
+ /* PropertyRNA *parm; */
+
+ RNA_def_property_srna(cprop, "ParticleSystems");
+ srna = RNA_def_struct(brna, "ParticleSystems", NULL);
+ RNA_def_struct_sdna(srna, "Object");
+ RNA_def_struct_ui_text(srna, "Particle Systems", "Collection of particle systems");
+
+ prop = RNA_def_property(srna, "active", PROP_POINTER, PROP_NONE);
+ RNA_def_property_struct_type(prop, "ParticleSystem");
+ RNA_def_property_pointer_funcs(prop, "rna_Object_active_particle_system_get", NULL, NULL, NULL);
+ RNA_def_property_ui_text(prop, "Active Particle System", "Active particle system being displayed");
+ RNA_def_property_update(prop, NC_OBJECT | ND_DRAW, NULL);
+
+ prop = RNA_def_property(srna, "active_index", PROP_INT, PROP_UNSIGNED);
+ RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
+ RNA_def_property_int_funcs(prop, "rna_Object_active_particle_system_index_get",
+ "rna_Object_active_particle_system_index_set",
+ "rna_Object_active_particle_system_index_range");
+ RNA_def_property_ui_text(prop, "Active Particle System Index", "Index of active particle system slot");
+ RNA_def_property_update(prop, NC_OBJECT | ND_DRAW, "rna_Object_particle_update");
+}
+
+
/* object.vertex_groups */
static void rna_def_object_vertex_groups(BlenderRNA *brna, PropertyRNA *cprop)
{
@@ -2518,6 +2587,13 @@ static void rna_def_object(BlenderRNA *brna)
RNA_def_property_struct_type(prop, "SoftBodySettings");
RNA_def_property_ui_text(prop, "Soft Body Settings", "Settings for soft body simulation");
+ prop = RNA_def_property(srna, "particle_systems", PROP_COLLECTION, PROP_NONE);
+ RNA_def_property_collection_sdna(prop, NULL, "particlesystem", NULL);
+ RNA_def_property_struct_type(prop, "ParticleSystem");
+ RNA_def_property_ui_text(prop, "Particle Systems", "Particle systems emitted from the object");
+ rna_def_object_particle_systems(brna, prop);
+
+
prop = RNA_def_property(srna, "rigid_body", PROP_POINTER, PROP_NONE);
RNA_def_property_pointer_sdna(prop, NULL, "rigidbody_object");
RNA_def_property_struct_type(prop, "RigidBodyObject");
@@ -2800,6 +2876,10 @@ static void rna_def_dupli_object(BlenderRNA *brna)
RNA_def_property_clear_flag(prop, PROP_ANIMATABLE | PROP_EDITABLE);
RNA_def_property_ui_text(prop, "Persistent ID", "Persistent identifier for inter-frame matching of objects with motion blur");
+ prop = RNA_def_property(srna, "particle_system", PROP_POINTER, PROP_NONE);
+ RNA_def_property_clear_flag(prop, PROP_ANIMATABLE | PROP_EDITABLE);
+ RNA_def_property_ui_text(prop, "Particle System", "Particle system that this dupli object was instanced from");
+
prop = RNA_def_property(srna, "orco", PROP_FLOAT, PROP_TRANSLATION);
RNA_def_property_clear_flag(prop, PROP_ANIMATABLE | PROP_EDITABLE);
RNA_def_property_ui_text(prop, "Generated Coordinates", "Generated coordinates in parent object space");
diff --git a/source/blender/makesrna/intern/rna_object_api.c b/source/blender/makesrna/intern/rna_object_api.c
index 06affc7787c..c680abe71a4 100644
--- a/source/blender/makesrna/intern/rna_object_api.c
+++ b/source/blender/makesrna/intern/rna_object_api.c
@@ -146,9 +146,54 @@ static Mesh *rna_Object_to_mesh(
return rna_Main_meshes_new_from_object(G.main, reports, sce, ob, apply_modifiers, settings, calc_tessface, calc_undeformed);
}
+/* mostly a copy from convertblender.c */
+static void dupli_render_particle_set(Scene *scene, Object *ob, int level, int enable)
+{
+ /* ugly function, but we need to set particle systems to their render
+ * settings before calling object_duplilist, to get render level duplis */
+ Group *group;
+ GroupObject *go;
+ ParticleSystem *psys;
+ DerivedMesh *dm;
+ float mat[4][4];
+
+ unit_m4(mat);
+
+ if (level >= MAX_DUPLI_RECUR)
+ return;
+
+ if (ob->transflag & OB_DUPLIPARTS) {
+ for (psys = ob->particlesystem.first; psys; psys = psys->next) {
+ if (ELEM(psys->part->ren_as, PART_DRAW_OB, PART_DRAW_GR)) {
+ if (enable)
+ psys_render_set(ob, psys, mat, mat, 1, 1, 0.f);
+ else
+ psys_render_restore(ob, psys);
+ }
+ }
+
+ if (enable) {
+ /* this is to make sure we get render level duplis in groups:
+ * the derivedmesh must be created before init_render_mesh,
+ * since object_duplilist does dupliparticles before that */
+ dm = mesh_create_derived_render(scene, ob, CD_MASK_BAREMESH | CD_MASK_MLOOPUV | CD_MASK_MLOOPCOL);
+ dm->release(dm);
+
+ for (psys = ob->particlesystem.first; psys; psys = psys->next)
+ psys_get_modifier(ob, psys)->flag &= ~eParticleSystemFlag_psys_updated;
+ }
+ }
+
+ if (ob->dup_group == NULL) return;
+ group = ob->dup_group;
+
+ for (go = group->gobject.first; go; go = go->next)
+ dupli_render_particle_set(scene, go->ob, level + 1, enable);
+}
/* When no longer needed, duplilist should be freed with Object.free_duplilist */
static void rna_Object_create_duplilist(Object *ob, ReportList *reports, Scene *sce, int settings)
{
+ bool for_render = (settings == DAG_EVAL_RENDER);
EvaluationContext eval_ctx;
DEG_evaluation_context_init(&eval_ctx, settings);
@@ -164,7 +209,11 @@ static void rna_Object_create_duplilist(Object *ob, ReportList *reports, Scene *
free_object_duplilist(ob->duplilist);
ob->duplilist = NULL;
}
+ if (for_render)
+ dupli_render_particle_set(sce, ob, 0, 1);
ob->duplilist = object_duplilist(&eval_ctx, sce, ob);
+ if (for_render)
+ dupli_render_particle_set(sce, ob, 0, 0);
/* ob->duplilist should now be freed with Object.free_duplilist */
}
diff --git a/source/blender/makesrna/intern/rna_object_force.c b/source/blender/makesrna/intern/rna_object_force.c
index ad927073871..1d89f7535c4 100644
--- a/source/blender/makesrna/intern/rna_object_force.c
+++ b/source/blender/makesrna/intern/rna_object_force.c
@@ -29,6 +29,7 @@
#include "DNA_cloth_types.h"
#include "DNA_object_types.h"
#include "DNA_object_force.h"
+#include "DNA_particle_types.h"
#include "DNA_scene_types.h"
#include "DNA_smoke_types.h"
@@ -90,16 +91,233 @@ static EnumPropertyItem empty_vortex_shape_items[] = {
#include "MEM_guardedalloc.h"
-#include "DNA_dynamicpaint_types.h"
#include "DNA_modifier_types.h"
#include "DNA_texture_types.h"
#include "BKE_context.h"
#include "BKE_modifier.h"
+#include "BKE_pointcache.h"
#include "BKE_depsgraph.h"
#include "ED_object.h"
+static void rna_Cache_change(Main *UNUSED(bmain), Scene *UNUSED(scene), PointerRNA *ptr)
+{
+ Object *ob = (Object *)ptr->id.data;
+ PointCache *cache = (PointCache *)ptr->data;
+ PTCacheID *pid = NULL;
+ ListBase pidlist;
+
+ if (!ob)
+ return;
+
+ cache->flag |= PTCACHE_OUTDATED;
+
+ BKE_ptcache_ids_from_object(&pidlist, ob, NULL, 0);
+
+ DAG_id_tag_update(&ob->id, OB_RECALC_DATA);
+
+ for (pid = pidlist.first; pid; pid = pid->next) {
+ if (pid->cache == cache)
+ break;
+ }
+
+ if (pid) {
+ /* Just make sure this wasn't changed. */
+ if (pid->type == PTCACHE_TYPE_SMOKE_DOMAIN)
+ cache->step = 1;
+ BKE_ptcache_update_info(pid);
+ }
+
+ BLI_freelistN(&pidlist);
+}
+
+static void rna_Cache_toggle_disk_cache(Main *UNUSED(bmain), Scene *UNUSED(scene), PointerRNA *ptr)
+{
+ Object *ob = (Object *)ptr->id.data;
+ PointCache *cache = (PointCache *)ptr->data;
+ PTCacheID *pid = NULL;
+ ListBase pidlist;
+
+ if (!ob)
+ return;
+
+ BKE_ptcache_ids_from_object(&pidlist, ob, NULL, 0);
+
+ for (pid = pidlist.first; pid; pid = pid->next) {
+ if (pid->cache == cache)
+ break;
+ }
+
+ /* smoke can only use disk cache */
+ if (pid && pid->type != PTCACHE_TYPE_SMOKE_DOMAIN)
+ BKE_ptcache_toggle_disk_cache(pid);
+ else
+ cache->flag ^= PTCACHE_DISK_CACHE;
+
+ BLI_freelistN(&pidlist);
+}
+
+static void rna_Cache_idname_change(Main *UNUSED(bmain), Scene *UNUSED(scene), PointerRNA *ptr)
+{
+ Object *ob = (Object *)ptr->id.data;
+ PointCache *cache = (PointCache *)ptr->data;
+ PTCacheID *pid = NULL, *pid2 = NULL;
+ ListBase pidlist;
+ bool use_new_name = true;
+
+ if (!ob)
+ return;
+
+ /* TODO: check for proper characters */
+
+ BKE_ptcache_ids_from_object(&pidlist, ob, NULL, 0);
+
+ if (cache->flag & PTCACHE_EXTERNAL) {
+ for (pid = pidlist.first; pid; pid = pid->next) {
+ if (pid->cache == cache)
+ break;
+ }
+
+ if (!pid)
+ return;
+
+ BKE_ptcache_load_external(pid);
+
+ DAG_id_tag_update(&ob->id, OB_RECALC_DATA);
+ WM_main_add_notifier(NC_OBJECT | ND_POINTCACHE, ob);
+ }
+ else {
+ for (pid = pidlist.first; pid; pid = pid->next) {
+ if (pid->cache == cache)
+ pid2 = pid;
+ else if (cache->name[0] != '\0' && STREQ(cache->name, pid->cache->name)) {
+ /*TODO: report "name exists" to user */
+ BLI_strncpy(cache->name, cache->prev_name, sizeof(cache->name));
+ use_new_name = false;
+ }
+ }
+
+ if (use_new_name) {
+ BLI_filename_make_safe(cache->name);
+
+ if (pid2 && cache->flag & PTCACHE_DISK_CACHE) {
+ char old_name[80];
+ char new_name[80];
+
+ BLI_strncpy(old_name, cache->prev_name, sizeof(old_name));
+ BLI_strncpy(new_name, cache->name, sizeof(new_name));
+
+ BKE_ptcache_disk_cache_rename(pid2, old_name, new_name);
+ }
+
+ BLI_strncpy(cache->prev_name, cache->name, sizeof(cache->prev_name));
+ }
+ }
+
+ BLI_freelistN(&pidlist);
+}
+
+static void rna_Cache_list_begin(CollectionPropertyIterator *iter, PointerRNA *ptr)
+{
+ PointCache *cache = ptr->data;
+ ListBase lb;
+
+ while (cache->prev)
+ cache = cache->prev;
+
+ lb.first = cache;
+ lb.last = NULL; /* not used by listbase_begin */
+
+ rna_iterator_listbase_begin(iter, &lb, NULL);
+}
+static void rna_Cache_active_point_cache_index_range(PointerRNA *ptr, int *min, int *max,
+ int *UNUSED(softmin), int *UNUSED(softmax))
+{
+ Object *ob = ptr->id.data;
+ PointCache *cache = ptr->data;
+ PTCacheID *pid;
+ ListBase pidlist;
+
+ BKE_ptcache_ids_from_object(&pidlist, ob, NULL, 0);
+
+ *min = 0;
+ *max = 0;
+
+ for (pid = pidlist.first; pid; pid = pid->next) {
+ if (pid->cache == cache) {
+ *max = max_ii(0, BLI_listbase_count(pid->ptcaches) - 1);
+ break;
+ }
+ }
+
+ BLI_freelistN(&pidlist);
+}
+
+static int rna_Cache_active_point_cache_index_get(PointerRNA *ptr)
+{
+ Object *ob = ptr->id.data;
+ PointCache *cache = ptr->data;
+ PTCacheID *pid;
+ ListBase pidlist;
+ int num = 0;
+
+ BKE_ptcache_ids_from_object(&pidlist, ob, NULL, 0);
+
+ for (pid = pidlist.first; pid; pid = pid->next) {
+ if (pid->cache == cache) {
+ num = BLI_findindex(pid->ptcaches, cache);
+ break;
+ }
+ }
+
+ BLI_freelistN(&pidlist);
+
+ return num;
+}
+
+static void rna_Cache_active_point_cache_index_set(struct PointerRNA *ptr, int value)
+{
+ Object *ob = ptr->id.data;
+ PointCache *cache = ptr->data;
+ PTCacheID *pid;
+ ListBase pidlist;
+
+ BKE_ptcache_ids_from_object(&pidlist, ob, NULL, 0);
+
+ for (pid = pidlist.first; pid; pid = pid->next) {
+ if (pid->cache == cache) {
+ *(pid->cache_ptr) = BLI_findlink(pid->ptcaches, value);
+ break;
+ }
+ }
+
+ BLI_freelistN(&pidlist);
+}
+
+static void rna_PointCache_frame_step_range(PointerRNA *ptr, int *min, int *max,
+ int *UNUSED(softmin), int *UNUSED(softmax))
+{
+ Object *ob = ptr->id.data;
+ PointCache *cache = ptr->data;
+ PTCacheID *pid;
+ ListBase pidlist;
+
+ *min = 1;
+ *max = 20;
+
+ BKE_ptcache_ids_from_object(&pidlist, ob, NULL, 0);
+
+ for (pid = pidlist.first; pid; pid = pid->next) {
+ if (pid->cache == cache) {
+ *max = pid->max_step;
+ break;
+ }
+ }
+
+ BLI_freelistN(&pidlist);
+}
+
static char *rna_CollisionSettings_path(PointerRNA *UNUSED(ptr))
{
/* both methods work ok, but return the shorter path */
@@ -259,25 +477,53 @@ static char *rna_SoftBodySettings_path(PointerRNA *ptr)
return BLI_sprintfN("modifiers[\"%s\"].settings", name_esc);
}
+static int particle_id_check(PointerRNA *ptr)
+{
+ ID *id = ptr->id.data;
+
+ return (GS(id->name) == ID_PA);
+}
+
static void rna_FieldSettings_update(Main *UNUSED(bmain), Scene *UNUSED(scene), PointerRNA *ptr)
{
- Object *ob = (Object *)ptr->id.data;
+ if (particle_id_check(ptr)) {
+ ParticleSettings *part = (ParticleSettings *)ptr->id.data;
+
+ if (part->pd->forcefield != PFIELD_TEXTURE && part->pd->tex) {
+ id_us_min(&part->pd->tex->id);
+ part->pd->tex = NULL;
+ }
+
+ if (part->pd2 && part->pd2->forcefield != PFIELD_TEXTURE && part->pd2->tex) {
+ id_us_min(&part->pd2->tex->id);
+ part->pd2->tex = NULL;
+ }
+
+ DAG_id_tag_update(&part->id, OB_RECALC_OB | OB_RECALC_DATA | OB_RECALC_TIME | PSYS_RECALC_RESET);
+ WM_main_add_notifier(NC_OBJECT | ND_DRAW, NULL);
- if (ob->pd->forcefield != PFIELD_TEXTURE && ob->pd->tex) {
- id_us_min(&ob->pd->tex->id);
- ob->pd->tex = NULL;
}
+ else {
+ Object *ob = (Object *)ptr->id.data;
- DAG_id_tag_update(&ob->id, OB_RECALC_OB);
- WM_main_add_notifier(NC_OBJECT | ND_DRAW, ob);
+ if (ob->pd->forcefield != PFIELD_TEXTURE && ob->pd->tex) {
+ id_us_min(&ob->pd->tex->id);
+ ob->pd->tex = NULL;
+ }
+
+ DAG_id_tag_update(&ob->id, OB_RECALC_OB);
+ WM_main_add_notifier(NC_OBJECT | ND_DRAW, ob);
+ }
}
static void rna_FieldSettings_shape_update(Main *bmain, Scene *scene, PointerRNA *ptr)
{
- Object *ob = (Object *)ptr->id.data;
- ED_object_check_force_modifiers(bmain, scene, ob);
- WM_main_add_notifier(NC_OBJECT | ND_DRAW, ob);
- WM_main_add_notifier(NC_OBJECT | ND_MODIFIER, ob);
+ if (!particle_id_check(ptr)) {
+ Object *ob = (Object *)ptr->id.data;
+ ED_object_check_force_modifiers(bmain, scene, ob);
+ WM_main_add_notifier(NC_OBJECT | ND_DRAW, ob);
+ WM_main_add_notifier(NC_OBJECT | ND_MODIFIER, ob);
+ }
}
static void rna_FieldSettings_type_set(PointerRNA *ptr, int value)
@@ -286,39 +532,46 @@ static void rna_FieldSettings_type_set(PointerRNA *ptr, int value)
part_deflect->forcefield = value;
- Object *ob = (Object *)ptr->id.data;
- ob->pd->forcefield = value;
- if (ELEM(value, PFIELD_WIND, PFIELD_VORTEX)) {
- ob->empty_drawtype = OB_SINGLE_ARROW;
- }
- else {
- ob->empty_drawtype = OB_PLAINAXES;
+ if (!particle_id_check(ptr)) {
+ Object *ob = (Object *)ptr->id.data;
+ ob->pd->forcefield = value;
+ if (ELEM(value, PFIELD_WIND, PFIELD_VORTEX)) {
+ ob->empty_drawtype = OB_SINGLE_ARROW;
+ }
+ else {
+ ob->empty_drawtype = OB_PLAINAXES;
+ }
}
}
static void rna_FieldSettings_dependency_update(Main *bmain, Scene *scene, PointerRNA *ptr)
{
- Object *ob = (Object *)ptr->id.data;
+ if (particle_id_check(ptr)) {
+ DAG_id_tag_update((ID *)ptr->id.data, OB_RECALC_OB | OB_RECALC_DATA | OB_RECALC_TIME | PSYS_RECALC_RESET);
+ }
+ else {
+ Object *ob = (Object *)ptr->id.data;
- /* do this before scene sort, that one checks for CU_PATH */
+ /* do this before scene sort, that one checks for CU_PATH */
#if 0 /* XXX */
- if (ob->type == OB_CURVE && ob->pd->forcefield == PFIELD_GUIDE) {
- Curve *cu = ob->data;
- cu->flag |= (CU_PATH | CU_3D);
- do_curvebuts(B_CU3D); /* all curves too */
- }
+ if (ob->type == OB_CURVE && ob->pd->forcefield == PFIELD_GUIDE) {
+ Curve *cu = ob->data;
+ cu->flag |= (CU_PATH | CU_3D);
+ do_curvebuts(B_CU3D); /* all curves too */
+ }
#endif
- rna_FieldSettings_shape_update(bmain, scene, ptr);
+ rna_FieldSettings_shape_update(bmain, scene, ptr);
- DAG_relations_tag_update(bmain);
+ DAG_relations_tag_update(bmain);
- if (ob->type == OB_CURVE && ob->pd->forcefield == PFIELD_GUIDE)
- DAG_id_tag_update(&ob->id, OB_RECALC_OB | OB_RECALC_DATA | OB_RECALC_TIME);
- else
- DAG_id_tag_update(&ob->id, OB_RECALC_OB);
+ if (ob->type == OB_CURVE && ob->pd->forcefield == PFIELD_GUIDE)
+ DAG_id_tag_update(&ob->id, OB_RECALC_OB | OB_RECALC_DATA | OB_RECALC_TIME);
+ else
+ DAG_id_tag_update(&ob->id, OB_RECALC_OB);
- WM_main_add_notifier(NC_OBJECT | ND_DRAW, ob);
+ WM_main_add_notifier(NC_OBJECT | ND_DRAW, ob);
+ }
}
static char *rna_FieldSettings_path(PointerRNA *ptr)
@@ -327,12 +580,22 @@ static char *rna_FieldSettings_path(PointerRNA *ptr)
/* Check through all possible places the settings can be to find the right one */
- /* object force field */
- Object *ob = (Object *)ptr->id.data;
-
- if (ob->pd == pd)
- return BLI_sprintfN("field");
-
+ if (particle_id_check(ptr)) {
+ /* particle system force field */
+ ParticleSettings *part = (ParticleSettings *)ptr->id.data;
+
+ if (part->pd == pd)
+ return BLI_sprintfN("force_field_1");
+ else if (part->pd2 == pd)
+ return BLI_sprintfN("force_field_2");
+ }
+ else {
+ /* object force field */
+ Object *ob = (Object *)ptr->id.data;
+
+ if (ob->pd == pd)
+ return BLI_sprintfN("field");
+ }
return NULL;
}
@@ -340,15 +603,25 @@ static void rna_EffectorWeight_update(Main *UNUSED(bmain), Scene *UNUSED(scene),
{
ID *id = ptr->id.data;
- DAG_id_tag_update(id, OB_RECALC_DATA);
- WM_main_add_notifier(NC_OBJECT | ND_DRAW, NULL);
+ if (id && GS(id->name) == ID_SCE) {
+ Scene *scene = (Scene *)id;
+ Base *base;
+
+ for (base = scene->base.first; base; base = base->next) {
+ BKE_ptcache_object_reset(scene, base->object, PTCACHE_RESET_DEPSGRAPH);
+ }
+ }
+ else {
+ DAG_id_tag_update(id, OB_RECALC_DATA | PSYS_RECALC_RESET);
+ WM_main_add_notifier(NC_OBJECT | ND_DRAW, NULL);
+ }
}
static void rna_EffectorWeight_dependency_update(Main *bmain, Scene *UNUSED(scene), PointerRNA *ptr)
{
DAG_relations_tag_update(bmain);
- DAG_id_tag_update((ID *)ptr->id.data, OB_RECALC_DATA);
+ DAG_id_tag_update((ID *)ptr->id.data, OB_RECALC_DATA | PSYS_RECALC_RESET);
WM_main_add_notifier(NC_OBJECT | ND_DRAW, NULL);
}
@@ -358,59 +631,68 @@ static char *rna_EffectorWeight_path(PointerRNA *ptr)
EffectorWeights *ew = (EffectorWeights *)ptr->data;
/* Check through all possible places the settings can be to find the right one */
- Object *ob = (Object *)ptr->id.data;
- ModifierData *md;
-
- /* check softbody modifier */
- md = (ModifierData *)modifiers_findByType(ob, eModifierType_Softbody);
- if (md) {
- /* no pointer from modifier data to actual softbody storage, would be good to add */
- if (ob->soft->effector_weights == ew) {
- char name_esc[sizeof(md->name) * 2];
- BLI_strescape(name_esc, md->name, sizeof(name_esc));
- return BLI_sprintfN("modifiers[\"%s\"].settings.effector_weights", name_esc);
- }
+ if (particle_id_check(ptr)) {
+ /* particle effector weights */
+ ParticleSettings *part = (ParticleSettings *)ptr->id.data;
+
+ if (part->effector_weights == ew)
+ return BLI_sprintfN("effector_weights");
}
-
- /* check cloth modifier */
- md = (ModifierData *)modifiers_findByType(ob, eModifierType_Cloth);
- if (md) {
- ClothModifierData *cmd = (ClothModifierData *)md;
- if (cmd->sim_parms->effector_weights == ew) {
- char name_esc[sizeof(md->name) * 2];
- BLI_strescape(name_esc, md->name, sizeof(name_esc));
- return BLI_sprintfN("modifiers[\"%s\"].settings.effector_weights", name_esc);
+ else {
+ Object *ob = (Object *)ptr->id.data;
+ ModifierData *md;
+
+ /* check softbody modifier */
+ md = (ModifierData *)modifiers_findByType(ob, eModifierType_Softbody);
+ if (md) {
+ /* no pointer from modifier data to actual softbody storage, would be good to add */
+ if (ob->soft->effector_weights == ew) {
+ char name_esc[sizeof(md->name) * 2];
+ BLI_strescape(name_esc, md->name, sizeof(name_esc));
+ return BLI_sprintfN("modifiers[\"%s\"].settings.effector_weights", name_esc);
+ }
}
- }
-
- /* check smoke modifier */
- md = (ModifierData *)modifiers_findByType(ob, eModifierType_Smoke);
- if (md) {
- SmokeModifierData *smd = (SmokeModifierData *)md;
- if (smd->domain->effector_weights == ew) {
- char name_esc[sizeof(md->name) * 2];
- BLI_strescape(name_esc, md->name, sizeof(name_esc));
- return BLI_sprintfN("modifiers[\"%s\"].settings.effector_weights", name_esc);
+
+ /* check cloth modifier */
+ md = (ModifierData *)modifiers_findByType(ob, eModifierType_Cloth);
+ if (md) {
+ ClothModifierData *cmd = (ClothModifierData *)md;
+ if (cmd->sim_parms->effector_weights == ew) {
+ char name_esc[sizeof(md->name) * 2];
+ BLI_strescape(name_esc, md->name, sizeof(name_esc));
+ return BLI_sprintfN("modifiers[\"%s\"].settings.effector_weights", name_esc);
+ }
+ }
+
+ /* check smoke modifier */
+ md = (ModifierData *)modifiers_findByType(ob, eModifierType_Smoke);
+ if (md) {
+ SmokeModifierData *smd = (SmokeModifierData *)md;
+ if (smd->domain->effector_weights == ew) {
+ char name_esc[sizeof(md->name) * 2];
+ BLI_strescape(name_esc, md->name, sizeof(name_esc));
+ return BLI_sprintfN("modifiers[\"%s\"].settings.effector_weights", name_esc);
+ }
}
- }
- /* check dynamic paint modifier */
- md = (ModifierData *)modifiers_findByType(ob, eModifierType_DynamicPaint);
- if (md) {
- DynamicPaintModifierData *pmd = (DynamicPaintModifierData *)md;
+ /* check dynamic paint modifier */
+ md = (ModifierData *)modifiers_findByType(ob, eModifierType_DynamicPaint);
+ if (md) {
+ DynamicPaintModifierData *pmd = (DynamicPaintModifierData *)md;
- if (pmd->canvas) {
- DynamicPaintSurface *surface = pmd->canvas->surfaces.first;
+ if (pmd->canvas) {
+ DynamicPaintSurface *surface = pmd->canvas->surfaces.first;
- for (; surface; surface = surface->next) {
- if (surface->effector_weights == ew) {
- char name_esc[sizeof(md->name) * 2];
- char name_esc_surface[sizeof(surface->name) * 2];
+ for (; surface; surface = surface->next) {
+ if (surface->effector_weights == ew) {
+ char name_esc[sizeof(md->name) * 2];
+ char name_esc_surface[sizeof(surface->name) * 2];
- BLI_strescape(name_esc, md->name, sizeof(name_esc));
- BLI_strescape(name_esc_surface, surface->name, sizeof(name_esc_surface));
- return BLI_sprintfN("modifiers[\"%s\"].canvas_settings.canvas_surfaces[\"%s\"]"
- ".effector_weights", name_esc, name_esc_surface);
+ BLI_strescape(name_esc, md->name, sizeof(name_esc));
+ BLI_strescape(name_esc_surface, surface->name, sizeof(name_esc_surface));
+ return BLI_sprintfN("modifiers[\"%s\"].canvas_settings.canvas_surfaces[\"%s\"]"
+ ".effector_weights", name_esc, name_esc_surface);
+ }
}
}
}
@@ -459,6 +741,9 @@ static EnumPropertyItem *rna_Effector_shape_itemf(bContext *UNUSED(C), PointerRN
{
Object *ob = NULL;
+ if (particle_id_check(ptr))
+ return empty_shape_items;
+
ob = (Object *)ptr->id.data;
if (ob->type == OB_CURVE) {
@@ -483,6 +768,140 @@ static EnumPropertyItem *rna_Effector_shape_itemf(bContext *UNUSED(C), PointerRN
#else
+/* ptcache.point_caches */
+static void rna_def_ptcache_point_caches(BlenderRNA *brna, PropertyRNA *cprop)
+{
+ StructRNA *srna;
+ PropertyRNA *prop;
+
+ /* FunctionRNA *func; */
+ /* PropertyRNA *parm; */
+
+ RNA_def_property_srna(cprop, "PointCaches");
+ srna = RNA_def_struct(brna, "PointCaches", NULL);
+ RNA_def_struct_sdna(srna, "PointCache");
+ RNA_def_struct_ui_text(srna, "Point Caches", "Collection of point caches");
+
+ prop = RNA_def_property(srna, "active_index", PROP_INT, PROP_UNSIGNED);
+ RNA_def_property_int_funcs(prop, "rna_Cache_active_point_cache_index_get",
+ "rna_Cache_active_point_cache_index_set",
+ "rna_Cache_active_point_cache_index_range");
+ RNA_def_property_ui_text(prop, "Active Point Cache Index", "");
+ RNA_def_property_update(prop, NC_OBJECT, "rna_Cache_change");
+}
+
+static void rna_def_pointcache(BlenderRNA *brna)
+{
+ StructRNA *srna;
+ PropertyRNA *prop;
+
+ static EnumPropertyItem point_cache_compress_items[] = {
+ {PTCACHE_COMPRESS_NO, "NO", 0, "No", "No compression"},
+ {PTCACHE_COMPRESS_LZO, "LIGHT", 0, "Light", "Fast but not so effective compression"},
+ {PTCACHE_COMPRESS_LZMA, "HEAVY", 0, "Heavy", "Effective but slow compression"},
+ {0, NULL, 0, NULL, NULL}
+ };
+
+ srna = RNA_def_struct(brna, "PointCache", NULL);
+ RNA_def_struct_ui_text(srna, "Point Cache", "Point cache for physics simulations");
+ RNA_def_struct_ui_icon(srna, ICON_PHYSICS);
+
+ prop = RNA_def_property(srna, "frame_start", PROP_INT, PROP_TIME);
+ RNA_def_property_int_sdna(prop, NULL, "startframe");
+ RNA_def_property_range(prop, -MAXFRAME, MAXFRAME);
+ RNA_def_property_ui_range(prop, 1, MAXFRAME, 1, 1);
+ RNA_def_property_ui_text(prop, "Start", "Frame on which the simulation starts");
+
+ prop = RNA_def_property(srna, "frame_end", PROP_INT, PROP_TIME);
+ RNA_def_property_int_sdna(prop, NULL, "endframe");
+ RNA_def_property_range(prop, 1, MAXFRAME);
+ RNA_def_property_ui_text(prop, "End", "Frame on which the simulation stops");
+
+ prop = RNA_def_property(srna, "frame_step", PROP_INT, PROP_NONE);
+ RNA_def_property_int_sdna(prop, NULL, "step");
+ RNA_def_property_range(prop, 1, 20);
+ RNA_def_property_int_funcs(prop, NULL, NULL, "rna_PointCache_frame_step_range");
+ RNA_def_property_ui_text(prop, "Cache Step", "Number of frames between cached frames");
+ RNA_def_property_update(prop, NC_OBJECT, "rna_Cache_change");
+
+ prop = RNA_def_property(srna, "index", PROP_INT, PROP_NONE);
+ RNA_def_property_int_sdna(prop, NULL, "index");
+ RNA_def_property_range(prop, -1, 100);
+ RNA_def_property_ui_text(prop, "Cache Index", "Index number of cache files");
+ RNA_def_property_update(prop, NC_OBJECT, "rna_Cache_idname_change");
+
+ prop = RNA_def_property(srna, "compression", PROP_ENUM, PROP_NONE);
+ RNA_def_property_enum_items(prop, point_cache_compress_items);
+ RNA_def_property_ui_text(prop, "Cache Compression", "Compression method to be used");
+
+ /* flags */
+ prop = RNA_def_property(srna, "is_baked", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "flag", PTCACHE_BAKED);
+ RNA_def_property_clear_flag(prop, PROP_EDITABLE);
+
+ prop = RNA_def_property(srna, "is_baking", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "flag", PTCACHE_BAKING);
+ RNA_def_property_clear_flag(prop, PROP_EDITABLE);
+
+ prop = RNA_def_property(srna, "use_disk_cache", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "flag", PTCACHE_DISK_CACHE);
+ RNA_def_property_ui_text(prop, "Disk Cache", "Save cache files to disk (.blend file must be saved first)");
+ RNA_def_property_update(prop, NC_OBJECT, "rna_Cache_toggle_disk_cache");
+
+ prop = RNA_def_property(srna, "is_outdated", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "flag", PTCACHE_OUTDATED);
+ RNA_def_property_clear_flag(prop, PROP_EDITABLE);
+ RNA_def_property_ui_text(prop, "Cache is outdated", "");
+
+ prop = RNA_def_property(srna, "is_frame_skip", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "flag", PTCACHE_FRAMES_SKIPPED);
+ RNA_def_property_clear_flag(prop, PROP_EDITABLE);
+
+ prop = RNA_def_property(srna, "name", PROP_STRING, PROP_NONE);
+ RNA_def_property_string_sdna(prop, NULL, "name");
+ RNA_def_property_ui_text(prop, "Name", "Cache name");
+ RNA_def_property_update(prop, NC_OBJECT, "rna_Cache_idname_change");
+ RNA_def_struct_name_property(srna, prop);
+
+ prop = RNA_def_property(srna, "filepath", PROP_STRING, PROP_DIRPATH);
+ RNA_def_property_string_sdna(prop, NULL, "path");
+ RNA_def_property_ui_text(prop, "File Path", "Cache file path");
+ RNA_def_property_update(prop, NC_OBJECT, "rna_Cache_idname_change");
+
+ /* removed, see PTCACHE_QUICK_CACHE */
+#if 0
+ prop = RNA_def_property(srna, "use_quick_cache", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "flag", PTCACHE_QUICK_CACHE);
+ RNA_def_property_ui_text(prop, "Quick Cache", "Update simulation with cache steps");
+ RNA_def_property_update(prop, NC_OBJECT, "rna_Cache_change");
+#endif
+
+ prop = RNA_def_property(srna, "info", PROP_STRING, PROP_NONE);
+ RNA_def_property_string_sdna(prop, NULL, "info");
+ RNA_def_property_clear_flag(prop, PROP_EDITABLE);
+ RNA_def_property_ui_text(prop, "Cache Info", "Info on current cache status");
+
+ prop = RNA_def_property(srna, "use_external", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "flag", PTCACHE_EXTERNAL);
+ RNA_def_property_ui_text(prop, "External", "Read cache from an external location");
+ RNA_def_property_update(prop, NC_OBJECT, "rna_Cache_idname_change");
+
+ prop = RNA_def_property(srna, "use_library_path", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_negative_sdna(prop, NULL, "flag", PTCACHE_IGNORE_LIBPATH);
+ RNA_def_property_ui_text(prop, "Library Path",
+ "Use this file's path for the disk cache when library linked into another file "
+ "(for local bakes per scene file, disable this option)");
+ RNA_def_property_update(prop, NC_OBJECT, "rna_Cache_idname_change");
+
+ prop = RNA_def_property(srna, "point_caches", PROP_COLLECTION, PROP_NONE);
+ RNA_def_property_collection_funcs(prop, "rna_Cache_list_begin", "rna_iterator_listbase_next",
+ "rna_iterator_listbase_end", "rna_iterator_listbase_get",
+ NULL, NULL, NULL, NULL);
+ RNA_def_property_struct_type(prop, "PointCache");
+ RNA_def_property_ui_text(prop, "Point Cache List", "Point cache list");
+ rna_def_ptcache_point_caches(brna, prop);
+}
+
static void rna_def_collision(BlenderRNA *brna)
{
StructRNA *srna;
@@ -1452,6 +1871,7 @@ static void rna_def_softbody(BlenderRNA *brna)
void RNA_def_object_force(BlenderRNA *brna)
{
+ rna_def_pointcache(brna);
rna_def_collision(brna);
rna_def_effector_weight(brna);
rna_def_field(brna);
diff --git a/source/blender/makesrna/intern/rna_particle.c b/source/blender/makesrna/intern/rna_particle.c
new file mode 100644
index 00000000000..362baed1e7c
--- /dev/null
+++ b/source/blender/makesrna/intern/rna_particle.c
@@ -0,0 +1,3573 @@
+/*
+ * ***** BEGIN GPL LICENSE BLOCK *****
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ * Contributor(s): Blender Foundation (2008).
+ *
+ * Adaptive time step
+ * Copyright 2011 AutoCRC
+ *
+ * ***** END GPL LICENSE BLOCK *****
+ */
+
+/** \file blender/makesrna/intern/rna_particle.c
+ * \ingroup RNA
+ */
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <limits.h>
+
+#include "DNA_material_types.h"
+#include "DNA_meshdata_types.h"
+#include "DNA_modifier_types.h"
+#include "DNA_cloth_types.h"
+#include "DNA_particle_types.h"
+#include "DNA_object_force.h"
+#include "DNA_object_types.h"
+#include "DNA_scene_types.h"
+#include "DNA_boid_types.h"
+#include "DNA_texture_types.h"
+
+#include "RNA_define.h"
+#include "RNA_enum_types.h"
+
+#include "BLT_translation.h"
+
+#include "rna_internal.h"
+
+#include "WM_types.h"
+#include "WM_api.h"
+
+#ifdef RNA_RUNTIME
+static EnumPropertyItem part_from_items[] = {
+ {PART_FROM_VERT, "VERT", 0, "Verts", ""},
+ {PART_FROM_FACE, "FACE", 0, "Faces", ""},
+ {PART_FROM_VOLUME, "VOLUME", 0, "Volume", ""},
+ {0, NULL, 0, NULL, NULL}
+};
+#endif
+
+#ifndef RNA_RUNTIME
+static EnumPropertyItem part_reactor_from_items[] = {
+ {PART_FROM_VERT, "VERT", 0, "Verts", ""},
+ {PART_FROM_FACE, "FACE", 0, "Faces", ""},
+ {PART_FROM_VOLUME, "VOLUME", 0, "Volume", ""},
+ {0, NULL, 0, NULL, NULL}
+};
+#endif
+
+static EnumPropertyItem part_dist_items[] = {
+ {PART_DISTR_JIT, "JIT", 0, "Jittered", ""},
+ {PART_DISTR_RAND, "RAND", 0, "Random", ""},
+ {PART_DISTR_GRID, "GRID", 0, "Grid", ""},
+ {0, NULL, 0, NULL, NULL}
+};
+
+#ifdef RNA_RUNTIME
+static EnumPropertyItem part_hair_dist_items[] = {
+ {PART_DISTR_JIT, "JIT", 0, "Jittered", ""},
+ {PART_DISTR_RAND, "RAND", 0, "Random", ""},
+ {0, NULL, 0, NULL, NULL}
+};
+#endif
+
+static EnumPropertyItem part_draw_as_items[] = {
+ {PART_DRAW_NOT, "NONE", 0, "None", ""},
+ {PART_DRAW_REND, "RENDER", 0, "Rendered", ""},
+ {PART_DRAW_DOT, "DOT", 0, "Point", ""},
+ {PART_DRAW_CIRC, "CIRC", 0, "Circle", ""},
+ {PART_DRAW_CROSS, "CROSS", 0, "Cross", ""},
+ {PART_DRAW_AXIS, "AXIS", 0, "Axis", ""},
+ {0, NULL, 0, NULL, NULL}
+};
+
+#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", ""},
+ {0, NULL, 0, NULL, NULL}
+};
+#endif
+
+static EnumPropertyItem part_ren_as_items[] = {
+ {PART_DRAW_NOT, "NONE", 0, "None", ""},
+ {PART_DRAW_HALO, "HALO", 0, "Halo", ""},
+ {PART_DRAW_LINE, "LINE", 0, "Line", ""},
+ {PART_DRAW_PATH, "PATH", 0, "Path", ""},
+ {PART_DRAW_OB, "OBJECT", 0, "Object", ""},
+ {PART_DRAW_GR, "GROUP", 0, "Group", ""},
+ {PART_DRAW_BB, "BILLBOARD", 0, "Billboard", ""},
+ {0, NULL, 0, NULL, NULL}
+};
+
+#ifdef RNA_RUNTIME
+static EnumPropertyItem part_hair_ren_as_items[] = {
+ {PART_DRAW_NOT, "NONE", 0, "None", ""},
+ {PART_DRAW_PATH, "PATH", 0, "Path", ""},
+ {PART_DRAW_OB, "OBJECT", 0, "Object", ""},
+ {PART_DRAW_GR, "GROUP", 0, "Group", ""},
+ {0, NULL, 0, NULL, NULL}
+};
+#endif
+
+#ifdef RNA_RUNTIME
+
+#include "BLI_math.h"
+
+#include "BKE_context.h"
+#include "BKE_cloth.h"
+#include "BKE_colortools.h"
+#include "BKE_deform.h"
+#include "BKE_depsgraph.h"
+#include "BKE_DerivedMesh.h"
+#include "BKE_cdderivedmesh.h"
+#include "BKE_effect.h"
+#include "BKE_material.h"
+#include "BKE_modifier.h"
+#include "BKE_particle.h"
+#include "BKE_pointcache.h"
+#include "BKE_texture.h"
+
+/* use for object space hair get/set */
+static void rna_ParticleHairKey_location_object_info(PointerRNA *ptr, ParticleSystemModifierData **psmd_pt,
+ ParticleData **pa_pt)
+{
+ HairKey *hkey = (HairKey *)ptr->data;
+ Object *ob = (Object *)ptr->id.data;
+ ModifierData *md;
+ ParticleSystemModifierData *psmd = NULL;
+ ParticleSystem *psys;
+ ParticleData *pa;
+ int i;
+
+ *psmd_pt = NULL;
+ *pa_pt = NULL;
+
+ /* given the pointer HairKey *hkey, we iterate over all particles in all
+ * particle systems in the object "ob" in order to find
+ * - the ParticleSystemData to which the HairKey (and hence the particle)
+ * belongs (will be stored in psmd_pt)
+ * - the ParticleData to which the HairKey belongs (will be stored in pa_pt)
+ *
+ * not a very efficient way of getting hair key location data,
+ * but it's the best we've got at the present
+ *
+ * IDEAS: include additional information in pointerRNA beforehand,
+ * for example a pointer to the ParticleStstemModifierData to which the
+ * hairkey belongs.
+ */
+
+ for (md = ob->modifiers.first; md; md = md->next) {
+ if (md->type == eModifierType_ParticleSystem) {
+ psmd = (ParticleSystemModifierData *) md;
+ if (psmd && psmd->dm_final && psmd->psys) {
+ psys = psmd->psys;
+ for (i = 0, pa = psys->particles; i < psys->totpart; i++, pa++) {
+ /* hairkeys are stored sequentially in memory, so we can
+ * find if it's the same particle by comparing pointers,
+ * without having to iterate over them all */
+ if ((hkey >= pa->hair) && (hkey < pa->hair + pa->totkey)) {
+ *psmd_pt = psmd;
+ *pa_pt = pa;
+ return;
+ }
+ }
+ }
+ }
+ }
+}
+
+static void rna_ParticleHairKey_location_object_get(PointerRNA *ptr, float *values)
+{
+ HairKey *hkey = (HairKey *)ptr->data;
+ Object *ob = (Object *)ptr->id.data;
+ ParticleSystemModifierData *psmd;
+ ParticleData *pa;
+
+ rna_ParticleHairKey_location_object_info(ptr, &psmd, &pa);
+
+ if (pa) {
+ DerivedMesh *hairdm = (psmd->psys->flag & PSYS_HAIR_DYNAMICS) ? psmd->psys->hair_out_dm : NULL;
+
+ if (hairdm) {
+ MVert *mvert = CDDM_get_vert(hairdm, pa->hair_index + (hkey - pa->hair));
+ copy_v3_v3(values, mvert->co);
+ }
+ else {
+ float hairmat[4][4];
+ psys_mat_hair_to_object(ob, psmd->dm_final, psmd->psys->part->from, pa, hairmat);
+ copy_v3_v3(values, hkey->co);
+ mul_m4_v3(hairmat, values);
+ }
+ }
+ else {
+ zero_v3(values);
+ }
+}
+
+static void rna_ParticleHairKey_location_object_set(PointerRNA *ptr, const float *values)
+{
+ HairKey *hkey = (HairKey *)ptr->data;
+ Object *ob = (Object *)ptr->id.data;
+ ParticleSystemModifierData *psmd;
+ ParticleData *pa;
+
+ rna_ParticleHairKey_location_object_info(ptr, &psmd, &pa);
+
+ if (pa) {
+ DerivedMesh *hairdm = (psmd->psys->flag & PSYS_HAIR_DYNAMICS) ? psmd->psys->hair_out_dm : NULL;
+
+ if (hairdm) {
+ MVert *mvert = CDDM_get_vert(hairdm, pa->hair_index + (hkey - pa->hair));
+ copy_v3_v3(mvert->co, values);
+ }
+ else {
+ float hairmat[4][4];
+ float imat[4][4];
+
+ psys_mat_hair_to_object(ob, psmd->dm_final, psmd->psys->part->from, pa, hairmat);
+ invert_m4_m4(imat, hairmat);
+ copy_v3_v3(hkey->co, values);
+ mul_m4_v3(imat, hkey->co);
+ }
+ }
+ else {
+ zero_v3(hkey->co);
+ }
+}
+
+static void rna_ParticleHairKey_co_object(HairKey *hairkey, Object *object, ParticleSystemModifierData *modifier, ParticleData *particle,
+ float n_co[3])
+{
+
+ DerivedMesh *hairdm = (modifier->psys->flag & PSYS_HAIR_DYNAMICS) ? modifier->psys->hair_out_dm : NULL;
+ if (particle) {
+ if (hairdm) {
+ MVert *mvert = CDDM_get_vert(hairdm, particle->hair_index + (hairkey - particle->hair));
+ copy_v3_v3(n_co, mvert->co);
+ }
+ else {
+ float hairmat[4][4];
+ psys_mat_hair_to_object(object, modifier->dm_final, modifier->psys->part->from, particle, hairmat);
+ copy_v3_v3(n_co, hairkey->co);
+ mul_m4_v3(hairmat, n_co);
+ }
+ }
+ else {
+ zero_v3(n_co);
+ }
+}
+
+static void rna_Particle_uv_on_emitter(ParticleData *particle, ReportList *reports,
+ ParticleSystemModifierData *modifier, float r_uv[2])
+{
+ /*psys_particle_on_emitter(psmd, part->from, pa->num, pa->num_dmcache, pa->fuv, pa->foffset, co, nor, 0, 0, sd.orco, 0);*/
+
+ /* get uvco & mcol */
+ int num = particle->num_dmcache;
+ int from = modifier->psys->part->from;
+
+ if (!CustomData_has_layer(&modifier->dm_final->loopData, CD_MLOOPUV)) {
+ BKE_report(reports, RPT_ERROR, "Mesh has no UV data");
+ return;
+ }
+ DM_ensure_tessface(modifier->dm_final); /* BMESH - UNTIL MODIFIER IS UPDATED FOR MPoly */
+
+ if (num == DMCACHE_NOTFOUND)
+ if (particle->num < modifier->dm_final->getNumTessFaces(modifier->dm_final))
+ num = particle->num;
+
+ /* get uvco */
+ if (r_uv && ELEM(from, PART_FROM_FACE, PART_FROM_VOLUME)) {
+
+ if (num != DMCACHE_NOTFOUND) {
+ MFace *mface;
+ MTFace *mtface;
+
+ mface = modifier->dm_final->getTessFaceData(modifier->dm_final, num, CD_MFACE);
+ mtface = (MTFace *)CustomData_get_layer_n(&modifier->dm_final->faceData, CD_MTFACE, 0);
+
+ if (mface && mtface) {
+ mtface += num;
+ psys_interpolate_uvs(mtface, mface->v4, particle->fuv, r_uv);
+ return;
+ }
+ }
+ }
+
+ r_uv[0] = 0.0f;
+ r_uv[1] = 0.0f;
+}
+
+static void rna_ParticleSystem_co_hair(ParticleSystem *particlesystem, Object *object,
+ int particle_no, int step, float n_co[3])
+{
+ ParticleSettings *part = NULL;
+ ParticleData *pars = NULL;
+ ParticleCacheKey *cache = NULL;
+ int totchild = 0;
+ int path_nbr = 0;
+ int totpart;
+ int max_k = 0;
+ int step_nbr = 0;
+
+ if (particlesystem == NULL)
+ return;
+
+ part = particlesystem->part;
+ pars = particlesystem->particles;
+
+ if (particlesystem->renderdata) {
+ step_nbr = part->ren_step;
+ totchild = particlesystem->totchild;
+ }
+ else {
+ step_nbr = part->draw_step;
+ totchild = (int)((float)particlesystem->totchild * (float)(part->disp) / 100.0f);
+ }
+
+ if (part == NULL || pars == NULL || !psys_check_enabled(object, particlesystem, particlesystem->renderdata != NULL))
+ return;
+
+ if (part->ren_as == PART_DRAW_OB || part->ren_as == PART_DRAW_GR || part->ren_as == PART_DRAW_NOT)
+ return;
+
+ /* can happen for disconnected/global hair */
+ if (part->type == PART_HAIR && !particlesystem->childcache)
+ totchild = 0;
+
+ totpart = particlesystem->totpart;
+
+ if (particle_no >= totpart + totchild)
+ return;
+
+ if (part->ren_as == PART_DRAW_PATH && particlesystem->pathcache)
+ path_nbr = 1 << step_nbr;
+ if (part->kink == PART_KINK_SPIRAL)
+ path_nbr += part->kink_extra_steps;
+
+ if (particle_no < totpart) {
+
+ if (path_nbr) {
+ cache = particlesystem->pathcache[particle_no];
+ max_k = (int)cache->segments;
+ }
+
+ }
+ else {
+
+ if (path_nbr) {
+ cache = particlesystem->childcache[particle_no - totpart];
+
+ if (cache->segments < 0)
+ max_k = 0;
+ else
+ max_k = (int)cache->segments;
+ }
+ }
+
+ /*strands key loop data stored in cache + step->co*/
+ if (path_nbr) {
+ if (step >= 0 && step <= path_nbr) {
+ if (step <= max_k) {
+ copy_v3_v3(n_co, (cache + step)->co);
+ mul_m4_v3(particlesystem->imat, n_co);
+ mul_m4_v3(object->obmat, n_co);
+ }
+ }
+ }
+
+}
+
+
+static EnumPropertyItem *rna_Particle_Material_itemf(bContext *C, PointerRNA *UNUSED(ptr),
+ PropertyRNA *UNUSED(prop), bool *r_free)
+{
+ Object *ob = CTX_data_pointer_get(C, "object").data;
+ Material *ma;
+ EnumPropertyItem *item = NULL;
+ EnumPropertyItem tmp = {0, "", 0, "", ""};
+ int totitem = 0;
+ int i;
+
+ if (ob && ob->totcol > 0) {
+ for (i = 1; i <= ob->totcol; i++) {
+ ma = give_current_material(ob, i);
+ tmp.value = i;
+ tmp.icon = ICON_MATERIAL_DATA;
+ if (ma) {
+ tmp.name = ma->id.name + 2;
+ tmp.identifier = tmp.name;
+ }
+ else {
+ tmp.name = "Default Material";
+ tmp.identifier = tmp.name;
+ }
+ RNA_enum_item_add(&item, &totitem, &tmp);
+ }
+ }
+ else {
+ tmp.value = 1;
+ tmp.icon = ICON_MATERIAL_DATA;
+ tmp.name = "Default Material";
+ tmp.identifier = tmp.name;
+ RNA_enum_item_add(&item, &totitem, &tmp);
+ }
+
+ RNA_enum_item_end(&item, &totitem);
+ *r_free = true;
+
+ return item;
+}
+
+/* return < 0 means invalid (no matching tessellated face could be found). */
+static int rna_ParticleSystem_tessfaceidx_on_emitter(ParticleSystem *particlesystem,
+ ParticleSystemModifierData *modifier, ParticleData *particle,
+ int particle_no, float (**r_fuv)[4])
+{
+ ParticleSettings *part = NULL;
+ int totpart;
+ int totchild = 0;
+ int totface;
+ int num = -1;
+
+ DM_ensure_tessface(modifier->dm_final); /* BMESH - UNTIL MODIFIER IS UPDATED FOR MPoly */
+ totface = modifier->dm_final->getNumTessFaces(modifier->dm_final);
+
+ /* 1. check that everything is ok & updated */
+ if (!particlesystem || !totface) {
+ return num;
+ }
+
+ part = particlesystem->part;
+
+ if (particlesystem->renderdata) {
+ totchild = particlesystem->totchild;
+ }
+ else {
+ totchild = (int)((float)particlesystem->totchild * (float)(part->disp) / 100.0f);
+ }
+
+ /* can happen for disconnected/global hair */
+ if (part->type == PART_HAIR && !particlesystem->childcache)
+ totchild = 0;
+
+ totpart = particlesystem->totpart;
+
+ if (particle_no >= totpart + totchild)
+ return num;
+
+ /* 2. get matching face index. */
+ if (particle_no < totpart) {
+ num = (ELEM(particle->num_dmcache, DMCACHE_ISCHILD, DMCACHE_NOTFOUND)) ? particle->num : particle->num_dmcache;
+
+ if (ELEM(part->from, PART_FROM_FACE, PART_FROM_VOLUME)) {
+ if (num != DMCACHE_NOTFOUND && num < totface) {
+ *r_fuv = &particle->fuv;
+ return num;
+ }
+ }
+ }
+ else {
+ ChildParticle *cpa = particlesystem->child + particle_no - totpart;
+ num = cpa->num;
+
+ if (part->childtype == PART_CHILD_FACES) {
+ if (ELEM(part->from, PART_FROM_FACE, PART_FROM_VOLUME)) {
+ if (num != DMCACHE_NOTFOUND && num < totface) {
+ *r_fuv = &cpa->fuv;
+ return num;
+ }
+ }
+ }
+ else {
+ ParticleData *parent = particlesystem->particles + cpa->parent;
+ num = parent->num_dmcache;
+
+ if (num == DMCACHE_NOTFOUND)
+ num = parent->num;
+
+ if (ELEM(part->from, PART_FROM_FACE, PART_FROM_VOLUME)) {
+ if (num != DMCACHE_NOTFOUND && num < totface) {
+ *r_fuv = &parent->fuv;
+ return num;
+ }
+ }
+ }
+ }
+
+ return -1;
+}
+
+static void rna_ParticleSystem_uv_on_emitter(ParticleSystem *particlesystem, ReportList *reports,
+ ParticleSystemModifierData *modifier, ParticleData *particle,
+ int particle_no, int uv_no, float r_uv[2])
+{
+ if (!CustomData_has_layer(&modifier->dm_final->loopData, CD_MLOOPUV)) {
+ BKE_report(reports, RPT_ERROR, "Mesh has no UV data");
+ zero_v2(r_uv);
+ return;
+ }
+
+ {
+ float (*fuv)[4];
+ /* Note all sanity checks are done in this helper func. */
+ const int num = rna_ParticleSystem_tessfaceidx_on_emitter(particlesystem, modifier, particle,
+ particle_no, &fuv);
+
+ if (num < 0) {
+ /* No matching face found. */
+ zero_v2(r_uv);
+ }
+ else {
+ MFace *mface = modifier->dm_final->getTessFaceData(modifier->dm_final, num, CD_MFACE);
+ MTFace *mtface = (MTFace *)CustomData_get_layer_n(&modifier->dm_final->faceData, CD_MTFACE, uv_no);
+
+ psys_interpolate_uvs(&mtface[num], mface->v4, *fuv, r_uv);
+ }
+ }
+}
+
+static void rna_ParticleSystem_mcol_on_emitter(ParticleSystem *particlesystem, ReportList *reports,
+ ParticleSystemModifierData *modifier, ParticleData *particle,
+ int particle_no, int vcol_no, float r_mcol[3])
+{
+ if (!CustomData_has_layer(&modifier->dm_final->loopData, CD_MLOOPCOL)) {
+ BKE_report(reports, RPT_ERROR, "Mesh has no VCol data");
+ zero_v3(r_mcol);
+ return;
+ }
+
+ {
+ float (*fuv)[4];
+ /* Note all sanity checks are done in this helper func. */
+ const int num = rna_ParticleSystem_tessfaceidx_on_emitter(particlesystem, modifier, particle,
+ particle_no, &fuv);
+
+ if (num < 0) {
+ /* No matching face found. */
+ zero_v3(r_mcol);
+ }
+ else {
+ MFace *mface = modifier->dm_final->getTessFaceData(modifier->dm_final, num, CD_MFACE);
+ MCol *mc = (MCol *)CustomData_get_layer_n(&modifier->dm_final->faceData, CD_MCOL, vcol_no);
+ MCol mcol;
+
+ psys_interpolate_mcol(&mc[num * 4], mface->v4, *fuv, &mcol);
+ r_mcol[0] = (float)mcol.b / 255.0f;
+ r_mcol[1] = (float)mcol.g / 255.0f;
+ r_mcol[2] = (float)mcol.r / 255.0f;
+ }
+ }
+}
+
+static void rna_ParticleSystem_set_resolution(ParticleSystem *particlesystem, Scene *scene, Object *object, int resolution)
+{
+ if (resolution == eModifierMode_Render) {
+ ParticleSystemModifierData *psmd = psys_get_modifier(object, particlesystem);
+ float mat[4][4];
+
+ unit_m4(mat);
+
+ psys_render_set(object, particlesystem, mat, mat, 1, 1, 0.f);
+ psmd->flag &= ~eParticleSystemFlag_psys_updated;
+ particle_system_update(scene, object, particlesystem, true);
+ }
+ else {
+ ParticleSystemModifierData *psmd = psys_get_modifier(object, particlesystem);
+
+ if (particlesystem->renderdata) {
+ psys_render_restore(object, particlesystem);
+ }
+
+ psmd->flag &= ~eParticleSystemFlag_psys_updated;
+ particle_system_update(scene, object, particlesystem, false);
+ }
+}
+
+static void particle_recalc(Main *UNUSED(bmain), Scene *UNUSED(scene), PointerRNA *ptr, short flag)
+{
+ if (ptr->type == &RNA_ParticleSystem) {
+ ParticleSystem *psys = (ParticleSystem *)ptr->data;
+
+ psys->recalc = flag;
+
+ DAG_id_tag_update(ptr->id.data, OB_RECALC_DATA);
+ }
+ else
+ DAG_id_tag_update(ptr->id.data, OB_RECALC_DATA | flag);
+
+ WM_main_add_notifier(NC_OBJECT | ND_PARTICLE | NA_EDITED, NULL);
+}
+static void rna_Particle_redo(Main *bmain, Scene *scene, PointerRNA *ptr)
+{
+ particle_recalc(bmain, scene, ptr, PSYS_RECALC_REDO);
+}
+
+static void rna_Particle_redo_dependency(Main *bmain, Scene *scene, PointerRNA *ptr)
+{
+ DAG_relations_tag_update(bmain);
+ rna_Particle_redo(bmain, scene, ptr);
+}
+
+static void rna_Particle_reset(Main *bmain, Scene *scene, PointerRNA *ptr)
+{
+ particle_recalc(bmain, scene, ptr, PSYS_RECALC_RESET);
+}
+
+static void rna_Particle_reset_dependency(Main *bmain, Scene *scene, PointerRNA *ptr)
+{
+ DAG_relations_tag_update(bmain);
+ rna_Particle_reset(bmain, scene, ptr);
+}
+
+static void rna_Particle_change_type(Main *bmain, Scene *scene, PointerRNA *ptr)
+{
+ particle_recalc(bmain, scene, ptr, PSYS_RECALC_RESET | PSYS_RECALC_TYPE);
+}
+
+static void rna_Particle_change_physics(Main *bmain, Scene *scene, PointerRNA *ptr)
+{
+ particle_recalc(bmain, scene, ptr, PSYS_RECALC_RESET | PSYS_RECALC_PHYS);
+}
+
+static void rna_Particle_redo_child(Main *bmain, Scene *scene, PointerRNA *ptr)
+{
+ particle_recalc(bmain, scene, ptr, PSYS_RECALC_CHILD);
+}
+
+static void rna_Particle_cloth_update(Main *UNUSED(bmain), Scene *UNUSED(scene), PointerRNA *ptr)
+{
+ Object *ob = (Object *)ptr->id.data;
+
+ DAG_id_tag_update(&ob->id, OB_RECALC_DATA);
+ WM_main_add_notifier(NC_OBJECT | ND_MODIFIER, ob);
+}
+
+
+static ParticleSystem *rna_particle_system_for_target(Object *ob, ParticleTarget *target)
+{
+ ParticleSystem *psys;
+ ParticleTarget *pt;
+
+ for (psys = ob->particlesystem.first; psys; psys = psys->next)
+ for (pt = psys->targets.first; pt; pt = pt->next)
+ if (pt == target)
+ return psys;
+
+ return NULL;
+}
+
+static void rna_Particle_target_reset(Main *bmain, Scene *UNUSED(scene), PointerRNA *ptr)
+{
+ if (ptr->type == &RNA_ParticleTarget) {
+ Object *ob = (Object *)ptr->id.data;
+ ParticleTarget *pt = (ParticleTarget *)ptr->data;
+ ParticleSystem *kpsys = NULL, *psys = rna_particle_system_for_target(ob, pt);
+
+ if (pt->ob == ob || pt->ob == NULL) {
+ kpsys = BLI_findlink(&ob->particlesystem, pt->psys - 1);
+
+ if (kpsys)
+ pt->flag |= PTARGET_VALID;
+ else
+ pt->flag &= ~PTARGET_VALID;
+ }
+ else {
+ if (pt->ob)
+ kpsys = BLI_findlink(&pt->ob->particlesystem, pt->psys - 1);
+
+ if (kpsys)
+ pt->flag |= PTARGET_VALID;
+ else
+ pt->flag &= ~PTARGET_VALID;
+ }
+
+ psys->recalc = PSYS_RECALC_RESET;
+
+ DAG_id_tag_update(&ob->id, OB_RECALC_DATA);
+ DAG_relations_tag_update(bmain);
+ }
+
+ WM_main_add_notifier(NC_OBJECT | ND_PARTICLE | NA_EDITED, NULL);
+}
+
+static void rna_Particle_target_redo(Main *UNUSED(bmain), Scene *UNUSED(scene), PointerRNA *ptr)
+{
+ if (ptr->type == &RNA_ParticleTarget) {
+ Object *ob = (Object *)ptr->id.data;
+ ParticleTarget *pt = (ParticleTarget *)ptr->data;
+ ParticleSystem *psys = rna_particle_system_for_target(ob, pt);
+
+ psys->recalc = PSYS_RECALC_REDO;
+
+ DAG_id_tag_update(&ob->id, OB_RECALC_DATA);
+ WM_main_add_notifier(NC_OBJECT | ND_PARTICLE | NA_EDITED, NULL);
+ }
+}
+
+static void rna_Particle_hair_dynamics(Main *bmain, Scene *scene, PointerRNA *ptr)
+{
+ Object *ob = (Object *)ptr->id.data;
+ ParticleSystem *psys = (ParticleSystem *)ptr->data;
+
+ if (psys && !psys->clmd) {
+ psys->clmd = (ClothModifierData *)modifier_new(eModifierType_Cloth);
+ psys->clmd->sim_parms->goalspring = 0.0f;
+ psys->clmd->sim_parms->flags |= CLOTH_SIMSETTINGS_FLAG_GOAL | CLOTH_SIMSETTINGS_FLAG_NO_SPRING_COMPRESS;
+ psys->clmd->coll_parms->flags &= ~CLOTH_COLLSETTINGS_FLAG_SELF;
+ rna_Particle_redo(bmain, scene, ptr);
+ }
+ else
+ WM_main_add_notifier(NC_OBJECT | ND_PARTICLE | NA_EDITED, NULL);
+
+ DAG_id_tag_update(&ob->id, OB_RECALC_DATA);
+}
+static PointerRNA rna_particle_settings_get(PointerRNA *ptr)
+{
+ ParticleSystem *psys = (ParticleSystem *)ptr->data;
+ ParticleSettings *part = psys->part;
+
+ return rna_pointer_inherit_refine(ptr, &RNA_ParticleSettings, part);
+}
+
+static void rna_particle_settings_set(PointerRNA *ptr, PointerRNA value)
+{
+ ParticleSystem *psys = (ParticleSystem *)ptr->data;
+ int old_type = 0;
+
+
+ if (psys->part) {
+ old_type = psys->part->type;
+ id_us_min(&psys->part->id);
+ }
+
+ psys->part = (ParticleSettings *)value.data;
+
+ if (psys->part) {
+ id_us_plus(&psys->part->id);
+ psys_check_boid_data(psys);
+ if (old_type != psys->part->type)
+ psys->recalc |= PSYS_RECALC_TYPE;
+ }
+}
+static void rna_Particle_abspathtime_update(Main *bmain, Scene *scene, PointerRNA *ptr)
+{
+ ParticleSettings *settings = (ParticleSettings *)ptr->data;
+ float delta = settings->end + settings->lifetime - settings->sta;
+ if (settings->draw & PART_ABS_PATH_TIME) {
+ settings->path_start = settings->sta + settings->path_start * delta;
+ settings->path_end = settings->sta + settings->path_end * delta;
+ }
+ else {
+ settings->path_start = (settings->path_start - settings->sta) / delta;
+ settings->path_end = (settings->path_end - settings->sta) / delta;
+ }
+ rna_Particle_redo(bmain, scene, ptr);
+}
+static void rna_PartSettings_start_set(struct PointerRNA *ptr, float value)
+{
+ ParticleSettings *settings = (ParticleSettings *)ptr->data;
+
+ /* check for clipping */
+ if (value > settings->end)
+ value = settings->end;
+
+ /*if (settings->type==PART_REACTOR && value < 1.0) */
+ /* value = 1.0; */
+ /*else */
+ if (value < MINAFRAMEF)
+ value = MINAFRAMEF;
+
+ settings->sta = value;
+}
+
+static void rna_PartSettings_end_set(struct PointerRNA *ptr, float value)
+{
+ ParticleSettings *settings = (ParticleSettings *)ptr->data;
+
+ /* check for clipping */
+ if (value < settings->sta)
+ value = settings->sta;
+
+ settings->end = value;
+}
+
+static void rna_PartSetings_timestep_set(struct PointerRNA *ptr, float value)
+{
+ ParticleSettings *settings = (ParticleSettings *)ptr->data;
+
+ settings->timetweak = value / 0.04f;
+}
+
+static float rna_PartSettings_timestep_get(struct PointerRNA *ptr)
+{
+ ParticleSettings *settings = (ParticleSettings *)ptr->data;
+
+ return settings->timetweak * 0.04f;
+}
+
+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;
+ settings->draw_line[0] = value;
+}
+
+static float rna_PartSetting_linelentail_get(struct PointerRNA *ptr)
+{
+ ParticleSettings *settings = (ParticleSettings *)ptr->data;
+ return settings->draw_line[0];
+}
+static void rna_PartSetting_pathstartend_range(PointerRNA *ptr, float *min, float *max,
+ float *UNUSED(softmin), float *UNUSED(softmax))
+{
+ ParticleSettings *settings = (ParticleSettings *)ptr->data;
+
+ if (settings->type == PART_HAIR) {
+ *min = 0.0f;
+ *max = (settings->draw & PART_ABS_PATH_TIME) ? 100.0f : 1.0f;
+ }
+ else {
+ *min = (settings->draw & PART_ABS_PATH_TIME) ? settings->sta : 0.0f;
+ *max = (settings->draw & PART_ABS_PATH_TIME) ? MAXFRAMEF : 1.0f;
+ }
+}
+static void rna_PartSetting_linelenhead_set(struct PointerRNA *ptr, float value)
+{
+ ParticleSettings *settings = (ParticleSettings *)ptr->data;
+ settings->draw_line[1] = value;
+}
+
+static float rna_PartSetting_linelenhead_get(struct PointerRNA *ptr)
+{
+ ParticleSettings *settings = (ParticleSettings *)ptr->data;
+ return settings->draw_line[1];
+}
+
+
+static int rna_PartSettings_is_fluid_get(PointerRNA *ptr)
+{
+ ParticleSettings *part = (ParticleSettings *)ptr->data;
+
+ return part->type == PART_FLUID;
+}
+
+static void rna_ParticleSettings_use_clump_curve_update(Main *bmain, Scene *scene, PointerRNA *ptr)
+{
+ ParticleSettings *part = ptr->data;
+
+ if (part->child_flag & PART_CHILD_USE_CLUMP_CURVE) {
+ if (!part->clumpcurve) {
+ BKE_particlesettings_clump_curve_init(part);
+ }
+ }
+
+ rna_Particle_redo_child(bmain, scene, ptr);
+}
+
+static void rna_ParticleSettings_use_roughness_curve_update(Main *bmain, Scene *scene, PointerRNA *ptr)
+{
+ ParticleSettings *part = ptr->data;
+
+ if (part->child_flag & PART_CHILD_USE_ROUGH_CURVE) {
+ if (!part->roughcurve) {
+ BKE_particlesettings_rough_curve_init(part);
+ }
+ }
+
+ rna_Particle_redo_child(bmain, scene, ptr);
+}
+
+static void rna_ParticleSystem_name_set(PointerRNA *ptr, const char *value)
+{
+ Object *ob = ptr->id.data;
+ ParticleSystem *part = (ParticleSystem *)ptr->data;
+
+ /* copy the new name into the name slot */
+ BLI_strncpy_utf8(part->name, value, sizeof(part->name));
+
+ BLI_uniquename(&ob->particlesystem, part, DATA_("ParticleSystem"), '.', offsetof(ParticleSystem, name),
+ sizeof(part->name));
+}
+
+static PointerRNA rna_ParticleSystem_active_particle_target_get(PointerRNA *ptr)
+{
+ ParticleSystem *psys = (ParticleSystem *)ptr->data;
+ ParticleTarget *pt = psys->targets.first;
+
+ for (; pt; pt = pt->next) {
+ if (pt->flag & PTARGET_CURRENT)
+ return rna_pointer_inherit_refine(ptr, &RNA_ParticleTarget, pt);
+ }
+ return rna_pointer_inherit_refine(ptr, &RNA_ParticleTarget, NULL);
+}
+static void rna_ParticleSystem_active_particle_target_index_range(PointerRNA *ptr, int *min, int *max,
+ int *UNUSED(softmin), int *UNUSED(softmax))
+{
+ ParticleSystem *psys = (ParticleSystem *)ptr->data;
+ *min = 0;
+ *max = max_ii(0, BLI_listbase_count(&psys->targets) - 1);
+}
+
+static int rna_ParticleSystem_active_particle_target_index_get(PointerRNA *ptr)
+{
+ ParticleSystem *psys = (ParticleSystem *)ptr->data;
+ ParticleTarget *pt = psys->targets.first;
+ int i = 0;
+
+ for (; pt; pt = pt->next, i++)
+ if (pt->flag & PTARGET_CURRENT)
+ return i;
+
+ return 0;
+}
+
+static void rna_ParticleSystem_active_particle_target_index_set(struct PointerRNA *ptr, int value)
+{
+ ParticleSystem *psys = (ParticleSystem *)ptr->data;
+ ParticleTarget *pt = psys->targets.first;
+ int i = 0;
+
+ for (; pt; pt = pt->next, i++) {
+ if (i == value)
+ pt->flag |= PTARGET_CURRENT;
+ else
+ pt->flag &= ~PTARGET_CURRENT;
+ }
+}
+
+static void rna_ParticleTarget_name_get(PointerRNA *ptr, char *str)
+{
+ ParticleTarget *pt = ptr->data;
+
+ if (pt->flag & PTARGET_VALID) {
+ ParticleSystem *psys = NULL;
+
+ if (pt->ob)
+ psys = BLI_findlink(&pt->ob->particlesystem, pt->psys - 1);
+ else {
+ Object *ob = (Object *) ptr->id.data;
+ psys = BLI_findlink(&ob->particlesystem, pt->psys - 1);
+ }
+
+ if (psys) {
+ if (pt->ob)
+ sprintf(str, "%s: %s", pt->ob->id.name + 2, psys->name);
+ else
+ strcpy(str, psys->name);
+ }
+ else
+ strcpy(str, "Invalid target!");
+ }
+ else
+ strcpy(str, "Invalid target!");
+}
+
+static int rna_ParticleTarget_name_length(PointerRNA *ptr)
+{
+ char tstr[MAX_ID_NAME + MAX_ID_NAME + 64];
+
+ rna_ParticleTarget_name_get(ptr, tstr);
+
+ return strlen(tstr);
+}
+
+static int particle_id_check(PointerRNA *ptr)
+{
+ ID *id = ptr->id.data;
+
+ return (GS(id->name) == ID_PA);
+}
+
+static char *rna_SPHFluidSettings_path(PointerRNA *ptr)
+{
+ SPHFluidSettings *fluid = (SPHFluidSettings *)ptr->data;
+
+ if (particle_id_check(ptr)) {
+ ParticleSettings *part = (ParticleSettings *)ptr->id.data;
+
+ if (part->fluid == fluid)
+ return BLI_sprintfN("fluid");
+ }
+ return NULL;
+}
+
+static int rna_ParticleSystem_multiple_caches_get(PointerRNA *ptr)
+{
+ ParticleSystem *psys = (ParticleSystem *)ptr->data;
+
+ return (psys->ptcaches.first != psys->ptcaches.last);
+}
+static int rna_ParticleSystem_editable_get(PointerRNA *ptr)
+{
+ ParticleSystem *psys = (ParticleSystem *)ptr->data;
+
+ return psys_check_edited(psys);
+}
+static int rna_ParticleSystem_edited_get(PointerRNA *ptr)
+{
+ ParticleSystem *psys = (ParticleSystem *)ptr->data;
+
+ if (psys->part && psys->part->type == PART_HAIR)
+ return (psys->flag & PSYS_EDITED || (psys->edit && psys->edit->edited));
+ else
+ return (psys->pointcache->edit && psys->pointcache->edit->edited);
+}
+static PointerRNA rna_ParticleDupliWeight_active_get(PointerRNA *ptr)
+{
+ ParticleSettings *part = (ParticleSettings *)ptr->id.data;
+ ParticleDupliWeight *dw = part->dupliweights.first;
+
+ for (; dw; dw = dw->next) {
+ if (dw->flag & PART_DUPLIW_CURRENT)
+ return rna_pointer_inherit_refine(ptr, &RNA_ParticleDupliWeight, dw);
+ }
+ return rna_pointer_inherit_refine(ptr, &RNA_ParticleTarget, NULL);
+}
+static void rna_ParticleDupliWeight_active_index_range(PointerRNA *ptr, int *min, int *max,
+ int *UNUSED(softmin), int *UNUSED(softmax))
+{
+ ParticleSettings *part = (ParticleSettings *)ptr->id.data;
+ *min = 0;
+ *max = max_ii(0, BLI_listbase_count(&part->dupliweights) - 1);
+}
+
+static int rna_ParticleDupliWeight_active_index_get(PointerRNA *ptr)
+{
+ ParticleSettings *part = (ParticleSettings *)ptr->id.data;
+ ParticleDupliWeight *dw = part->dupliweights.first;
+ int i = 0;
+
+ for (; dw; dw = dw->next, i++)
+ if (dw->flag & PART_DUPLIW_CURRENT)
+ return i;
+
+ return 0;
+}
+
+static void rna_ParticleDupliWeight_active_index_set(struct PointerRNA *ptr, int value)
+{
+ ParticleSettings *part = (ParticleSettings *)ptr->id.data;
+ ParticleDupliWeight *dw = part->dupliweights.first;
+ int i = 0;
+
+ for (; dw; dw = dw->next, i++) {
+ if (i == value)
+ dw->flag |= PART_DUPLIW_CURRENT;
+ else
+ dw->flag &= ~PART_DUPLIW_CURRENT;
+ }
+}
+
+static void rna_ParticleDupliWeight_name_get(PointerRNA *ptr, char *str)
+{
+ ParticleDupliWeight *dw = ptr->data;
+
+ if (dw->ob)
+ sprintf(str, "%s: %i", dw->ob->id.name + 2, dw->count);
+ else
+ strcpy(str, "No object");
+}
+
+static int rna_ParticleDupliWeight_name_length(PointerRNA *ptr)
+{
+ char tstr[MAX_ID_NAME + 64];
+
+ rna_ParticleDupliWeight_name_get(ptr, tstr);
+
+ return strlen(tstr);
+}
+
+static EnumPropertyItem *rna_Particle_from_itemf(bContext *UNUSED(C), PointerRNA *UNUSED(ptr),
+ PropertyRNA *UNUSED(prop), bool *UNUSED(r_free))
+{
+ /*if (part->type==PART_REACTOR) */
+ /* return part_reactor_from_items; */
+ /*else */
+ return part_from_items;
+}
+
+static EnumPropertyItem *rna_Particle_dist_itemf(bContext *UNUSED(C), PointerRNA *ptr,
+ PropertyRNA *UNUSED(prop), bool *UNUSED(r_free))
+{
+ ParticleSettings *part = ptr->id.data;
+
+ if (part->type == PART_HAIR)
+ return part_hair_dist_items;
+ else
+ return part_dist_items;
+}
+
+static EnumPropertyItem *rna_Particle_draw_as_itemf(bContext *UNUSED(C), PointerRNA *ptr,
+ PropertyRNA *UNUSED(prop), bool *UNUSED(r_free))
+{
+ ParticleSettings *part = ptr->id.data;
+
+ if (part->type == PART_HAIR)
+ return part_hair_draw_as_items;
+ else
+ return part_draw_as_items;
+}
+
+static EnumPropertyItem *rna_Particle_ren_as_itemf(bContext *UNUSED(C), PointerRNA *ptr,
+ PropertyRNA *UNUSED(prop), bool *UNUSED(r_free))
+{
+ ParticleSettings *part = ptr->id.data;
+
+ if (part->type == PART_HAIR)
+ return part_hair_ren_as_items;
+ else
+ return part_ren_as_items;
+}
+
+static PointerRNA rna_Particle_field1_get(PointerRNA *ptr)
+{
+ ParticleSettings *part = (ParticleSettings *)ptr->id.data;
+
+ /* weak */
+ if (!part->pd)
+ part->pd = object_add_collision_fields(0);
+
+ return rna_pointer_inherit_refine(ptr, &RNA_FieldSettings, part->pd);
+}
+
+static PointerRNA rna_Particle_field2_get(PointerRNA *ptr)
+{
+ ParticleSettings *part = (ParticleSettings *)ptr->id.data;
+
+ /* weak */
+ if (!part->pd2)
+ part->pd2 = object_add_collision_fields(0);
+
+ return rna_pointer_inherit_refine(ptr, &RNA_FieldSettings, part->pd2);
+}
+
+static void psys_vg_name_get__internal(PointerRNA *ptr, char *value, int index)
+{
+ Object *ob = ptr->id.data;
+ ParticleSystem *psys = (ParticleSystem *)ptr->data;
+
+ if (psys->vgroup[index] > 0) {
+ bDeformGroup *defGroup = BLI_findlink(&ob->defbase, psys->vgroup[index] - 1);
+
+ if (defGroup) {
+ strcpy(value, defGroup->name);
+ return;
+ }
+ }
+
+ value[0] = '\0';
+}
+static int psys_vg_name_len__internal(PointerRNA *ptr, int index)
+{
+ Object *ob = ptr->id.data;
+ ParticleSystem *psys = (ParticleSystem *)ptr->data;
+
+ if (psys->vgroup[index] > 0) {
+ bDeformGroup *defGroup = BLI_findlink(&ob->defbase, psys->vgroup[index] - 1);
+
+ if (defGroup) {
+ return strlen(defGroup->name);
+ }
+ }
+ return 0;
+}
+static void psys_vg_name_set__internal(PointerRNA *ptr, const char *value, int index)
+{
+ Object *ob = ptr->id.data;
+ ParticleSystem *psys = (ParticleSystem *)ptr->data;
+
+ if (value[0] == '\0') {
+ psys->vgroup[index] = 0;
+ }
+ else {
+ int defgrp_index = defgroup_name_index(ob, value);
+
+ if (defgrp_index == -1)
+ return;
+
+ psys->vgroup[index] = defgrp_index + 1;
+ }
+}
+
+static char *rna_ParticleSystem_path(PointerRNA *ptr)
+{
+ ParticleSystem *psys = (ParticleSystem *)ptr->data;
+ char name_esc[sizeof(psys->name) * 2];
+
+ BLI_strescape(name_esc, psys->name, sizeof(name_esc));
+ return BLI_sprintfN("particle_systems[\"%s\"]", name_esc);
+}
+
+static void rna_ParticleSettings_mtex_begin(CollectionPropertyIterator *iter, PointerRNA *ptr)
+{
+ ParticleSettings *part = (ParticleSettings *)ptr->data;
+ rna_iterator_array_begin(iter, (void *)part->mtex, sizeof(MTex *), MAX_MTEX, 0, NULL);
+}
+
+static PointerRNA rna_ParticleSettings_active_texture_get(PointerRNA *ptr)
+{
+ ParticleSettings *part = (ParticleSettings *)ptr->data;
+ Tex *tex;
+
+ tex = give_current_particle_texture(part);
+ return rna_pointer_inherit_refine(ptr, &RNA_Texture, tex);
+}
+
+static void rna_ParticleSettings_active_texture_set(PointerRNA *ptr, PointerRNA value)
+{
+ ParticleSettings *part = (ParticleSettings *)ptr->data;
+
+ set_current_particle_texture(part, value.data);
+}
+
+/* irritating string functions for each index :/ */
+static void rna_ParticleVGroup_name_get_0(PointerRNA *ptr, char *value) { psys_vg_name_get__internal(ptr, value, 0); }
+static void rna_ParticleVGroup_name_get_1(PointerRNA *ptr, char *value) { psys_vg_name_get__internal(ptr, value, 1); }
+static void rna_ParticleVGroup_name_get_2(PointerRNA *ptr, char *value) { psys_vg_name_get__internal(ptr, value, 2); }
+static void rna_ParticleVGroup_name_get_3(PointerRNA *ptr, char *value) { psys_vg_name_get__internal(ptr, value, 3); }
+static void rna_ParticleVGroup_name_get_4(PointerRNA *ptr, char *value) { psys_vg_name_get__internal(ptr, value, 4); }
+static void rna_ParticleVGroup_name_get_5(PointerRNA *ptr, char *value) { psys_vg_name_get__internal(ptr, value, 5); }
+static void rna_ParticleVGroup_name_get_6(PointerRNA *ptr, char *value) { psys_vg_name_get__internal(ptr, value, 6); }
+static void rna_ParticleVGroup_name_get_7(PointerRNA *ptr, char *value) { psys_vg_name_get__internal(ptr, value, 7); }
+static void rna_ParticleVGroup_name_get_8(PointerRNA *ptr, char *value) { psys_vg_name_get__internal(ptr, value, 8); }
+static void rna_ParticleVGroup_name_get_9(PointerRNA *ptr, char *value) { psys_vg_name_get__internal(ptr, value, 9); }
+static void rna_ParticleVGroup_name_get_10(PointerRNA *ptr, char *value) { psys_vg_name_get__internal(ptr, value, 10); }
+static void rna_ParticleVGroup_name_get_11(PointerRNA *ptr, char *value) { psys_vg_name_get__internal(ptr, value, 11); }
+
+static int rna_ParticleVGroup_name_len_0(PointerRNA *ptr) { return psys_vg_name_len__internal(ptr, 0); }
+static int rna_ParticleVGroup_name_len_1(PointerRNA *ptr) { return psys_vg_name_len__internal(ptr, 1); }
+static int rna_ParticleVGroup_name_len_2(PointerRNA *ptr) { return psys_vg_name_len__internal(ptr, 2); }
+static int rna_ParticleVGroup_name_len_3(PointerRNA *ptr) { return psys_vg_name_len__internal(ptr, 3); }
+static int rna_ParticleVGroup_name_len_4(PointerRNA *ptr) { return psys_vg_name_len__internal(ptr, 4); }
+static int rna_ParticleVGroup_name_len_5(PointerRNA *ptr) { return psys_vg_name_len__internal(ptr, 5); }
+static int rna_ParticleVGroup_name_len_6(PointerRNA *ptr) { return psys_vg_name_len__internal(ptr, 6); }
+static int rna_ParticleVGroup_name_len_7(PointerRNA *ptr) { return psys_vg_name_len__internal(ptr, 7); }
+static int rna_ParticleVGroup_name_len_8(PointerRNA *ptr) { return psys_vg_name_len__internal(ptr, 8); }
+static int rna_ParticleVGroup_name_len_9(PointerRNA *ptr) { return psys_vg_name_len__internal(ptr, 9); }
+static int rna_ParticleVGroup_name_len_10(PointerRNA *ptr) { return psys_vg_name_len__internal(ptr, 10); }
+static int rna_ParticleVGroup_name_len_11(PointerRNA *ptr) { return psys_vg_name_len__internal(ptr, 11); }
+
+static void rna_ParticleVGroup_name_set_0(PointerRNA *ptr, const char *value) { psys_vg_name_set__internal(ptr, value, 0); }
+static void rna_ParticleVGroup_name_set_1(PointerRNA *ptr, const char *value) { psys_vg_name_set__internal(ptr, value, 1); }
+static void rna_ParticleVGroup_name_set_2(PointerRNA *ptr, const char *value) { psys_vg_name_set__internal(ptr, value, 2); }
+static void rna_ParticleVGroup_name_set_3(PointerRNA *ptr, const char *value) { psys_vg_name_set__internal(ptr, value, 3); }
+static void rna_ParticleVGroup_name_set_4(PointerRNA *ptr, const char *value) { psys_vg_name_set__internal(ptr, value, 4); }
+static void rna_ParticleVGroup_name_set_5(PointerRNA *ptr, const char *value) { psys_vg_name_set__internal(ptr, value, 5); }
+static void rna_ParticleVGroup_name_set_6(PointerRNA *ptr, const char *value) { psys_vg_name_set__internal(ptr, value, 6); }
+static void rna_ParticleVGroup_name_set_7(PointerRNA *ptr, const char *value) { psys_vg_name_set__internal(ptr, value, 7); }
+static void rna_ParticleVGroup_name_set_8(PointerRNA *ptr, const char *value) { psys_vg_name_set__internal(ptr, value, 8); }
+static void rna_ParticleVGroup_name_set_9(PointerRNA *ptr, const char *value) { psys_vg_name_set__internal(ptr, value, 9); }
+static void rna_ParticleVGroup_name_set_10(PointerRNA *ptr, const char *value) { psys_vg_name_set__internal(ptr, value, 10); }
+static void rna_ParticleVGroup_name_set_11(PointerRNA *ptr, const char *value) { psys_vg_name_set__internal(ptr, value, 11); }
+
+
+#else
+
+static void rna_def_particle_hair_key(BlenderRNA *brna)
+{
+ StructRNA *srna;
+ PropertyRNA *prop;
+
+ FunctionRNA *func;
+ PropertyRNA *parm;
+
+ srna = RNA_def_struct(brna, "ParticleHairKey", NULL);
+ RNA_def_struct_sdna(srna, "HairKey");
+ RNA_def_struct_ui_text(srna, "Particle Hair Key", "Particle key for hair particle system");
+
+ prop = RNA_def_property(srna, "time", PROP_FLOAT, PROP_UNSIGNED);
+ RNA_def_property_ui_text(prop, "Time", "Relative time of key over hair length");
+
+ prop = RNA_def_property(srna, "weight", PROP_FLOAT, PROP_UNSIGNED);
+ RNA_def_property_range(prop, 0.0, 1.0);
+ RNA_def_property_ui_text(prop, "Weight", "Weight for cloth simulation");
+
+ prop = RNA_def_property(srna, "co", PROP_FLOAT, PROP_TRANSLATION);
+ RNA_def_property_array(prop, 3);
+ RNA_def_property_ui_text(prop, "Location (Object Space)", "Location of the hair key in object space");
+ RNA_def_property_float_funcs(prop, "rna_ParticleHairKey_location_object_get",
+ "rna_ParticleHairKey_location_object_set", NULL);
+
+ prop = RNA_def_property(srna, "co_local", PROP_FLOAT, PROP_TRANSLATION);
+ RNA_def_property_float_sdna(prop, NULL, "co");
+ RNA_def_property_ui_text(prop, "Location",
+ "Location of the hair key in its local coordinate system, "
+ "relative to the emitting face");
+
+ /* Aided co func */
+ func = RNA_def_function(srna, "co_object", "rna_ParticleHairKey_co_object");
+ RNA_def_function_ui_description(func, "Obtain hairkey location with particle and modifier data");
+ parm = RNA_def_pointer(func, "object", "Object", "", "Object");
+ RNA_def_parameter_flags(parm, PROP_NEVER_NULL, PARM_REQUIRED);
+ parm = RNA_def_pointer(func, "modifier", "ParticleSystemModifier", "", "Particle modifier");
+ RNA_def_parameter_flags(parm, PROP_NEVER_NULL, PARM_REQUIRED);
+ parm = RNA_def_pointer(func, "particle", "Particle", "", "hair particle");
+ RNA_def_parameter_flags(parm, PROP_NEVER_NULL, PARM_REQUIRED);
+ parm = RNA_def_float_vector(func, "co", 3, NULL, -FLT_MAX, FLT_MAX, "Co",
+ "Exported hairkey location", -1e4, 1e4);
+ RNA_def_parameter_flags(parm, PROP_THICK_WRAP, 0);
+ RNA_def_function_output(func, parm);
+}
+
+static void rna_def_particle_key(BlenderRNA *brna)
+{
+ StructRNA *srna;
+ PropertyRNA *prop;
+
+ srna = RNA_def_struct(brna, "ParticleKey", NULL);
+ RNA_def_struct_ui_text(srna, "Particle Key", "Key location for a particle over time");
+
+ prop = RNA_def_property(srna, "location", PROP_FLOAT, PROP_TRANSLATION);
+ RNA_def_property_float_sdna(prop, NULL, "co");
+ RNA_def_property_ui_text(prop, "Location", "Key location");
+
+ prop = RNA_def_property(srna, "velocity", PROP_FLOAT, PROP_VELOCITY);
+ RNA_def_property_float_sdna(prop, NULL, "vel");
+ RNA_def_property_ui_text(prop, "Velocity", "Key velocity");
+
+ prop = RNA_def_property(srna, "rotation", PROP_FLOAT, PROP_QUATERNION);
+ RNA_def_property_float_sdna(prop, NULL, "rot");
+ RNA_def_property_ui_text(prop, "Rotation", "Key rotation quaternion");
+
+ prop = RNA_def_property(srna, "angular_velocity", PROP_FLOAT, PROP_VELOCITY);
+ RNA_def_property_float_sdna(prop, NULL, "ave");
+ RNA_def_property_ui_text(prop, "Angular Velocity", "Key angular velocity");
+
+ prop = RNA_def_property(srna, "time", PROP_FLOAT, PROP_UNSIGNED);
+ RNA_def_property_ui_text(prop, "Time", "Time of key over the simulation");
+}
+
+static void rna_def_child_particle(BlenderRNA *brna)
+{
+ StructRNA *srna;
+ /*PropertyRNA *prop; */
+
+ srna = RNA_def_struct(brna, "ChildParticle", NULL);
+ RNA_def_struct_ui_text(srna, "Child Particle",
+ "Child particle interpolated from simulated or edited particles");
+
+/* int num, parent; *//* num is face index on the final derived mesh */
+
+/* int pa[4]; *//* nearest particles to the child, used for the interpolation */
+/* float w[4]; *//* interpolation weights for the above particles */
+/* float fuv[4], foffset; *//* face vertex weights and offset */
+/* float rand[3]; */
+}
+
+static void rna_def_particle(BlenderRNA *brna)
+{
+ StructRNA *srna;
+ PropertyRNA *prop;
+
+ FunctionRNA *func;
+ PropertyRNA *parm;
+
+ static EnumPropertyItem alive_items[] = {
+ /*{PARS_KILLED, "KILLED", 0, "Killed", ""}, */
+ {PARS_DEAD, "DEAD", 0, "Dead", ""},
+ {PARS_UNBORN, "UNBORN", 0, "Unborn", ""},
+ {PARS_ALIVE, "ALIVE", 0, "Alive", ""},
+ {PARS_DYING, "DYING", 0, "Dying", ""},
+ {0, NULL, 0, NULL, NULL}
+ };
+
+ srna = RNA_def_struct(brna, "Particle", NULL);
+ RNA_def_struct_sdna(srna, "ParticleData");
+ RNA_def_struct_ui_text(srna, "Particle", "Particle in a particle system");
+
+ /* Particle State & Previous State */
+ prop = RNA_def_property(srna, "location", PROP_FLOAT, PROP_TRANSLATION);
+ RNA_def_property_float_sdna(prop, NULL, "state.co");
+ RNA_def_property_ui_text(prop, "Particle Location", "");
+
+ prop = RNA_def_property(srna, "velocity", PROP_FLOAT, PROP_VELOCITY);
+ RNA_def_property_float_sdna(prop, NULL, "state.vel");
+ RNA_def_property_ui_text(prop, "Particle Velocity", "");
+
+ prop = RNA_def_property(srna, "angular_velocity", PROP_FLOAT, PROP_VELOCITY);
+ RNA_def_property_float_sdna(prop, NULL, "state.ave");
+ RNA_def_property_ui_text(prop, "Angular Velocity", "");
+
+ prop = RNA_def_property(srna, "rotation", PROP_FLOAT, PROP_QUATERNION);
+ RNA_def_property_float_sdna(prop, NULL, "state.rot");
+ RNA_def_property_ui_text(prop, "Rotation", "");
+
+ prop = RNA_def_property(srna, "prev_location", PROP_FLOAT, PROP_TRANSLATION);
+ RNA_def_property_float_sdna(prop, NULL, "prev_state.co");
+ RNA_def_property_ui_text(prop, "Previous Particle Location", "");
+
+ prop = RNA_def_property(srna, "prev_velocity", PROP_FLOAT, PROP_VELOCITY);
+ RNA_def_property_float_sdna(prop, NULL, "prev_state.vel");
+ RNA_def_property_ui_text(prop, "Previous Particle Velocity", "");
+
+ prop = RNA_def_property(srna, "prev_angular_velocity", PROP_FLOAT, PROP_VELOCITY);
+ RNA_def_property_float_sdna(prop, NULL, "prev_state.ave");
+ RNA_def_property_ui_text(prop, "Previous Angular Velocity", "");
+
+ prop = RNA_def_property(srna, "prev_rotation", PROP_FLOAT, PROP_QUATERNION);
+ RNA_def_property_float_sdna(prop, NULL, "prev_state.rot");
+ RNA_def_property_ui_text(prop, "Previous Rotation", "");
+
+ /* Hair & Keyed Keys */
+
+ prop = RNA_def_property(srna, "hair_keys", PROP_COLLECTION, PROP_NONE);
+ RNA_def_property_collection_sdna(prop, NULL, "hair", "totkey");
+ RNA_def_property_struct_type(prop, "ParticleHairKey");
+ RNA_def_property_ui_text(prop, "Hair", "");
+
+ prop = RNA_def_property(srna, "particle_keys", PROP_COLLECTION, PROP_NONE);
+ RNA_def_property_collection_sdna(prop, NULL, "keys", "totkey");
+ RNA_def_property_struct_type(prop, "ParticleKey");
+ RNA_def_property_ui_text(prop, "Keyed States", "");
+/* */
+/* float fuv[4], foffset; *//* coordinates on face/edge number "num" and depth along*/
+/* *//* face normal for volume emission */
+
+ prop = RNA_def_property(srna, "birth_time", PROP_FLOAT, PROP_TIME);
+ RNA_def_property_float_sdna(prop, NULL, "time");
+/* RNA_def_property_range(prop, lowerLimitf, upperLimitf); */
+ RNA_def_property_ui_text(prop, "Birth Time", "");
+
+ prop = RNA_def_property(srna, "lifetime", PROP_FLOAT, PROP_TIME);
+/* RNA_def_property_range(prop, lowerLimitf, upperLimitf); */
+ RNA_def_property_ui_text(prop, "Lifetime", "");
+
+ prop = RNA_def_property(srna, "die_time", PROP_FLOAT, PROP_TIME);
+ RNA_def_property_float_sdna(prop, NULL, "dietime");
+/* RNA_def_property_range(prop, lowerLimitf, upperLimitf); */
+ RNA_def_property_ui_text(prop, "Die Time", "");
+
+ prop = RNA_def_property(srna, "size", PROP_FLOAT, PROP_NONE);
+/* RNA_def_property_range(prop, lowerLimitf, upperLimitf); */
+ RNA_def_property_ui_text(prop, "Size", "");
+
+/* */
+/* int num; *//* index to vert/edge/face */
+/* int num_dmcache; *//* index to derived mesh data (face) to avoid slow lookups */
+/* int pad; */
+/* */
+/* int totkey; */
+
+ /* flag */
+ prop = RNA_def_property(srna, "is_exist", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_negative_sdna(prop, NULL, "flag", PARS_UNEXIST);
+ RNA_def_property_clear_flag(prop, PROP_EDITABLE);
+ RNA_def_property_ui_text(prop, "Exists", "");
+
+ prop = RNA_def_property(srna, "is_visible", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_negative_sdna(prop, NULL, "flag", PARS_NO_DISP);
+ RNA_def_property_clear_flag(prop, PROP_EDITABLE);
+ RNA_def_property_ui_text(prop, "Visible", "");
+
+ prop = RNA_def_property(srna, "alive_state", PROP_ENUM, PROP_NONE);
+ RNA_def_property_enum_sdna(prop, NULL, "alive");
+ RNA_def_property_enum_items(prop, alive_items);
+ RNA_def_property_ui_text(prop, "Alive State", "");
+
+/* short rt2; */
+
+/* UVs */
+ func = RNA_def_function(srna, "uv_on_emitter", "rna_Particle_uv_on_emitter");
+ RNA_def_function_ui_description(func, "Obtain uv for particle on derived mesh");
+ RNA_def_function_flag(func, FUNC_USE_REPORTS);
+ parm = RNA_def_pointer(func, "modifier", "ParticleSystemModifier", "", "Particle modifier");
+ RNA_def_parameter_flags(parm, PROP_NEVER_NULL, PARM_REQUIRED);
+ parm = RNA_def_property(func, "uv", PROP_FLOAT, PROP_COORDS);
+ RNA_def_property_array(parm, 2);
+ RNA_def_parameter_flags(parm, PROP_THICK_WRAP, 0);
+ RNA_def_function_output(func, parm);
+}
+
+static void rna_def_particle_dupliweight(BlenderRNA *brna)
+{
+ StructRNA *srna;
+ PropertyRNA *prop;
+
+ srna = RNA_def_struct(brna, "ParticleDupliWeight", NULL);
+ RNA_def_struct_ui_text(srna, "Particle Dupliobject Weight", "Weight of a particle dupliobject in a group");
+ RNA_def_struct_sdna(srna, "ParticleDupliWeight");
+
+ prop = RNA_def_property(srna, "name", PROP_STRING, PROP_NONE);
+ RNA_def_property_string_funcs(prop, "rna_ParticleDupliWeight_name_get",
+ "rna_ParticleDupliWeight_name_length", NULL);
+ RNA_def_property_ui_text(prop, "Name", "Particle dupliobject name");
+ RNA_def_property_clear_flag(prop, PROP_EDITABLE);
+ RNA_def_struct_name_property(srna, prop);
+
+ prop = RNA_def_property(srna, "count", PROP_INT, PROP_UNSIGNED);
+ RNA_def_property_range(prop, 0, SHRT_MAX);
+ RNA_def_property_ui_text(prop, "Count",
+ "The number of times this object is repeated with respect to other objects");
+ RNA_def_property_update(prop, 0, "rna_Particle_redo");
+}
+
+static void rna_def_fluid_settings(BlenderRNA *brna)
+{
+ StructRNA *srna;
+ PropertyRNA *prop;
+
+ static EnumPropertyItem sph_solver_items[] = {
+ {SPH_SOLVER_DDR, "DDR", 0, "Double-Density", "An artistic solver with strong surface tension effects (original)"},
+ {SPH_SOLVER_CLASSICAL, "CLASSICAL", 0, "Classical", "A more physically-accurate solver"},
+ {0, NULL, 0, NULL, NULL}
+ };
+
+ srna = RNA_def_struct(brna, "SPHFluidSettings", NULL);
+ RNA_def_struct_path_func(srna, "rna_SPHFluidSettings_path");
+ RNA_def_struct_ui_text(srna, "SPH Fluid Settings", "Settings for particle fluids physics");
+
+ /* Fluid settings */
+ prop = RNA_def_property(srna, "solver", PROP_ENUM, PROP_NONE);
+ RNA_def_property_enum_sdna(prop, NULL, "solver");
+ RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
+ RNA_def_property_enum_items(prop, sph_solver_items);
+ RNA_def_property_ui_text(prop, "SPH Solver", "The code used to calculate internal forces on particles");
+ RNA_def_property_update(prop, 0, "rna_Particle_reset");
+
+ prop = RNA_def_property(srna, "spring_force", PROP_FLOAT, PROP_NONE);
+ RNA_def_property_float_sdna(prop, NULL, "spring_k");
+ RNA_def_property_range(prop, 0.0f, 100.0f);
+ RNA_def_property_ui_range(prop, 0.0f, 10.0f, 1, 3);
+ RNA_def_property_ui_text(prop, "Spring Force", "Spring force");
+ RNA_def_property_update(prop, 0, "rna_Particle_reset");
+
+ prop = RNA_def_property(srna, "fluid_radius", PROP_FLOAT, PROP_NONE);
+ RNA_def_property_float_sdna(prop, NULL, "radius");
+ RNA_def_property_range(prop, 0.0f, 20.0f);
+ RNA_def_property_ui_range(prop, 0.0f, 2.0f, 1, 3);
+ RNA_def_property_ui_text(prop, "Interaction Radius", "Fluid interaction radius");
+ RNA_def_property_update(prop, 0, "rna_Particle_reset");
+
+ prop = RNA_def_property(srna, "rest_length", PROP_FLOAT, PROP_NONE);
+ RNA_def_property_range(prop, 0.0f, 2.0f);
+ RNA_def_property_ui_text(prop, "Rest Length", "Spring rest length (factor of particle radius)");
+ RNA_def_property_update(prop, 0, "rna_Particle_reset");
+
+ prop = RNA_def_property(srna, "use_viscoelastic_springs", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "flag", SPH_VISCOELASTIC_SPRINGS);
+ RNA_def_property_ui_text(prop, "Viscoelastic Springs", "Use viscoelastic springs instead of Hooke's springs");
+ RNA_def_property_update(prop, 0, "rna_Particle_reset");
+
+ prop = RNA_def_property(srna, "use_initial_rest_length", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "flag", SPH_CURRENT_REST_LENGTH);
+ RNA_def_property_ui_text(prop, "Initial Rest Length",
+ "Use the initial length as spring rest length instead of 2 * particle size");
+ RNA_def_property_update(prop, 0, "rna_Particle_reset");
+
+ prop = RNA_def_property(srna, "plasticity", PROP_FLOAT, PROP_NONE);
+ RNA_def_property_float_sdna(prop, NULL, "plasticity_constant");
+ RNA_def_property_range(prop, 0.0f, 100.0f);
+ RNA_def_property_ui_text(prop, "Plasticity",
+ "How much the spring rest length can change after the elastic limit is crossed");
+ RNA_def_property_update(prop, 0, "rna_Particle_reset");
+
+ prop = RNA_def_property(srna, "yield_ratio", PROP_FLOAT, PROP_NONE);
+ RNA_def_property_float_sdna(prop, NULL, "yield_ratio");
+ RNA_def_property_range(prop, 0.0f, 1.0f);
+ RNA_def_property_ui_text(prop, "Elastic Limit",
+ "How much the spring has to be stretched/compressed in order to change it's rest length");
+ RNA_def_property_update(prop, 0, "rna_Particle_reset");
+
+ prop = RNA_def_property(srna, "spring_frames", PROP_INT, PROP_NONE);
+ RNA_def_property_range(prop, 0.0f, 100.0f);
+ RNA_def_property_ui_text(prop, "Spring Frames",
+ "Create springs for this number of frames since particles birth (0 is always)");
+ RNA_def_property_update(prop, 0, "rna_Particle_reset");
+
+ /* Viscosity */
+ prop = RNA_def_property(srna, "linear_viscosity", PROP_FLOAT, PROP_NONE);
+ RNA_def_property_float_sdna(prop, NULL, "viscosity_omega");
+ RNA_def_property_range(prop, 0.0f, 100.0f);
+ RNA_def_property_ui_range(prop, 0.0f, 10.0f, 1, 3);
+ RNA_def_property_ui_text(prop, "Viscosity", "Linear viscosity");
+ RNA_def_property_update(prop, 0, "rna_Particle_reset");
+
+ prop = RNA_def_property(srna, "stiff_viscosity", PROP_FLOAT, PROP_NONE);
+ RNA_def_property_float_sdna(prop, NULL, "viscosity_beta");
+ RNA_def_property_range(prop, 0.0f, 100.0f);
+ RNA_def_property_ui_range(prop, 0.0f, 2.0f, 1, 3);
+ RNA_def_property_ui_text(prop, "Stiff viscosity", "Creates viscosity for expanding fluid");
+ RNA_def_property_update(prop, 0, "rna_Particle_reset");
+
+ /* Double density relaxation */
+ prop = RNA_def_property(srna, "stiffness", PROP_FLOAT, PROP_NONE);
+ RNA_def_property_float_sdna(prop, NULL, "stiffness_k");
+ 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, "Stiffness", "How incompressible the fluid is (speed of sound)");
+ RNA_def_property_update(prop, 0, "rna_Particle_reset");
+
+ prop = RNA_def_property(srna, "repulsion", PROP_FLOAT, PROP_NONE);
+ RNA_def_property_float_sdna(prop, NULL, "stiffness_knear");
+ RNA_def_property_range(prop, 0.0f, 100.0f);
+ RNA_def_property_ui_range(prop, 0.0f, 2.0f, 1, 3);
+ RNA_def_property_ui_text(prop, "Repulsion Factor",
+ "How strongly the fluid tries to keep from clustering (factor of stiffness)");
+ RNA_def_property_update(prop, 0, "rna_Particle_reset");
+
+ prop = RNA_def_property(srna, "rest_density", PROP_FLOAT, PROP_NONE);
+ RNA_def_property_float_sdna(prop, NULL, "rest_density");
+ RNA_def_property_range(prop, 0.0f, 10000.0f);
+ RNA_def_property_ui_range(prop, 0.0f, 2.0f, 1, 3);
+ RNA_def_property_ui_text(prop, "Rest Density", "Fluid rest density");
+ RNA_def_property_update(prop, 0, "rna_Particle_reset");
+
+ /* Buoyancy */
+ prop = RNA_def_property(srna, "buoyancy", PROP_FLOAT, PROP_NONE);
+ RNA_def_property_float_sdna(prop, NULL, "buoyancy");
+ RNA_def_property_range(prop, 0.0f, 10.0f);
+ RNA_def_property_ui_range(prop, 0.0f, 1.0f, 1, 3);
+ RNA_def_property_ui_text(prop, "Buoyancy",
+ "Artificial buoyancy force in negative gravity direction based on pressure "
+ "differences inside the fluid");
+ RNA_def_property_update(prop, 0, "rna_Particle_reset");
+
+ /* Factor flags */
+
+ prop = RNA_def_property(srna, "factor_repulsion", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "flag", SPH_FAC_REPULSION);
+ RNA_def_property_ui_text(prop, "Factor Repulsion", "Repulsion is a factor of stiffness");
+ RNA_def_property_update(prop, 0, "rna_Particle_reset");
+
+ prop = RNA_def_property(srna, "use_factor_density", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "flag", SPH_FAC_DENSITY);
+ RNA_def_property_ui_text(prop, "Factor Density",
+ "Density is calculated as a factor of default density (depends on particle size)");
+ RNA_def_property_update(prop, 0, "rna_Particle_reset");
+
+ prop = RNA_def_property(srna, "factor_radius", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "flag", SPH_FAC_RADIUS);
+ RNA_def_property_ui_text(prop, "Factor Radius", "Interaction radius is a factor of 4 * particle size");
+ RNA_def_property_update(prop, 0, "rna_Particle_reset");
+
+ prop = RNA_def_property(srna, "factor_stiff_viscosity", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "flag", SPH_FAC_VISCOSITY);
+ RNA_def_property_ui_text(prop, "Factor Stiff Viscosity", "Stiff viscosity is a factor of normal viscosity");
+ RNA_def_property_update(prop, 0, "rna_Particle_reset");
+
+ prop = RNA_def_property(srna, "factor_rest_length", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "flag", SPH_FAC_REST_LENGTH);
+ RNA_def_property_ui_text(prop, "Factor Rest Length", "Spring rest length is a factor of 2 * particle size");
+ RNA_def_property_update(prop, 0, "rna_Particle_reset");
+}
+
+static void rna_def_particle_settings_mtex(BlenderRNA *brna)
+{
+ StructRNA *srna;
+ PropertyRNA *prop;
+
+ static EnumPropertyItem texco_items[] = {
+ {TEXCO_GLOB, "GLOBAL", 0, "Global", "Use global coordinates for the texture coordinates"},
+ {TEXCO_OBJECT, "OBJECT", 0, "Object", "Use linked object's coordinates for texture coordinates"},
+ {TEXCO_UV, "UV", 0, "UV", "Use UV coordinates for texture coordinates"},
+ {TEXCO_ORCO, "ORCO", 0, "Generated", "Use the original undeformed coordinates of the object"},
+ {TEXCO_STRAND, "STRAND", 0, "Strand / Particle",
+ "Use normalized strand texture coordinate (1D) or particle age (X) and trail position (Y)"},
+ {0, NULL, 0, NULL, NULL}
+ };
+
+ static EnumPropertyItem prop_mapping_items[] = {
+ {MTEX_FLAT, "FLAT", 0, "Flat", "Map X and Y coordinates directly"},
+ {MTEX_CUBE, "CUBE", 0, "Cube", "Map using the normal vector"},
+ {MTEX_TUBE, "TUBE", 0, "Tube", "Map with Z as central axis"},
+ {MTEX_SPHERE, "SPHERE", 0, "Sphere", "Map with Z as central axis"},
+ {0, NULL, 0, NULL, NULL}
+ };
+
+ static EnumPropertyItem prop_x_mapping_items[] = {
+ {0, "NONE", 0, "None", ""},
+ {1, "X", 0, "X", ""},
+ {2, "Y", 0, "Y", ""},
+ {3, "Z", 0, "Z", ""},
+ {0, NULL, 0, NULL, NULL}
+ };
+
+ static EnumPropertyItem prop_y_mapping_items[] = {
+ {0, "NONE", 0, "None", ""},
+ {1, "X", 0, "X", ""},
+ {2, "Y", 0, "Y", ""},
+ {3, "Z", 0, "Z", ""},
+ {0, NULL, 0, NULL, NULL}
+ };
+
+ static EnumPropertyItem prop_z_mapping_items[] = {
+ {0, "NONE", 0, "None", ""},
+ {1, "X", 0, "X", ""},
+ {2, "Y", 0, "Y", ""},
+ {3, "Z", 0, "Z", ""},
+ {0, NULL, 0, NULL, NULL}
+ };
+
+ srna = RNA_def_struct(brna, "ParticleSettingsTextureSlot", "TextureSlot");
+ RNA_def_struct_sdna(srna, "MTex");
+ RNA_def_struct_ui_text(srna, "Particle Settings Texture Slot",
+ "Texture slot for textures in a Particle Settings data-block");
+
+ prop = RNA_def_property(srna, "texture_coords", PROP_ENUM, PROP_NONE);
+ RNA_def_property_enum_sdna(prop, NULL, "texco");
+ RNA_def_property_enum_items(prop, texco_items);
+ RNA_def_property_ui_text(prop, "Texture Coordinates",
+ "Texture coordinates used to map the texture onto the background");
+ RNA_def_property_update(prop, 0, "rna_Particle_reset");
+
+ prop = RNA_def_property(srna, "object", PROP_POINTER, PROP_NONE);
+ RNA_def_property_pointer_sdna(prop, NULL, "object");
+ RNA_def_property_struct_type(prop, "Object");
+ RNA_def_property_flag(prop, PROP_EDITABLE);
+ RNA_def_property_ui_text(prop, "Object", "Object to use for mapping with Object texture coordinates");
+ RNA_def_property_update(prop, 0, "rna_Particle_reset");
+
+ prop = RNA_def_property(srna, "uv_layer", PROP_STRING, PROP_NONE);
+ RNA_def_property_string_sdna(prop, NULL, "uvname");
+ RNA_def_property_ui_text(prop, "UV Map", "UV map to use for mapping with UV texture coordinates");
+ RNA_def_property_update(prop, 0, "rna_Particle_reset");
+
+ prop = RNA_def_property(srna, "mapping_x", PROP_ENUM, PROP_NONE);
+ RNA_def_property_enum_sdna(prop, NULL, "projx");
+ RNA_def_property_enum_items(prop, prop_x_mapping_items);
+ RNA_def_property_ui_text(prop, "X Mapping", "");
+ RNA_def_property_update(prop, 0, "rna_Particle_reset");
+
+ prop = RNA_def_property(srna, "mapping_y", PROP_ENUM, PROP_NONE);
+ RNA_def_property_enum_sdna(prop, NULL, "projy");
+ RNA_def_property_enum_items(prop, prop_y_mapping_items);
+ RNA_def_property_ui_text(prop, "Y Mapping", "");
+ RNA_def_property_update(prop, 0, "rna_Particle_reset");
+
+ prop = RNA_def_property(srna, "mapping_z", PROP_ENUM, PROP_NONE);
+ RNA_def_property_enum_sdna(prop, NULL, "projz");
+ RNA_def_property_enum_items(prop, prop_z_mapping_items);
+ RNA_def_property_ui_text(prop, "Z Mapping", "");
+ RNA_def_property_update(prop, 0, "rna_Particle_reset");
+
+ prop = RNA_def_property(srna, "mapping", PROP_ENUM, PROP_NONE);
+ RNA_def_property_enum_items(prop, prop_mapping_items);
+ RNA_def_property_ui_text(prop, "Mapping", "");
+ RNA_def_property_update(prop, 0, "rna_Particle_reset");
+
+ /* map to */
+ prop = RNA_def_property(srna, "use_map_time", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "mapto", PAMAP_TIME);
+ RNA_def_property_ui_text(prop, "Emission Time", "Affect the emission time of the particles");
+ RNA_def_property_update(prop, 0, "rna_Particle_reset");
+
+ prop = RNA_def_property(srna, "use_map_life", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "mapto", PAMAP_LIFE);
+ RNA_def_property_ui_text(prop, "Life Time", "Affect the life time of the particles");
+ RNA_def_property_update(prop, 0, "rna_Particle_reset");
+
+ prop = RNA_def_property(srna, "use_map_density", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "mapto", PAMAP_DENS);
+ RNA_def_property_ui_text(prop, "Density", "Affect the density of the particles");
+ RNA_def_property_update(prop, 0, "rna_Particle_reset");
+
+ prop = RNA_def_property(srna, "use_map_size", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "mapto", PAMAP_SIZE);
+ RNA_def_property_ui_text(prop, "Size", "Affect the particle size");
+ RNA_def_property_update(prop, 0, "rna_Particle_reset");
+
+ prop = RNA_def_property(srna, "use_map_velocity", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "mapto", PAMAP_IVEL);
+ RNA_def_property_ui_text(prop, "Initial Velocity", "Affect the particle initial velocity");
+ RNA_def_property_update(prop, 0, "rna_Particle_reset");
+
+ prop = RNA_def_property(srna, "use_map_field", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "mapto", PAMAP_FIELD);
+ RNA_def_property_ui_text(prop, "Force Field", "Affect the particle force fields");
+ RNA_def_property_update(prop, 0, "rna_Particle_reset");
+
+ prop = RNA_def_property(srna, "use_map_gravity", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "mapto", PAMAP_GRAVITY);
+ RNA_def_property_ui_text(prop, "Gravity", "Affect the particle gravity");
+ RNA_def_property_update(prop, 0, "rna_Particle_reset");
+
+ prop = RNA_def_property(srna, "use_map_damp", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "mapto", PAMAP_DAMP);
+ RNA_def_property_ui_text(prop, "Damp", "Affect the particle velocity damping");
+ RNA_def_property_update(prop, 0, "rna_Particle_redo_child");
+
+ prop = RNA_def_property(srna, "use_map_clump", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "mapto", PAMAP_CLUMP);
+ RNA_def_property_ui_text(prop, "Clump", "Affect the child clumping");
+ RNA_def_property_update(prop, 0, "rna_Particle_reset");
+
+ prop = RNA_def_property(srna, "use_map_kink_amp", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "mapto", PAMAP_KINK_AMP);
+ RNA_def_property_ui_text(prop, "Kink Amplitude", "Affect the child kink amplitude");
+ RNA_def_property_update(prop, 0, "rna_Particle_redo_child");
+
+ prop = RNA_def_property(srna, "use_map_kink_freq", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "mapto", PAMAP_KINK_FREQ);
+ RNA_def_property_ui_text(prop, "Kink Frequency", "Affect the child kink frequency");
+ RNA_def_property_update(prop, 0, "rna_Particle_redo_child");
+
+ prop = RNA_def_property(srna, "use_map_rough", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "mapto", PAMAP_ROUGH);
+ RNA_def_property_ui_text(prop, "Rough", "Affect the child rough");
+ RNA_def_property_update(prop, 0, "rna_Particle_redo_child");
+
+ prop = RNA_def_property(srna, "use_map_length", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "mapto", PAMAP_LENGTH);
+ RNA_def_property_ui_text(prop, "Length", "Affect the child hair length");
+ RNA_def_property_update(prop, 0, "rna_Particle_redo_child");
+
+
+ /* influence factors */
+ prop = RNA_def_property(srna, "time_factor", PROP_FLOAT, PROP_NONE);
+ RNA_def_property_float_sdna(prop, NULL, "timefac");
+ RNA_def_property_ui_range(prop, 0, 1, 10, 3);
+ RNA_def_property_ui_text(prop, "Emission Time Factor", "Amount texture affects particle emission time");
+ RNA_def_property_update(prop, 0, "rna_Particle_reset");
+
+ prop = RNA_def_property(srna, "life_factor", PROP_FLOAT, PROP_NONE);
+ RNA_def_property_float_sdna(prop, NULL, "lifefac");
+ RNA_def_property_ui_range(prop, 0, 1, 10, 3);
+ RNA_def_property_ui_text(prop, "Life Time Factor", "Amount texture affects particle life time");
+ RNA_def_property_update(prop, 0, "rna_Particle_reset");
+
+ prop = RNA_def_property(srna, "density_factor", PROP_FLOAT, PROP_NONE);
+ RNA_def_property_float_sdna(prop, NULL, "padensfac");
+ RNA_def_property_ui_range(prop, 0, 1, 10, 3);
+ RNA_def_property_ui_text(prop, "Density Factor", "Amount texture affects particle density");
+ RNA_def_property_update(prop, 0, "rna_Particle_reset");
+
+ prop = RNA_def_property(srna, "size_factor", PROP_FLOAT, PROP_NONE);
+ RNA_def_property_float_sdna(prop, NULL, "sizefac");
+ RNA_def_property_ui_range(prop, 0, 1, 10, 3);
+ RNA_def_property_ui_text(prop, "Size Factor", "Amount texture affects physical particle size");
+ RNA_def_property_update(prop, 0, "rna_Particle_reset");
+
+ prop = RNA_def_property(srna, "velocity_factor", PROP_FLOAT, PROP_NONE);
+ RNA_def_property_float_sdna(prop, NULL, "ivelfac");
+ RNA_def_property_ui_range(prop, 0, 1, 10, 3);
+ RNA_def_property_ui_text(prop, "Velocity Factor", "Amount texture affects particle initial velocity");
+ RNA_def_property_update(prop, 0, "rna_Particle_reset");
+
+
+ prop = RNA_def_property(srna, "field_factor", PROP_FLOAT, PROP_NONE);
+ RNA_def_property_float_sdna(prop, NULL, "fieldfac");
+ RNA_def_property_ui_range(prop, 0, 1, 10, 3);
+ RNA_def_property_ui_text(prop, "Field Factor", "Amount texture affects particle force fields");
+ RNA_def_property_update(prop, 0, "rna_Particle_reset");
+
+ prop = RNA_def_property(srna, "gravity_factor", PROP_FLOAT, PROP_NONE);
+ RNA_def_property_float_sdna(prop, NULL, "gravityfac");
+ RNA_def_property_ui_range(prop, 0, 1, 10, 3);
+ RNA_def_property_ui_text(prop, "Gravity Factor", "Amount texture affects particle gravity");
+ RNA_def_property_update(prop, 0, "rna_Particle_reset");
+
+ prop = RNA_def_property(srna, "damp_factor", PROP_FLOAT, PROP_NONE);
+ RNA_def_property_float_sdna(prop, NULL, "dampfac");
+ RNA_def_property_ui_range(prop, 0, 1, 10, 3);
+ RNA_def_property_ui_text(prop, "Damp Factor", "Amount texture affects particle damping");
+ RNA_def_property_update(prop, 0, "rna_Particle_reset");
+
+
+ prop = RNA_def_property(srna, "length_factor", PROP_FLOAT, PROP_NONE);
+ RNA_def_property_float_sdna(prop, NULL, "lengthfac");
+ RNA_def_property_ui_range(prop, 0, 1, 10, 3);
+ RNA_def_property_ui_text(prop, "Length Factor", "Amount texture affects child hair length");
+ RNA_def_property_update(prop, 0, "rna_Particle_redo_child");
+
+ prop = RNA_def_property(srna, "clump_factor", PROP_FLOAT, PROP_NONE);
+ RNA_def_property_float_sdna(prop, NULL, "clumpfac");
+ RNA_def_property_ui_range(prop, 0, 1, 10, 3);
+ RNA_def_property_ui_text(prop, "Clump Factor", "Amount texture affects child clump");
+ RNA_def_property_update(prop, 0, "rna_Particle_redo_child");
+
+ prop = RNA_def_property(srna, "kink_amp_factor", PROP_FLOAT, PROP_NONE);
+ RNA_def_property_float_sdna(prop, NULL, "kinkampfac");
+ RNA_def_property_ui_range(prop, 0, 1, 10, 3);
+ RNA_def_property_ui_text(prop, "Kink Amplitude Factor", "Amount texture affects child kink amplitude");
+ RNA_def_property_update(prop, 0, "rna_Particle_redo_child");
+
+ prop = RNA_def_property(srna, "kink_freq_factor", PROP_FLOAT, PROP_NONE);
+ RNA_def_property_float_sdna(prop, NULL, "kinkfac");
+ RNA_def_property_ui_range(prop, 0, 1, 10, 3);
+ RNA_def_property_ui_text(prop, "Kink Frequency Factor", "Amount texture affects child kink frequency");
+ RNA_def_property_update(prop, 0, "rna_Particle_redo_child");
+
+ prop = RNA_def_property(srna, "rough_factor", PROP_FLOAT, PROP_NONE);
+ RNA_def_property_float_sdna(prop, NULL, "roughfac");
+ 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");
+}
+
+static void rna_def_particle_settings(BlenderRNA *brna)
+{
+ StructRNA *srna;
+ PropertyRNA *prop;
+
+ static EnumPropertyItem type_items[] = {
+ {PART_EMITTER, "EMITTER", 0, "Emitter", ""},
+ /*{PART_REACTOR, "REACTOR", 0, "Reactor", ""}, */
+ {PART_HAIR, "HAIR", 0, "Hair", ""},
+ {0, NULL, 0, NULL, NULL}
+ };
+
+ static EnumPropertyItem phys_type_items[] = {
+ {PART_PHYS_NO, "NO", 0, "No", ""},
+ {PART_PHYS_NEWTON, "NEWTON", 0, "Newtonian", ""},
+ {PART_PHYS_KEYED, "KEYED", 0, "Keyed", ""},
+ {PART_PHYS_BOIDS, "BOIDS", 0, "Boids", ""},
+ {PART_PHYS_FLUID, "FLUID", 0, "Fluid", ""},
+ {0, NULL, 0, NULL, NULL}
+ };
+
+ static EnumPropertyItem rot_mode_items[] = {
+ {0, "NONE", 0, "None", ""},
+ {PART_ROT_NOR, "NOR", 0, "Normal", ""},
+ {PART_ROT_NOR_TAN, "NOR_TAN", 0, "Normal-Tangent", ""},
+ {PART_ROT_VEL, "VEL", 0, "Velocity / Hair", ""},
+ {PART_ROT_GLOB_X, "GLOB_X", 0, "Global X", ""},
+ {PART_ROT_GLOB_Y, "GLOB_Y", 0, "Global Y", ""},
+ {PART_ROT_GLOB_Z, "GLOB_Z", 0, "Global Z", ""},
+ {PART_ROT_OB_X, "OB_X", 0, "Object X", ""},
+ {PART_ROT_OB_Y, "OB_Y", 0, "Object Y", ""},
+ {PART_ROT_OB_Z, "OB_Z", 0, "Object Z", ""},
+ {0, NULL, 0, NULL, NULL}
+ };
+
+ static EnumPropertyItem ave_mode_items[] = {
+ {0, "NONE", 0, "None", ""},
+ {PART_AVE_VELOCITY, "VELOCITY", 0, "Velocity", ""},
+ {PART_AVE_HORIZONTAL, "HORIZONTAL", 0, "Horizontal", ""},
+ {PART_AVE_VERTICAL, "VERTICAL", 0, "Vertical", ""},
+ {PART_AVE_GLOBAL_X, "GLOBAL_X", 0, "Global X", ""},
+ {PART_AVE_GLOBAL_Y, "GLOBAL_Y", 0, "Global Y", ""},
+ {PART_AVE_GLOBAL_Z, "GLOBAL_Z", 0, "Global Z", ""},
+ {PART_AVE_RAND, "RAND", 0, "Random", ""},
+ {0, NULL, 0, NULL, NULL}
+ };
+
+ static EnumPropertyItem react_event_items[] = {
+ {PART_EVENT_DEATH, "DEATH", 0, "Death", ""},
+ {PART_EVENT_COLLIDE, "COLLIDE", 0, "Collision", ""},
+ {PART_EVENT_NEAR, "NEAR", 0, "Near", ""},
+ {0, NULL, 0, NULL, NULL}
+ };
+
+ static EnumPropertyItem child_type_items[] = {
+ {0, "NONE", 0, "None", ""},
+ {PART_CHILD_PARTICLES, "SIMPLE", 0, "Simple", ""},
+ {PART_CHILD_FACES, "INTERPOLATED", 0, "Interpolated", ""},
+ {0, NULL, 0, NULL, NULL}
+ };
+
+ /*TODO: names, tooltips */
+ static EnumPropertyItem integrator_type_items[] = {
+ {PART_INT_EULER, "EULER", 0, "Euler", ""},
+ {PART_INT_VERLET, "VERLET", 0, "Verlet", ""},
+ {PART_INT_MIDPOINT, "MIDPOINT", 0, "Midpoint", ""},
+ {PART_INT_RK4, "RK4", 0, "RK4", ""},
+ {0, NULL, 0, NULL, NULL}
+ };
+
+ static EnumPropertyItem kink_type_items[] = {
+ {PART_KINK_NO, "NO", 0, "Nothing", ""},
+ {PART_KINK_CURL, "CURL", 0, "Curl", ""},
+ {PART_KINK_RADIAL, "RADIAL", 0, "Radial", ""},
+ {PART_KINK_WAVE, "WAVE", 0, "Wave", ""},
+ {PART_KINK_BRAID, "BRAID", 0, "Braid", ""},
+ {PART_KINK_SPIRAL, "SPIRAL", 0, "Spiral", ""},
+ {0, NULL, 0, NULL, NULL}
+ };
+
+ static EnumPropertyItem bb_align_items[] = {
+ {PART_BB_X, "X", 0, "X", ""},
+ {PART_BB_Y, "Y", 0, "Y", ""},
+ {PART_BB_Z, "Z", 0, "Z", ""},
+ {PART_BB_VIEW, "VIEW", 0, "View", ""},
+ {PART_BB_VEL, "VEL", 0, "Velocity", ""},
+ {0, NULL, 0, NULL, NULL}
+ };
+
+ static EnumPropertyItem bb_anim_items[] = {
+ {PART_BB_ANIM_NONE, "NONE", 0, "None", ""},
+ {PART_BB_ANIM_AGE, "AGE", 0, "Age", ""},
+ {PART_BB_ANIM_FRAME, "FRAME", 0, "Frame", ""},
+ {PART_BB_ANIM_ANGLE, "ANGLE", 0, "Angle", ""},
+ {0, NULL, 0, NULL, NULL}
+ };
+
+ static EnumPropertyItem bb_split_offset_items[] = {
+ {PART_BB_OFF_NONE, "NONE", 0, "None", ""},
+ {PART_BB_OFF_LINEAR, "LINEAR", 0, "Linear", ""},
+ {PART_BB_OFF_RANDOM, "RANDOM", 0, "Random", ""},
+ {0, NULL, 0, NULL, NULL}
+ };
+
+ static EnumPropertyItem draw_col_items[] = {
+ {PART_DRAW_COL_NONE, "NONE", 0, "None", ""},
+ {PART_DRAW_COL_MAT, "MATERIAL", 0, "Material", ""},
+ {PART_DRAW_COL_VEL, "VELOCITY", 0, "Velocity", ""},
+ {PART_DRAW_COL_ACC, "ACCELERATION", 0, "Acceleration", ""},
+ {0, NULL, 0, NULL, NULL}
+ };
+
+ static EnumPropertyItem part_mat_items[] = {
+ {0, "DUMMY", 0, "Dummy", ""},
+ {0, NULL, 0, NULL, NULL}
+ };
+
+ srna = RNA_def_struct(brna, "ParticleSettings", "ID");
+ RNA_def_struct_ui_text(srna, "Particle Settings", "Particle settings, reusable by multiple particle systems");
+ RNA_def_struct_ui_icon(srna, ICON_PARTICLE_DATA);
+
+ rna_def_mtex_common(brna, srna, "rna_ParticleSettings_mtex_begin", "rna_ParticleSettings_active_texture_get",
+ "rna_ParticleSettings_active_texture_set", NULL, "ParticleSettingsTextureSlot",
+ "ParticleSettingsTextureSlots", "rna_Particle_reset", NULL);
+
+ /* fluid particle type can't be checked from the type value in rna as it's not shown in the menu */
+ prop = RNA_def_property(srna, "is_fluid", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_clear_flag(prop, PROP_EDITABLE);
+ RNA_def_property_boolean_funcs(prop, "rna_PartSettings_is_fluid_get", NULL);
+ RNA_def_property_ui_text(prop, "Fluid", "Particles were created by a fluid simulation");
+
+ /* flag */
+ prop = RNA_def_property(srna, "use_react_start_end", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "flag", PART_REACT_STA_END);
+ RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
+ RNA_def_property_ui_text(prop, "Start/End", "Give birth to unreacted particles eventually");
+ RNA_def_property_update(prop, 0, "rna_Particle_reset");
+
+ prop = RNA_def_property(srna, "use_react_multiple", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "flag", PART_REACT_MULTIPLE);
+ RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
+ RNA_def_property_ui_text(prop, "Multi React", "React multiple times");
+ RNA_def_property_update(prop, 0, "rna_Particle_reset");
+
+ prop = RNA_def_property(srna, "regrow_hair", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "flag", PART_HAIR_REGROW);
+ RNA_def_property_ui_text(prop, "Regrow", "Regrow hair for each frame");
+ RNA_def_property_update(prop, 0, "rna_Particle_redo");
+
+ prop = RNA_def_property(srna, "show_unborn", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "flag", PART_UNBORN);
+ RNA_def_property_ui_text(prop, "Unborn", "Show particles before they are emitted");
+ RNA_def_property_update(prop, 0, "rna_Particle_redo");
+
+ prop = RNA_def_property(srna, "use_dead", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "flag", PART_DIED);
+ RNA_def_property_ui_text(prop, "Died", "Show particles after they have died");
+ RNA_def_property_update(prop, 0, "rna_Particle_redo");
+
+ prop = RNA_def_property(srna, "use_emit_random", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "flag", PART_TRAND);
+ RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
+ RNA_def_property_ui_text(prop, "Random", "Emit in random order of elements");
+ RNA_def_property_update(prop, 0, "rna_Particle_reset");
+
+ prop = RNA_def_property(srna, "use_even_distribution", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "flag", PART_EDISTR);
+ RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
+ RNA_def_property_ui_text(prop, "Even Distribution",
+ "Use even distribution from faces based on face areas or edge lengths");
+ RNA_def_property_update(prop, 0, "rna_Particle_reset");
+
+ prop = RNA_def_property(srna, "use_die_on_collision", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "flag", PART_DIE_ON_COL);
+ RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
+ RNA_def_property_ui_text(prop, "Die on hit", "Particles die when they collide with a deflector object");
+ RNA_def_property_update(prop, 0, "rna_Particle_reset");
+
+ prop = RNA_def_property(srna, "use_size_deflect", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "flag", PART_SIZE_DEFL);
+ RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
+ RNA_def_property_ui_text(prop, "Size Deflect", "Use particle's size in deflection");
+ RNA_def_property_update(prop, 0, "rna_Particle_reset");
+
+ prop = RNA_def_property(srna, "use_rotations", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "flag", PART_ROTATIONS);
+ RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
+ RNA_def_property_ui_text(prop, "Rotations", "Calculate particle rotations");
+ RNA_def_property_update(prop, 0, "rna_Particle_reset");
+
+ prop = RNA_def_property(srna, "use_dynamic_rotation", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "flag", PART_ROT_DYN);
+ RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
+ RNA_def_property_ui_text(prop, "Dynamic", "Particle rotations are affected by collisions and effectors");
+ RNA_def_property_update(prop, 0, "rna_Particle_reset");
+
+ prop = RNA_def_property(srna, "use_multiply_size_mass", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "flag", PART_SIZEMASS);
+ RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
+ 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");
+ RNA_def_property_update(prop, 0, "rna_Particle_reset");
+
+ prop = RNA_def_property(srna, "use_hair_bspline", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "flag", PART_HAIR_BSPLINE);
+ RNA_def_property_ui_text(prop, "B-Spline", "Interpolate hair using B-Splines");
+ RNA_def_property_update(prop, 0, "rna_Particle_redo");
+
+ prop = RNA_def_property(srna, "invert_grid", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "flag", PART_GRID_INVERT);
+ RNA_def_property_ui_text(prop, "Invert Grid", "Invert what is considered object and what is not");
+ RNA_def_property_update(prop, 0, "rna_Particle_reset");
+
+ prop = RNA_def_property(srna, "hexagonal_grid", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "flag", PART_GRID_HEXAGONAL);
+ RNA_def_property_ui_text(prop, "Hexagonal Grid", "Create the grid in a hexagonal pattern");
+ RNA_def_property_update(prop, 0, "rna_Particle_reset");
+
+ 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, "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);
+ RNA_def_property_boolean_sdna(prop, NULL, "flag", PART_CHILD_LONG_HAIR);
+ RNA_def_property_ui_text(prop, "Long Hair", "Calculate children that suit long hair well");
+ RNA_def_property_update(prop, 0, "rna_Particle_redo_child");
+
+ prop = RNA_def_property(srna, "apply_guide_to_children", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "flag", PART_CHILD_GUIDE);
+ RNA_def_property_ui_text(prop, "apply_guide_to_children", "");
+ RNA_def_property_update(prop, 0, "rna_Particle_redo");
+
+ prop = RNA_def_property(srna, "use_self_effect", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "flag", PART_SELF_EFFECT);
+ RNA_def_property_ui_text(prop, "Self Effect", "Particle effectors affect themselves");
+ RNA_def_property_update(prop, 0, "rna_Particle_reset");
+
+
+ prop = RNA_def_property(srna, "type", PROP_ENUM, PROP_NONE);
+ RNA_def_property_enum_items(prop, type_items);
+ RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
+ RNA_def_property_ui_text(prop, "Type", "Particle Type");
+ RNA_def_property_update(prop, 0, "rna_Particle_change_type");
+
+ prop = RNA_def_property(srna, "emit_from", PROP_ENUM, PROP_NONE);
+ RNA_def_property_enum_sdna(prop, NULL, "from");
+ RNA_def_property_enum_items(prop, part_reactor_from_items);
+ RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
+ RNA_def_property_enum_funcs(prop, NULL, NULL, "rna_Particle_from_itemf");
+ RNA_def_property_ui_text(prop, "Emit From", "Where to emit particles from");
+ RNA_def_property_update(prop, 0, "rna_Particle_reset");
+
+ prop = RNA_def_property(srna, "distribution", PROP_ENUM, PROP_NONE);
+ RNA_def_property_enum_sdna(prop, NULL, "distr");
+ RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
+ RNA_def_property_enum_items(prop, part_dist_items);
+ RNA_def_property_enum_funcs(prop, NULL, NULL, "rna_Particle_dist_itemf");
+ RNA_def_property_ui_text(prop, "Distribution", "How to distribute particles on selected element");
+ RNA_def_property_update(prop, 0, "rna_Particle_reset");
+
+ /* physics modes */
+ prop = RNA_def_property(srna, "physics_type", PROP_ENUM, PROP_NONE);
+ RNA_def_property_enum_sdna(prop, NULL, "phystype");
+ RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
+ RNA_def_property_enum_items(prop, phys_type_items);
+ RNA_def_property_ui_text(prop, "Physics Type", "Particle physics type");
+ RNA_def_property_update(prop, 0, "rna_Particle_change_physics");
+
+ prop = RNA_def_property(srna, "rotation_mode", PROP_ENUM, PROP_NONE);
+ RNA_def_property_enum_sdna(prop, NULL, "rotmode");
+ RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
+ RNA_def_property_enum_items(prop, rot_mode_items);
+ RNA_def_property_ui_text(prop, "Orientation axis",
+ "Particle orientation axis (does not affect Explode modifier's results)");
+ RNA_def_property_update(prop, 0, "rna_Particle_reset");
+
+ prop = RNA_def_property(srna, "angular_velocity_mode", PROP_ENUM, PROP_NONE);
+ RNA_def_property_enum_sdna(prop, NULL, "avemode");
+ RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
+ RNA_def_property_enum_items(prop, ave_mode_items);
+ RNA_def_property_ui_text(prop, "Angular Velocity Axis", "What axis is used to change particle rotation with time");
+ RNA_def_property_update(prop, 0, "rna_Particle_reset");
+
+ prop = RNA_def_property(srna, "react_event", PROP_ENUM, PROP_NONE);
+ RNA_def_property_enum_sdna(prop, NULL, "reactevent");
+ RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
+ RNA_def_property_enum_items(prop, react_event_items);
+ RNA_def_property_ui_text(prop, "React On", "The event of target particles to react on");
+ RNA_def_property_update(prop, 0, "rna_Particle_reset");
+
+ /*draw flag*/
+ prop = RNA_def_property(srna, "show_guide_hairs", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "draw", PART_DRAW_GUIDE_HAIRS);
+ RNA_def_property_ui_text(prop, "Guide Hairs", "Show guide hairs");
+ RNA_def_property_update(prop, 0, "rna_Particle_redo");
+
+ prop = RNA_def_property(srna, "show_hair_grid", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "draw", PART_DRAW_HAIR_GRID);
+ RNA_def_property_ui_text(prop, "Guide Hairs", "Show hair simulation grid");
+ RNA_def_property_update(prop, 0, "rna_Particle_redo");
+
+ prop = RNA_def_property(srna, "show_velocity", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "draw", PART_DRAW_VEL);
+ RNA_def_property_ui_text(prop, "Velocity", "Show particle velocity");
+ RNA_def_property_update(prop, 0, "rna_Particle_redo");
+
+ prop = RNA_def_property(srna, "show_size", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "draw", PART_DRAW_SIZE);
+ RNA_def_property_ui_text(prop, "Size", "Show particle size");
+ RNA_def_property_update(prop, 0, "rna_Particle_redo");
+
+ prop = RNA_def_property(srna, "use_render_emitter", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "draw", PART_DRAW_EMITTER);
+ RNA_def_property_ui_text(prop, "Emitter", "Render emitter Object also");
+ RNA_def_property_update(prop, 0, "rna_Particle_redo");
+
+ prop = RNA_def_property(srna, "show_health", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "draw", PART_DRAW_HEALTH);
+ RNA_def_property_ui_text(prop, "Health", "Draw boid health");
+ RNA_def_property_update(prop, 0, "rna_Particle_redo");
+
+ prop = RNA_def_property(srna, "use_absolute_path_time", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "draw", PART_ABS_PATH_TIME);
+ RNA_def_property_ui_text(prop, "Absolute Path Time", "Path timing is in absolute frames");
+ RNA_def_property_update(prop, 0, "rna_Particle_abspathtime_update");
+
+ prop = RNA_def_property(srna, "use_parent_particles", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "draw", PART_DRAW_PARENT);
+ RNA_def_property_ui_text(prop, "Parents", "Render parent particles");
+ RNA_def_property_update(prop, 0, "rna_Particle_redo");
+
+ prop = RNA_def_property(srna, "show_number", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "draw", PART_DRAW_NUM);
+ RNA_def_property_ui_text(prop, "Number", "Show particle number");
+ RNA_def_property_update(prop, 0, "rna_Particle_redo");
+
+ prop = RNA_def_property(srna, "use_group_pick_random", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "draw", PART_DRAW_RAND_GR);
+ RNA_def_property_ui_text(prop, "Pick Random", "Pick objects from group randomly");
+ RNA_def_property_update(prop, 0, "rna_Particle_redo");
+
+ prop = RNA_def_property(srna, "use_group_count", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "draw", PART_DRAW_COUNT_GR);
+ RNA_def_property_ui_text(prop, "Use Count", "Use object multiple times in the same group");
+ RNA_def_property_update(prop, 0, "rna_Particle_redo");
+
+ prop = RNA_def_property(srna, "use_global_dupli", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "draw", PART_DRAW_GLOBAL_OB);
+ RNA_def_property_ui_text(prop, "Global", "Use object's global coordinates for duplication");
+ RNA_def_property_update(prop, 0, "rna_Particle_redo");
+
+ prop = RNA_def_property(srna, "use_rotation_dupli", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "draw", PART_DRAW_ROTATE_OB);
+ RNA_def_property_ui_text(prop, "Rotation",
+ "Use object's rotation for duplication (global x-axis is aligned "
+ "particle rotation axis)");
+ RNA_def_property_update(prop, 0, "rna_Particle_redo");
+
+ prop = RNA_def_property(srna, "use_scale_dupli", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_negative_sdna(prop, NULL, "draw", PART_DRAW_NO_SCALE_OB);
+ RNA_def_property_ui_text(prop, "Scale", "Use object's scale for duplication");
+ RNA_def_property_update(prop, 0, "rna_Particle_redo");
+
+ prop = RNA_def_property(srna, "use_render_adaptive", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "draw", PART_DRAW_REN_ADAPT);
+ RNA_def_property_ui_text(prop, "Adaptive render", "Draw steps of the particle path");
+ RNA_def_property_update(prop, 0, "rna_Particle_redo");
+
+ prop = RNA_def_property(srna, "use_velocity_length", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "draw", PART_DRAW_VEL_LENGTH);
+ RNA_def_property_ui_text(prop, "Speed", "Multiply line length by particle speed");
+ RNA_def_property_update(prop, 0, "rna_Particle_redo");
+
+ prop = RNA_def_property(srna, "use_whole_group", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "draw", PART_DRAW_WHOLE_GR);
+ RNA_def_property_ui_text(prop, "Whole Group", "Use whole group at once");
+ RNA_def_property_update(prop, 0, "rna_Particle_redo");
+
+ prop = RNA_def_property(srna, "use_strand_primitive", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "draw", PART_DRAW_REN_STRAND);
+ RNA_def_property_ui_text(prop, "Strand render", "Use the strand primitive for rendering");
+ RNA_def_property_update(prop, 0, "rna_Particle_redo");
+
+ prop = RNA_def_property(srna, "draw_method", PROP_ENUM, PROP_NONE);
+ RNA_def_property_enum_sdna(prop, NULL, "draw_as");
+ RNA_def_property_enum_items(prop, part_draw_as_items);
+ RNA_def_property_enum_funcs(prop, NULL, NULL, "rna_Particle_draw_as_itemf");
+ RNA_def_property_ui_text(prop, "Particle Drawing", "How particles are drawn in viewport");
+ RNA_def_property_update(prop, 0, "rna_Particle_redo");
+
+ prop = RNA_def_property(srna, "render_type", PROP_ENUM, PROP_NONE);
+ RNA_def_property_enum_sdna(prop, NULL, "ren_as");
+ RNA_def_property_enum_items(prop, part_ren_as_items);
+ RNA_def_property_enum_funcs(prop, NULL, NULL, "rna_Particle_ren_as_itemf");
+ RNA_def_property_ui_text(prop, "Particle Rendering", "How particles are rendered");
+ RNA_def_property_update(prop, 0, "rna_Particle_redo");
+
+ prop = RNA_def_property(srna, "draw_color", PROP_ENUM, PROP_NONE);
+ RNA_def_property_enum_sdna(prop, NULL, "draw_col");
+ RNA_def_property_enum_items(prop, draw_col_items);
+ RNA_def_property_ui_text(prop, "Draw Color", "Draw additional particle data as a color");
+ RNA_def_property_update(prop, 0, "rna_Particle_redo");
+
+ prop = RNA_def_property(srna, "draw_size", PROP_INT, PROP_PIXEL);
+ RNA_def_property_range(prop, 0, 1000);
+ RNA_def_property_ui_range(prop, 0, 100, 1, -1);
+ RNA_def_property_ui_text(prop, "Draw Size", "Size of particles on viewport in pixels (0=default)");
+ RNA_def_property_update(prop, 0, "rna_Particle_redo");
+
+ prop = RNA_def_property(srna, "child_type", PROP_ENUM, PROP_NONE);
+ RNA_def_property_enum_sdna(prop, NULL, "childtype");
+ RNA_def_property_enum_items(prop, child_type_items);
+ RNA_def_property_ui_text(prop, "Children From", "Create child particles");
+ RNA_def_property_update(prop, 0, "rna_Particle_redo_child");
+
+ prop = RNA_def_property(srna, "draw_step", PROP_INT, PROP_NONE);
+ RNA_def_property_range(prop, 0, 10);
+ RNA_def_property_ui_range(prop, 0, 7, 1, -1);
+ RNA_def_property_ui_text(prop, "Steps", "How many steps paths are drawn with (power of 2)");
+ RNA_def_property_update(prop, 0, "rna_Particle_redo");
+
+ prop = RNA_def_property(srna, "render_step", PROP_INT, PROP_NONE);
+ RNA_def_property_int_sdna(prop, NULL, "ren_step");
+ RNA_def_property_range(prop, 0, 20);
+ RNA_def_property_ui_range(prop, 0, 9, 1, -1);
+ RNA_def_property_ui_text(prop, "Render", "How many steps paths are rendered with (power of 2)");
+
+ prop = RNA_def_property(srna, "hair_step", PROP_INT, PROP_NONE);
+ RNA_def_property_range(prop, 2, 50);
+ RNA_def_property_ui_text(prop, "Segments", "Number of hair segments");
+ RNA_def_property_update(prop, 0, "rna_Particle_reset");
+
+ prop = RNA_def_property(srna, "bending_random", PROP_FLOAT, PROP_NONE);
+ RNA_def_property_float_sdna(prop, NULL, "bending_random");
+ RNA_def_property_range(prop, 0.0f, 1.0f);
+ RNA_def_property_ui_text(prop, "Random Bending Stiffness", "Random stiffness of hairs");
+ RNA_def_property_update(prop, 0, "rna_Particle_cloth_update");
+
+ /*TODO: not found in UI, readonly? */
+ prop = RNA_def_property(srna, "keys_step", PROP_INT, PROP_NONE);
+ RNA_def_property_range(prop, 0, SHRT_MAX); /*TODO:min,max */
+ RNA_def_property_ui_text(prop, "Keys Step", "");
+
+ /* adaptive path rendering */
+ prop = RNA_def_property(srna, "adaptive_angle", PROP_INT, PROP_NONE);
+ RNA_def_property_int_sdna(prop, NULL, "adapt_angle");
+ RNA_def_property_range(prop, 0, 45);
+ RNA_def_property_ui_text(prop, "Degrees", "How many degrees path has to curve to make another render segment");
+
+ prop = RNA_def_property(srna, "adaptive_pixel", PROP_INT, PROP_NONE);
+ RNA_def_property_int_sdna(prop, NULL, "adapt_pix");
+ RNA_def_property_range(prop, 0, 50);
+ RNA_def_property_ui_text(prop, "Pixel", "How many pixels path has to cover to make another render segment");
+
+ prop = RNA_def_property(srna, "draw_percentage", PROP_INT, PROP_PERCENTAGE);
+ RNA_def_property_int_sdna(prop, NULL, "disp");
+ RNA_def_property_range(prop, 0, 100);
+ RNA_def_property_ui_text(prop, "Display", "Percentage of particles to display in 3D view");
+ RNA_def_property_update(prop, 0, "rna_Particle_reset");
+
+ prop = RNA_def_property(srna, "material", PROP_INT, PROP_NONE);
+ RNA_def_property_int_sdna(prop, NULL, "omat");
+ RNA_def_property_range(prop, 1, 32767);
+ RNA_def_property_ui_text(prop, "Material Index", "Index of material slot used for rendering particles");
+ RNA_def_property_update(prop, 0, "rna_Particle_redo");
+
+ prop = RNA_def_property(srna, "material_slot", PROP_ENUM, PROP_NONE);
+ RNA_def_property_enum_sdna(prop, NULL, "omat");
+ RNA_def_property_enum_items(prop, part_mat_items);
+ RNA_def_property_enum_funcs(prop, NULL, NULL, "rna_Particle_Material_itemf");
+ RNA_def_property_ui_text(prop, "Material Slot", "Material slot used for rendering particles");
+ RNA_def_property_update(prop, 0, "rna_Particle_redo");
+
+ prop = RNA_def_property(srna, "integrator", PROP_ENUM, PROP_NONE);
+ RNA_def_property_enum_items(prop, integrator_type_items);
+ RNA_def_property_ui_text(prop, "Integration",
+ "Algorithm used to calculate physics, from the fastest to the "
+ "most stable/accurate: Midpoint, Euler, Verlet, RK4 (Old)");
+ RNA_def_property_update(prop, 0, "rna_Particle_reset");
+
+ prop = RNA_def_property(srna, "kink", PROP_ENUM, PROP_NONE);
+ RNA_def_property_enum_items(prop, kink_type_items);
+ RNA_def_property_ui_text(prop, "Kink", "Type of periodic offset on the path");
+ RNA_def_property_update(prop, 0, "rna_Particle_redo_child");
+
+ prop = RNA_def_property(srna, "kink_axis", PROP_ENUM, PROP_NONE);
+ RNA_def_property_enum_items(prop, rna_enum_axis_xyz_items);
+ RNA_def_property_ui_text(prop, "Axis", "Which axis to use for offset");
+ RNA_def_property_update(prop, 0, "rna_Particle_redo_child");
+
+ /* billboards */
+ prop = RNA_def_property(srna, "lock_billboard", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "draw", PART_DRAW_BB_LOCK);
+ RNA_def_property_ui_text(prop, "Lock Billboard", "Lock the billboards align axis");
+ RNA_def_property_update(prop, 0, "rna_Particle_redo");
+
+ prop = RNA_def_property(srna, "billboard_align", PROP_ENUM, PROP_NONE);
+ RNA_def_property_enum_sdna(prop, NULL, "bb_align");
+ RNA_def_property_enum_items(prop, bb_align_items);
+ RNA_def_property_ui_text(prop, "Align to", "In respect to what the billboards are aligned");
+ RNA_def_property_update(prop, 0, "rna_Particle_redo");
+
+ prop = RNA_def_property(srna, "billboard_uv_split", PROP_INT, PROP_NONE);
+ RNA_def_property_int_sdna(prop, NULL, "bb_uv_split");
+ RNA_def_property_range(prop, 1, 100);
+ RNA_def_property_ui_range(prop, 1, 10, 1, -1);
+ RNA_def_property_ui_text(prop, "UV Split", "Number of rows/columns to split UV coordinates for billboards");
+
+ prop = RNA_def_property(srna, "billboard_animation", PROP_ENUM, PROP_NONE);
+ RNA_def_property_enum_sdna(prop, NULL, "bb_anim");
+ RNA_def_property_enum_items(prop, bb_anim_items);
+ RNA_def_property_ui_text(prop, "Animate", "How to animate billboard textures");
+
+ prop = RNA_def_property(srna, "billboard_offset_split", PROP_ENUM, PROP_NONE);
+ RNA_def_property_enum_sdna(prop, NULL, "bb_split_offset");
+ RNA_def_property_enum_items(prop, bb_split_offset_items);
+ RNA_def_property_ui_text(prop, "Offset", "How to offset billboard textures");
+
+ prop = RNA_def_property(srna, "billboard_tilt", PROP_FLOAT, PROP_NONE);
+ RNA_def_property_float_sdna(prop, NULL, "bb_tilt");
+ RNA_def_property_range(prop, -1.0f, 1.0f);
+ RNA_def_property_ui_text(prop, "Tilt", "Tilt of the billboards");
+ RNA_def_property_update(prop, 0, "rna_Particle_redo");
+
+ prop = RNA_def_property(srna, "color_maximum", PROP_FLOAT, PROP_NONE);
+ RNA_def_property_float_sdna(prop, NULL, "color_vec_max");
+ RNA_def_property_range(prop, 0.01f, 100.0f);
+ RNA_def_property_ui_text(prop, "Color Maximum", "Maximum length of the particle color vector");
+ RNA_def_property_update(prop, 0, "rna_Particle_redo");
+
+ prop = RNA_def_property(srna, "billboard_tilt_random", PROP_FLOAT, PROP_NONE);
+ RNA_def_property_float_sdna(prop, NULL, "bb_rand_tilt");
+ RNA_def_property_range(prop, 0.0f, 1.0f);
+ RNA_def_property_ui_text(prop, "Random Tilt", "Random tilt of the billboards");
+ RNA_def_property_update(prop, 0, "rna_Particle_redo");
+
+ prop = RNA_def_property(srna, "billboard_offset", PROP_FLOAT, PROP_TRANSLATION);
+ RNA_def_property_float_sdna(prop, NULL, "bb_offset");
+ RNA_def_property_array(prop, 2);
+ RNA_def_property_range(prop, -100.0f, 100.0f);
+ RNA_def_property_ui_range(prop, -1.0, 1.0, 0.1, 3);
+ RNA_def_property_ui_text(prop, "Billboard Offset", "");
+ RNA_def_property_update(prop, 0, "rna_Particle_redo");
+
+ prop = RNA_def_property(srna, "billboard_size", PROP_FLOAT, PROP_FACTOR);
+ RNA_def_property_float_sdna(prop, NULL, "bb_size");
+ RNA_def_property_array(prop, 2);
+ RNA_def_property_range(prop, 0.001f, 10.0f);
+ RNA_def_property_ui_text(prop, "Billboard Scale", "Scale billboards relative to particle size");
+ RNA_def_property_update(prop, 0, "rna_Particle_redo");
+
+ prop = RNA_def_property(srna, "billboard_velocity_head", PROP_FLOAT, PROP_FACTOR);
+ RNA_def_property_float_sdna(prop, NULL, "bb_vel_head");
+ RNA_def_property_range(prop, 0.0f, 10.0f);
+ RNA_def_property_ui_text(prop, "Billboard Velocity Head", "Scale billboards by velocity");
+ RNA_def_property_update(prop, 0, "rna_Particle_redo");
+
+ prop = RNA_def_property(srna, "billboard_velocity_tail", PROP_FLOAT, PROP_FACTOR);
+ RNA_def_property_float_sdna(prop, NULL, "bb_vel_tail");
+ RNA_def_property_range(prop, 0.0f, 10.0f);
+ RNA_def_property_ui_text(prop, "Billboard Velocity Tail", "Scale billboards by velocity");
+ RNA_def_property_update(prop, 0, "rna_Particle_redo");
+
+ /* simplification */
+ prop = RNA_def_property(srna, "use_simplify", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "simplify_flag", PART_SIMPLIFY_ENABLE);
+ RNA_def_property_ui_text(prop, "Child Simplification",
+ "Remove child strands as the object becomes smaller on the screen");
+
+ prop = RNA_def_property(srna, "use_simplify_viewport", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "simplify_flag", PART_SIMPLIFY_VIEWPORT);
+ RNA_def_property_ui_text(prop, "Viewport", "");
+
+ prop = RNA_def_property(srna, "simplify_refsize", PROP_INT, PROP_PIXEL);
+ RNA_def_property_int_sdna(prop, NULL, "simplify_refsize");
+ RNA_def_property_range(prop, 1, SHRT_MAX);
+ RNA_def_property_ui_text(prop, "Reference Size", "Reference size in pixels, after which simplification begins");
+
+ prop = RNA_def_property(srna, "simplify_rate", PROP_FLOAT, PROP_NONE);
+ RNA_def_property_range(prop, 0.0f, 1.0f);
+ RNA_def_property_ui_text(prop, "Rate", "Speed of simplification");
+
+ prop = RNA_def_property(srna, "simplify_transition", PROP_FLOAT, PROP_NONE);
+ RNA_def_property_range(prop, 0.0f, 1.0f);
+ RNA_def_property_ui_text(prop, "Transition", "Transition period for fading out strands");
+
+ prop = RNA_def_property(srna, "simplify_viewport", PROP_FLOAT, PROP_NONE);
+ RNA_def_property_range(prop, 0.0f, 0.999f);
+ RNA_def_property_ui_text(prop, "Rate", "Speed of Simplification");
+
+ /* general values */
+ prop = RNA_def_property(srna, "frame_start", PROP_FLOAT, PROP_NONE);
+ RNA_def_property_float_sdna(prop, NULL, "sta"); /*optional if prop names are the same */
+ RNA_def_property_range(prop, MINAFRAMEF, MAXFRAMEF);
+ RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
+ RNA_def_property_float_funcs(prop, NULL, "rna_PartSettings_start_set", NULL);
+ RNA_def_property_ui_text(prop, "Start", "Frame number to start emitting particles");
+ RNA_def_property_update(prop, 0, "rna_Particle_reset");
+
+ prop = RNA_def_property(srna, "frame_end", PROP_FLOAT, PROP_NONE);
+ RNA_def_property_float_sdna(prop, NULL, "end");
+ RNA_def_property_range(prop, MINAFRAMEF, MAXFRAMEF);
+
+ RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
+ RNA_def_property_float_funcs(prop, NULL, "rna_PartSettings_end_set", NULL);
+ RNA_def_property_ui_text(prop, "End", "Frame number to stop emitting particles");
+ RNA_def_property_update(prop, 0, "rna_Particle_reset");
+
+ prop = RNA_def_property(srna, "lifetime", PROP_FLOAT, PROP_TIME);
+ RNA_def_property_range(prop, 1.0f, MAXFRAMEF);
+ RNA_def_property_ui_text(prop, "Lifetime", "Life span of the particles");
+ RNA_def_property_update(prop, 0, "rna_Particle_reset");
+
+ prop = RNA_def_property(srna, "lifetime_random", PROP_FLOAT, PROP_NONE);
+ RNA_def_property_float_sdna(prop, NULL, "randlife");
+ RNA_def_property_range(prop, 0.0f, 1.0f);
+ RNA_def_property_ui_text(prop, "Random", "Give the particle life a random variation");
+ RNA_def_property_update(prop, 0, "rna_Particle_reset");
+
+ prop = RNA_def_property(srna, "time_tweak", PROP_FLOAT, PROP_NONE);
+ RNA_def_property_float_sdna(prop, NULL, "timetweak");
+ RNA_def_property_range(prop, 0.0f, 100.0f);
+ RNA_def_property_ui_range(prop, 0, 10, 1, 3);
+ RNA_def_property_ui_text(prop, "Tweak", "A multiplier for physics timestep (1.0 means one frame = 1/25 seconds)");
+ RNA_def_property_update(prop, 0, "rna_Particle_reset");
+
+ prop = RNA_def_property(srna, "timestep", PROP_FLOAT, PROP_NONE);
+ RNA_def_property_float_funcs(prop, "rna_PartSettings_timestep_get", "rna_PartSetings_timestep_set", NULL);
+ RNA_def_property_range(prop, 0.0001, 100.0);
+ RNA_def_property_ui_range(prop, 0.01, 10, 1, 3);
+ RNA_def_property_ui_text(prop, "Timestep", "The simulation timestep per frame (seconds per frame)");
+ RNA_def_property_update(prop, 0, "rna_Particle_reset");
+
+ prop = RNA_def_property(srna, "use_adaptive_subframes", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "time_flag", PART_TIME_AUTOSF);
+ RNA_def_property_ui_text(prop, "Automatic Subframes", "Automatically set the number of subframes");
+ RNA_def_property_update(prop, 0, "rna_Particle_reset");
+
+ prop = RNA_def_property(srna, "subframes", PROP_INT, PROP_NONE);
+ RNA_def_property_range(prop, 0, 1000);
+ RNA_def_property_ui_text(prop, "Subframes",
+ "Subframes to simulate for improved stability and finer granularity simulations "
+ "(dt = timestep / (subframes + 1))");
+ RNA_def_property_update(prop, 0, "rna_Particle_reset");
+
+ prop = RNA_def_property(srna, "courant_target", PROP_FLOAT, PROP_NONE);
+ RNA_def_property_range(prop, 0.0001, 10);
+ RNA_def_property_float_default(prop, 0.1);
+ RNA_def_property_ui_text(prop, "Adaptive Subframe Threshold",
+ "The relative distance a particle can move before requiring more subframes "
+ "(target Courant number); 0.01-0.3 is the recommended range");
+ RNA_def_property_update(prop, 0, "rna_Particle_reset");
+
+ prop = RNA_def_property(srna, "jitter_factor", PROP_FLOAT, PROP_NONE);
+ RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
+ RNA_def_property_float_sdna(prop, NULL, "jitfac");
+ RNA_def_property_range(prop, 0.0f, 2.0f);
+ RNA_def_property_ui_text(prop, "Amount", "Amount of jitter applied to the sampling");
+ RNA_def_property_update(prop, 0, "rna_Particle_reset");
+
+ prop = RNA_def_property(srna, "effect_hair", PROP_FLOAT, PROP_NONE);
+ RNA_def_property_float_sdna(prop, NULL, "eff_hair");
+ RNA_def_property_range(prop, 0.0f, 1.0f);
+ RNA_def_property_ui_text(prop, "Stiffness", "Hair stiffness for effectors");
+ RNA_def_property_update(prop, 0, "rna_Particle_redo");
+
+ prop = RNA_def_property(srna, "count", PROP_INT, PROP_UNSIGNED);
+ RNA_def_property_int_sdna(prop, NULL, "totpart");
+ RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
+ /* This limit is for those freaks who have the machine power to handle it. */
+ /* 10M particles take around 2.2 Gb of memory / disk space in saved file and */
+ /* each cached frame takes around 0.5 Gb of memory / disk space depending on cache mode. */
+ RNA_def_property_range(prop, 0, 10000000);
+ RNA_def_property_ui_range(prop, 0, 100000, 1, -1);
+ RNA_def_property_ui_text(prop, "Number", "Total number of particles");
+ RNA_def_property_update(prop, 0, "rna_Particle_reset");
+
+ prop = RNA_def_property(srna, "userjit", PROP_INT, PROP_UNSIGNED); /*TODO: can we get a better name for userjit? */
+ RNA_def_property_int_sdna(prop, NULL, "userjit");
+ RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
+ RNA_def_property_range(prop, 0, 1000);
+ RNA_def_property_ui_text(prop, "P/F", "Emission locations / face (0 = automatic)");
+ RNA_def_property_update(prop, 0, "rna_Particle_reset");
+
+ prop = RNA_def_property(srna, "grid_resolution", PROP_INT, PROP_UNSIGNED);
+ RNA_def_property_int_sdna(prop, NULL, "grid_res");
+ RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
+ RNA_def_property_range(prop, 1, 250); /* ~15M particles in a cube (ouch!), but could be very usable in a plane */
+ RNA_def_property_ui_range(prop, 1, 50, 1, -1); /* ~100k particles in a cube */
+ RNA_def_property_ui_text(prop, "Resolution", "The resolution of the particle grid");
+ RNA_def_property_update(prop, 0, "rna_Particle_reset");
+
+ prop = RNA_def_property(srna, "grid_random", PROP_FLOAT, PROP_NONE);
+ RNA_def_property_float_sdna(prop, NULL, "grid_rand");
+ RNA_def_property_range(prop, 0.0f, 1.0f);
+ RNA_def_property_ui_text(prop, "Grid Randomness", "Add random offset to the grid locations");
+ RNA_def_property_update(prop, 0, "rna_Particle_reset");
+
+ prop = RNA_def_property(srna, "effector_amount", PROP_INT, PROP_UNSIGNED);
+ /* in theory PROP_ANIMATABLE perhaps should be cleared, but animating this can give some interesting results! */
+ RNA_def_property_range(prop, 0, 10000); /* 10000 effectors will bel SLOW, but who knows */
+ RNA_def_property_ui_range(prop, 0, 100, 1, -1);
+ RNA_def_property_ui_text(prop, "Effector Number", "How many particles are effectors (0 is all particles)");
+ RNA_def_property_update(prop, 0, "rna_Particle_reset");
+
+ /* initial velocity factors */
+ prop = RNA_def_property(srna, "normal_factor", PROP_FLOAT, PROP_NONE);
+ RNA_def_property_float_sdna(prop, NULL, "normfac"); /*optional if prop names are the same */
+ RNA_def_property_range(prop, -1000.0f, 1000.0f);
+ RNA_def_property_ui_range(prop, 0, 100, 1, 3);
+ RNA_def_property_ui_text(prop, "Normal", "Let the surface normal give the particle a starting velocity");
+ RNA_def_property_update(prop, 0, "rna_Particle_reset");
+
+ prop = RNA_def_property(srna, "object_factor", PROP_FLOAT, PROP_NONE);
+ RNA_def_property_float_sdna(prop, NULL, "obfac");
+ RNA_def_property_range(prop, -200.0f, 200.0f);
+ RNA_def_property_ui_range(prop, -1.0f, 1.0f, 0.1, 3);
+ RNA_def_property_ui_text(prop, "Object", "Let the object give the particle a starting velocity");
+ RNA_def_property_update(prop, 0, "rna_Particle_reset");
+
+ prop = RNA_def_property(srna, "factor_random", PROP_FLOAT, PROP_NONE);
+ RNA_def_property_float_sdna(prop, NULL, "randfac"); /*optional if prop names are the same */
+ RNA_def_property_range(prop, 0.0f, 200.0f);
+ RNA_def_property_ui_range(prop, 0, 100, 1, 3);
+ RNA_def_property_ui_text(prop, "Random", "Give the starting velocity a random variation");
+ RNA_def_property_update(prop, 0, "rna_Particle_reset");
+
+ prop = RNA_def_property(srna, "particle_factor", PROP_FLOAT, PROP_NONE);
+ RNA_def_property_float_sdna(prop, NULL, "partfac");
+ RNA_def_property_range(prop, -200.0f, 200.0f);
+ RNA_def_property_ui_range(prop, -1.0f, 1.0f, 0.1, 3);
+ RNA_def_property_ui_text(prop, "Particle", "Let the target particle give the particle a starting velocity");
+ RNA_def_property_update(prop, 0, "rna_Particle_reset");
+
+ prop = RNA_def_property(srna, "tangent_factor", PROP_FLOAT, PROP_NONE);
+ RNA_def_property_float_sdna(prop, NULL, "tanfac");
+ RNA_def_property_range(prop, -1000.0f, 1000.0f);
+ RNA_def_property_ui_range(prop, -100, 100, 1, 2);
+ RNA_def_property_ui_text(prop, "Tangent", "Let the surface tangent give the particle a starting velocity");
+ RNA_def_property_update(prop, 0, "rna_Particle_reset");
+
+ prop = RNA_def_property(srna, "tangent_phase", PROP_FLOAT, PROP_NONE);
+ RNA_def_property_float_sdna(prop, NULL, "tanphase");
+ RNA_def_property_range(prop, -1.0f, 1.0f);
+ RNA_def_property_ui_text(prop, "Rot", "Rotate the surface tangent");
+ RNA_def_property_update(prop, 0, "rna_Particle_reset");
+
+ prop = RNA_def_property(srna, "reactor_factor", PROP_FLOAT, PROP_NONE);
+ RNA_def_property_float_sdna(prop, NULL, "reactfac");
+ RNA_def_property_range(prop, -10.0f, 10.0f);
+ RNA_def_property_ui_text(prop, "Reactor",
+ "Let the vector away from the target particle's location give the particle "
+ "a starting velocity");
+ RNA_def_property_update(prop, 0, "rna_Particle_reset");
+
+ prop = RNA_def_property(srna, "object_align_factor", PROP_FLOAT, PROP_VELOCITY);
+ RNA_def_property_float_sdna(prop, NULL, "ob_vel");
+ RNA_def_property_array(prop, 3);
+ RNA_def_property_range(prop, -200.0f, 200.0f);
+ RNA_def_property_ui_range(prop, -100, 100, 1, 3);
+ RNA_def_property_ui_text(prop, "Object Aligned",
+ "Let the emitter object orientation give the particle a starting velocity");
+ RNA_def_property_update(prop, 0, "rna_Particle_reset");
+
+ prop = RNA_def_property(srna, "angular_velocity_factor", PROP_FLOAT, PROP_NONE);
+ RNA_def_property_float_sdna(prop, NULL, "avefac");
+ RNA_def_property_range(prop, -200.0f, 200.0f);
+ RNA_def_property_ui_range(prop, -100, 100, 10, 3);
+ RNA_def_property_ui_text(prop, "Angular Velocity", "Angular velocity amount (in radians per second)");
+ RNA_def_property_update(prop, 0, "rna_Particle_reset");
+
+ prop = RNA_def_property(srna, "phase_factor", PROP_FLOAT, PROP_NONE);
+ RNA_def_property_float_sdna(prop, NULL, "phasefac");
+ RNA_def_property_range(prop, -1.0f, 1.0f);
+ RNA_def_property_ui_text(prop, "Phase", "Rotation around the chosen orientation axis");
+ RNA_def_property_update(prop, 0, "rna_Particle_reset");
+
+ prop = RNA_def_property(srna, "rotation_factor_random", PROP_FLOAT, PROP_NONE);
+ RNA_def_property_float_sdna(prop, NULL, "randrotfac");
+ RNA_def_property_range(prop, 0.0f, 1.0f);
+ RNA_def_property_ui_text(prop, "Random Orientation", "Randomize particle orientation");
+ RNA_def_property_update(prop, 0, "rna_Particle_reset");
+
+ prop = RNA_def_property(srna, "phase_factor_random", PROP_FLOAT, PROP_NONE);
+ RNA_def_property_float_sdna(prop, NULL, "randphasefac");
+ RNA_def_property_range(prop, 0.0f, 2.0f);
+ RNA_def_property_ui_text(prop, "Random Phase", "Randomize rotation around the chosen orientation axis");
+ 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.00000001f, 100000.0f);
+ RNA_def_property_ui_range(prop, 0.01, 100, 1, 3);
+ RNA_def_property_ui_text(prop, "Mass", "Mass of the particles");
+ RNA_def_property_update(prop, 0, "rna_Particle_reset");
+
+ prop = RNA_def_property(srna, "particle_size", PROP_FLOAT, PROP_NONE);
+ RNA_def_property_float_sdna(prop, NULL, "size");
+ RNA_def_property_range(prop, 0.001f, 100000.0f);
+ RNA_def_property_ui_range(prop, 0.01, 100, 1, 3);
+ RNA_def_property_ui_text(prop, "Size", "The size of the particles");
+ RNA_def_property_update(prop, 0, "rna_Particle_reset");
+
+ prop = RNA_def_property(srna, "size_random", PROP_FLOAT, PROP_NONE);
+ RNA_def_property_float_sdna(prop, NULL, "randsize");
+ RNA_def_property_range(prop, 0.0f, 1.0f);
+ RNA_def_property_ui_text(prop, "Random Size", "Give the particle size a random variation");
+ RNA_def_property_update(prop, 0, "rna_Particle_reset");
+
+ prop = RNA_def_property(srna, "collision_group", PROP_POINTER, PROP_NONE);
+ RNA_def_property_flag(prop, PROP_EDITABLE);
+ RNA_def_property_ui_text(prop, "Collision Group", "Limit colliders to this Group");
+ RNA_def_property_update(prop, 0, "rna_Particle_reset_dependency");
+
+ /* global physical properties */
+ prop = RNA_def_property(srna, "drag_factor", PROP_FLOAT, PROP_NONE);
+ RNA_def_property_float_sdna(prop, NULL, "dragfac");
+ RNA_def_property_range(prop, 0.0f, 1.0f);
+ RNA_def_property_ui_text(prop, "Drag", "Amount of air-drag");
+ RNA_def_property_update(prop, 0, "rna_Particle_reset");
+
+ prop = RNA_def_property(srna, "brownian_factor", PROP_FLOAT, PROP_NONE);
+ RNA_def_property_float_sdna(prop, NULL, "brownfac");
+ RNA_def_property_range(prop, 0.0f, 200.0f);
+ RNA_def_property_ui_range(prop, 0, 20, 1, 3);
+ RNA_def_property_ui_text(prop, "Brownian", "Amount of random, erratic particle movement");
+ RNA_def_property_update(prop, 0, "rna_Particle_reset");
+
+ prop = RNA_def_property(srna, "damping", PROP_FLOAT, PROP_NONE);
+ RNA_def_property_float_sdna(prop, NULL, "dampfac");
+ RNA_def_property_range(prop, 0.0f, 1.0f);
+ RNA_def_property_ui_text(prop, "Damp", "Amount of damping");
+ RNA_def_property_update(prop, 0, "rna_Particle_reset");
+
+ /* random length */
+ prop = RNA_def_property(srna, "length_random", PROP_FLOAT, PROP_NONE);
+ RNA_def_property_float_sdna(prop, NULL, "randlength");
+ RNA_def_property_range(prop, 0.0f, 1.0f);
+ RNA_def_property_ui_text(prop, "Random Length", "Give path length a random variation");
+ RNA_def_property_update(prop, 0, "rna_Particle_redo");
+
+ /* children */
+ prop = RNA_def_property(srna, "child_nbr", PROP_INT, PROP_NONE);
+ RNA_def_property_int_sdna(prop, NULL, "child_nbr"); /*optional if prop names are the same */
+ RNA_def_property_range(prop, 0, 100000);
+ RNA_def_property_ui_range(prop, 0, 1000, 1, -1);
+ RNA_def_property_ui_text(prop, "Children Per Parent", "Number of children/parent");
+ RNA_def_property_update(prop, 0, "rna_Particle_redo_child");
+
+ prop = RNA_def_property(srna, "rendered_child_count", PROP_INT, PROP_NONE);
+ RNA_def_property_int_sdna(prop, NULL, "ren_child_nbr");
+ RNA_def_property_range(prop, 0, 100000);
+ RNA_def_property_ui_range(prop, 0, 10000, 1, -1);
+ RNA_def_property_ui_text(prop, "Rendered Children", "Number of children/parent for rendering");
+
+ prop = RNA_def_property(srna, "virtual_parents", PROP_FLOAT, PROP_NONE);
+ RNA_def_property_float_sdna(prop, NULL, "parents");
+ RNA_def_property_range(prop, 0.0f, 1.0f);
+ RNA_def_property_ui_text(prop, "Virtual Parents", "Relative amount of virtual parents");
+ RNA_def_property_update(prop, 0, "rna_Particle_redo_child");
+
+ prop = RNA_def_property(srna, "child_size", PROP_FLOAT, PROP_NONE);
+ RNA_def_property_float_sdna(prop, NULL, "childsize");
+ RNA_def_property_range(prop, 0.001f, 100000.0f);
+ RNA_def_property_ui_range(prop, 0.01f, 100.0f, 0.1, 3);
+ RNA_def_property_ui_text(prop, "Child Size", "A multiplier for the child particle size");
+ RNA_def_property_update(prop, 0, "rna_Particle_redo_child");
+
+ prop = RNA_def_property(srna, "child_size_random", PROP_FLOAT, PROP_NONE);
+ RNA_def_property_float_sdna(prop, NULL, "childrandsize");
+ RNA_def_property_range(prop, 0.0f, 1.0f);
+ RNA_def_property_ui_text(prop, "Random Child Size", "Random variation to the size of the child particles");
+ RNA_def_property_update(prop, 0, "rna_Particle_redo_child");
+
+ prop = RNA_def_property(srna, "child_radius", PROP_FLOAT, PROP_NONE);
+ RNA_def_property_float_sdna(prop, NULL, "childrad");
+ RNA_def_property_range(prop, 0.0f, 10.0f);
+ RNA_def_property_ui_text(prop, "Child Radius", "Radius of children around parent");
+ RNA_def_property_update(prop, 0, "rna_Particle_redo_child");
+
+ prop = RNA_def_property(srna, "child_roundness", PROP_FLOAT, PROP_NONE);
+ RNA_def_property_float_sdna(prop, NULL, "childflat");
+ RNA_def_property_range(prop, 0.0f, 1.0f);
+ RNA_def_property_ui_text(prop, "Child Roundness", "Roundness of children around parent");
+ RNA_def_property_update(prop, 0, "rna_Particle_redo_child");
+
+ /* clumping */
+ prop = RNA_def_property(srna, "clump_factor", PROP_FLOAT, PROP_NONE);
+ RNA_def_property_float_sdna(prop, NULL, "clumpfac");
+ RNA_def_property_range(prop, -1.0f, 1.0f);
+ RNA_def_property_ui_text(prop, "Clump", "Amount of clumping");
+ RNA_def_property_update(prop, 0, "rna_Particle_redo_child");
+
+ prop = RNA_def_property(srna, "clump_shape", PROP_FLOAT, PROP_NONE);
+ RNA_def_property_float_sdna(prop, NULL, "clumppow");
+ RNA_def_property_range(prop, -0.999f, 0.999f);
+ RNA_def_property_ui_text(prop, "Shape", "Shape of clumping");
+ RNA_def_property_update(prop, 0, "rna_Particle_redo_child");
+
+ prop = RNA_def_property(srna, "use_clump_curve", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "child_flag", PART_CHILD_USE_CLUMP_CURVE);
+ RNA_def_property_ui_text(prop, "Use Clump Curve", "Use a curve to define clump tapering");
+ RNA_def_property_update(prop, 0, "rna_ParticleSettings_use_clump_curve_update");
+
+ prop = RNA_def_property(srna, "clump_curve", PROP_POINTER, PROP_NONE);
+ RNA_def_property_pointer_sdna(prop, NULL, "clumpcurve");
+ RNA_def_property_struct_type(prop, "CurveMapping");
+ RNA_def_property_clear_flag(prop, PROP_EDITABLE);
+ RNA_def_property_ui_text(prop, "Clump Curve", "Curve defining clump tapering");
+ RNA_def_property_update(prop, 0, "rna_Particle_redo_child");
+
+ prop = RNA_def_property(srna, "use_clump_noise", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "child_flag", PART_CHILD_USE_CLUMP_NOISE);
+ RNA_def_property_ui_text(prop, "Use Clump Noise", "Create random clumps around the parent");
+ RNA_def_property_update(prop, 0, "rna_Particle_redo_child");
+
+ prop = RNA_def_property(srna, "clump_noise_size", PROP_FLOAT, PROP_NONE);
+ RNA_def_property_float_sdna(prop, NULL, "clump_noise_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 Size", "Size of clump noise");
+ 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");
+ RNA_def_property_range(prop, -100000.0f, 100000.0f);
+ RNA_def_property_ui_range(prop, -10.0f, 10.0f, 0.1, 3);
+ RNA_def_property_ui_text(prop, "Amplitude", "The amplitude of the offset");
+ RNA_def_property_update(prop, 0, "rna_Particle_redo_child");
+
+ prop = RNA_def_property(srna, "kink_amplitude_clump", PROP_FLOAT, PROP_NONE);
+ RNA_def_property_float_sdna(prop, NULL, "kink_amp_clump");
+ RNA_def_property_range(prop, 0.0f, 1.0f);
+ RNA_def_property_ui_text(prop, "Amplitude Clump", "How much clump affects kink amplitude");
+ RNA_def_property_update(prop, 0, "rna_Particle_redo_child");
+
+ prop = RNA_def_property(srna, "kink_amplitude_random", PROP_FLOAT, PROP_NONE);
+ RNA_def_property_float_sdna(prop, NULL, "kink_amp_random");
+ RNA_def_property_range(prop, 0.0f, 1.0f);
+ RNA_def_property_ui_text(prop, "Amplitude Random", "Random variation of the amplitude");
+ RNA_def_property_update(prop, 0, "rna_Particle_redo_child");
+
+ prop = RNA_def_property(srna, "kink_frequency", PROP_FLOAT, PROP_NONE);
+ RNA_def_property_float_sdna(prop, NULL, "kink_freq");
+ RNA_def_property_range(prop, -100000.0f, 100000.0f);
+ RNA_def_property_ui_range(prop, -10.0f, 10.0f, 0.1, 3);
+ RNA_def_property_ui_text(prop, "Frequency", "The frequency of the offset (1/total length)");
+ RNA_def_property_update(prop, 0, "rna_Particle_redo_child");
+
+ prop = RNA_def_property(srna, "kink_shape", PROP_FLOAT, PROP_NONE);
+ RNA_def_property_range(prop, -0.999f, 0.999f);
+ RNA_def_property_ui_text(prop, "Shape", "Adjust the offset to the beginning/end");
+ RNA_def_property_update(prop, 0, "rna_Particle_redo_child");
+
+ prop = RNA_def_property(srna, "kink_flat", PROP_FLOAT, PROP_NONE);
+ RNA_def_property_range(prop, 0.0f, 1.0f);
+ RNA_def_property_ui_text(prop, "Flatness", "How flat the hairs are");
+ RNA_def_property_update(prop, 0, "rna_Particle_redo_child");
+
+ prop = RNA_def_property(srna, "kink_extra_steps", PROP_INT, PROP_NONE);
+ RNA_def_property_range(prop, 1, INT_MAX);
+ RNA_def_property_ui_range(prop, 1, 100, 1, -1);
+ RNA_def_property_ui_text(prop, "Extra Steps", "Extra steps for resolution of special kink features");
+ RNA_def_property_update(prop, 0, "rna_Particle_redo_child");
+
+ prop = RNA_def_property(srna, "kink_axis_random", PROP_FLOAT, PROP_NONE);
+ RNA_def_property_range(prop, 0.0f, 1.0f);
+ RNA_def_property_ui_text(prop, "Axis Random", "Random variation of the orientation");
+ RNA_def_property_update(prop, 0, "rna_Particle_redo_child");
+
+ /* rough */
+ prop = RNA_def_property(srna, "roughness_1", PROP_FLOAT, PROP_NONE);
+ RNA_def_property_float_sdna(prop, NULL, "rough1");
+ RNA_def_property_range(prop, 0.0f, 100000.0f);
+ RNA_def_property_ui_range(prop, 0.0f, 10.0f, 0.1, 3);
+ RNA_def_property_ui_text(prop, "Rough1", "Amount of location dependent rough");
+ RNA_def_property_update(prop, 0, "rna_Particle_redo_child");
+
+ prop = RNA_def_property(srna, "roughness_1_size", PROP_FLOAT, PROP_NONE);
+ RNA_def_property_float_sdna(prop, NULL, "rough1_size");
+ RNA_def_property_range(prop, 0.01f, 100000.0f);
+ RNA_def_property_ui_range(prop, 0.01f, 10.0f, 0.1, 3);
+ RNA_def_property_ui_text(prop, "Size1", "Size of location dependent rough");
+ RNA_def_property_update(prop, 0, "rna_Particle_redo_child");
+
+ prop = RNA_def_property(srna, "roughness_2", PROP_FLOAT, PROP_NONE);
+ RNA_def_property_float_sdna(prop, NULL, "rough2");
+ RNA_def_property_range(prop, 0.0f, 100000.0f);
+ RNA_def_property_ui_range(prop, 0.0f, 10.0f, 0.1, 3);
+ RNA_def_property_ui_text(prop, "Rough2", "Amount of random rough");
+ RNA_def_property_update(prop, 0, "rna_Particle_redo_child");
+
+ prop = RNA_def_property(srna, "roughness_2_size", PROP_FLOAT, PROP_NONE);
+ RNA_def_property_float_sdna(prop, NULL, "rough2_size");
+ RNA_def_property_range(prop, 0.01f, 100000.0f);
+ RNA_def_property_ui_range(prop, 0.01f, 10.0f, 0.1, 3);
+ RNA_def_property_ui_text(prop, "Size2", "Size of random rough");
+ RNA_def_property_update(prop, 0, "rna_Particle_redo_child");
+
+ prop = RNA_def_property(srna, "roughness_2_threshold", PROP_FLOAT, PROP_NONE);
+ RNA_def_property_float_sdna(prop, NULL, "rough2_thres");
+ RNA_def_property_range(prop, 0.0f, 1.0f);
+ RNA_def_property_ui_text(prop, "Threshold", "Amount of particles left untouched by random rough");
+ RNA_def_property_update(prop, 0, "rna_Particle_redo_child");
+
+ prop = RNA_def_property(srna, "roughness_endpoint", PROP_FLOAT, PROP_NONE);
+ RNA_def_property_float_sdna(prop, NULL, "rough_end");
+ RNA_def_property_range(prop, 0.0f, 100000.0f);
+ RNA_def_property_ui_range(prop, 0.0f, 10.0f, 0.1, 3);
+ RNA_def_property_ui_text(prop, "Rough Endpoint", "Amount of end point rough");
+ RNA_def_property_update(prop, 0, "rna_Particle_redo_child");
+
+ prop = RNA_def_property(srna, "roughness_end_shape", PROP_FLOAT, PROP_NONE);
+ RNA_def_property_float_sdna(prop, NULL, "rough_end_shape");
+ RNA_def_property_range(prop, 0.0f, 10.0f);
+ RNA_def_property_ui_text(prop, "Shape", "Shape of end point rough");
+ RNA_def_property_update(prop, 0, "rna_Particle_redo_child");
+
+ prop = RNA_def_property(srna, "use_roughness_curve", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "child_flag", PART_CHILD_USE_ROUGH_CURVE);
+ RNA_def_property_ui_text(prop, "Use Roughness Curve", "Use a curve to define roughness");
+ RNA_def_property_update(prop, 0, "rna_ParticleSettings_use_roughness_curve_update");
+
+ prop = RNA_def_property(srna, "roughness_curve", PROP_POINTER, PROP_NONE);
+ RNA_def_property_pointer_sdna(prop, NULL, "roughcurve");
+ RNA_def_property_struct_type(prop, "CurveMapping");
+ RNA_def_property_clear_flag(prop, PROP_EDITABLE);
+ RNA_def_property_ui_text(prop, "Roughness Curve", "Curve defining roughness");
+ RNA_def_property_update(prop, 0, "rna_Particle_redo_child");
+
+ prop = RNA_def_property(srna, "child_length", PROP_FLOAT, PROP_NONE);
+ RNA_def_property_float_sdna(prop, NULL, "clength");
+ RNA_def_property_range(prop, 0.0f, 1.0f);
+ RNA_def_property_ui_text(prop, "Length", "Length of child paths");
+ RNA_def_property_update(prop, 0, "rna_Particle_redo_child");
+
+ prop = RNA_def_property(srna, "child_length_threshold", PROP_FLOAT, PROP_NONE);
+ RNA_def_property_float_sdna(prop, NULL, "clength_thres");
+ RNA_def_property_range(prop, 0.0f, 1.0f);
+ RNA_def_property_ui_text(prop, "Threshold", "Amount of particles left untouched by child path length");
+ RNA_def_property_update(prop, 0, "rna_Particle_redo_child");
+
+ /* parting */
+ prop = RNA_def_property(srna, "child_parting_factor", PROP_FLOAT, PROP_NONE);
+ RNA_def_property_float_sdna(prop, NULL, "parting_fac");
+ RNA_def_property_range(prop, 0.0f, 1.0f);
+ RNA_def_property_ui_text(prop, "Parting Factor", "Create parting in the children based on parent strands");
+ RNA_def_property_update(prop, 0, "rna_Particle_redo_child");
+
+ prop = RNA_def_property(srna, "child_parting_min", PROP_FLOAT, PROP_NONE);
+ RNA_def_property_float_sdna(prop, NULL, "parting_min");
+ RNA_def_property_range(prop, 0.0f, 180.0f);
+ RNA_def_property_ui_text(prop, "Parting Minimum",
+ "Minimum root to tip angle (tip distance/root distance for long hair)");
+ RNA_def_property_update(prop, 0, "rna_Particle_redo_child");
+
+ prop = RNA_def_property(srna, "child_parting_max", PROP_FLOAT, PROP_NONE);
+ RNA_def_property_float_sdna(prop, NULL, "parting_max");
+ RNA_def_property_range(prop, 0.0f, 180.0f);
+ RNA_def_property_ui_text(prop, "Parting Maximum",
+ "Maximum root to tip angle (tip distance/root distance for long hair)");
+ RNA_def_property_update(prop, 0, "rna_Particle_redo_child");
+
+ /* branching */
+ prop = RNA_def_property(srna, "branch_threshold", PROP_FLOAT, PROP_NONE);
+ RNA_def_property_float_sdna(prop, NULL, "branch_thres");
+ RNA_def_property_range(prop, 0.0f, 1.0f);
+ RNA_def_property_ui_text(prop, "Threshold", "Threshold of branching");
+ RNA_def_property_update(prop, 0, "rna_Particle_redo_child");
+
+ /* drawing stuff */
+ prop = RNA_def_property(srna, "line_length_tail", PROP_FLOAT, PROP_NONE);
+ RNA_def_property_float_funcs(prop, "rna_PartSetting_linelentail_get", "rna_PartSetting_linelentail_set", NULL);
+ RNA_def_property_range(prop, 0.0f, 100000.0f);
+ RNA_def_property_ui_range(prop, 0.0f, 10.0f, 0.1, 3);
+ RNA_def_property_ui_text(prop, "Tail", "Length of the line's tail");
+ RNA_def_property_update(prop, 0, "rna_Particle_redo");
+
+ prop = RNA_def_property(srna, "line_length_head", PROP_FLOAT, PROP_NONE);
+ RNA_def_property_float_funcs(prop, "rna_PartSetting_linelenhead_get", "rna_PartSetting_linelenhead_set", NULL);
+ RNA_def_property_range(prop, 0.0f, 100000.0f);
+ RNA_def_property_ui_range(prop, 0.0f, 10.0f, 0.1, 3);
+ RNA_def_property_ui_text(prop, "Head", "Length of the line's head");
+ RNA_def_property_update(prop, 0, "rna_Particle_redo");
+
+ prop = RNA_def_property(srna, "path_start", PROP_FLOAT, PROP_NONE);
+ RNA_def_property_float_sdna(prop, NULL, "path_start");
+ RNA_def_property_float_funcs(prop, NULL, NULL, "rna_PartSetting_pathstartend_range");
+ RNA_def_property_ui_text(prop, "Path Start", "Starting time of drawn path");
+ RNA_def_property_update(prop, 0, "rna_Particle_redo");
+
+ prop = RNA_def_property(srna, "path_end", PROP_FLOAT, PROP_NONE);
+ RNA_def_property_float_sdna(prop, NULL, "path_end");
+ RNA_def_property_float_funcs(prop, NULL, NULL, "rna_PartSetting_pathstartend_range");
+ RNA_def_property_ui_text(prop, "Path End", "End time of drawn path");
+ RNA_def_property_update(prop, 0, "rna_Particle_redo");
+
+ prop = RNA_def_property(srna, "trail_count", PROP_INT, PROP_NONE);
+ RNA_def_property_int_sdna(prop, NULL, "trail_count");
+ RNA_def_property_range(prop, 1, 100000);
+ RNA_def_property_ui_range(prop, 1, 100, 1, -1);
+ RNA_def_property_ui_text(prop, "Trail Count", "Number of trail particles");
+ RNA_def_property_update(prop, 0, "rna_Particle_redo");
+
+ /* keyed particles */
+ prop = RNA_def_property(srna, "keyed_loops", PROP_INT, PROP_NONE);
+ RNA_def_property_int_sdna(prop, NULL, "keyed_loops");
+ RNA_def_property_range(prop, 1.0f, 10000.0f);
+ RNA_def_property_ui_range(prop, 1.0f, 100.0f, 0.1, 3);
+ RNA_def_property_ui_text(prop, "Loop count", "Number of times the keys are looped");
+ RNA_def_property_update(prop, 0, "rna_Particle_redo");
+
+ /* modified dm support */
+ prop = RNA_def_property(srna, "use_modifier_stack", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "use_modifier_stack", 0);
+ RNA_def_property_ui_text(prop, "Use Modifier Stack", "Emit particles from mesh with modifiers applied "
+ "(must use same subsurf level for viewport and render for correct results)");
+ RNA_def_property_update(prop, 0, "rna_Particle_change_type");
+
+ /* draw objects & groups */
+ prop = RNA_def_property(srna, "dupli_group", PROP_POINTER, PROP_NONE);
+ RNA_def_property_pointer_sdna(prop, NULL, "dup_group");
+ RNA_def_property_struct_type(prop, "Group");
+ RNA_def_property_flag(prop, PROP_EDITABLE);
+ RNA_def_property_ui_text(prop, "Dupli Group", "Show Objects in this Group in place of particles");
+ RNA_def_property_update(prop, 0, "rna_Particle_redo");
+
+ prop = RNA_def_property(srna, "dupli_weights", PROP_COLLECTION, PROP_NONE);
+ RNA_def_property_collection_sdna(prop, NULL, "dupliweights", NULL);
+ RNA_def_property_struct_type(prop, "ParticleDupliWeight");
+ RNA_def_property_ui_text(prop, "Dupli Group Weights", "Weights for all of the objects in the dupli group");
+
+ prop = RNA_def_property(srna, "active_dupliweight", PROP_POINTER, PROP_NONE);
+ RNA_def_property_struct_type(prop, "ParticleDupliWeight");
+ RNA_def_property_pointer_funcs(prop, "rna_ParticleDupliWeight_active_get", NULL, NULL, NULL);
+ RNA_def_property_ui_text(prop, "Active Dupli Object", "");
+
+ prop = RNA_def_property(srna, "active_dupliweight_index", PROP_INT, PROP_UNSIGNED);
+ RNA_def_property_int_funcs(prop, "rna_ParticleDupliWeight_active_index_get",
+ "rna_ParticleDupliWeight_active_index_set",
+ "rna_ParticleDupliWeight_active_index_range");
+ RNA_def_property_ui_text(prop, "Active Dupli Object Index", "");
+
+ prop = RNA_def_property(srna, "dupli_object", PROP_POINTER, PROP_NONE);
+ RNA_def_property_pointer_sdna(prop, NULL, "dup_ob");
+ RNA_def_property_struct_type(prop, "Object");
+ RNA_def_property_flag(prop, PROP_EDITABLE);
+ RNA_def_property_ui_text(prop, "Dupli Object", "Show this Object in place of particles");
+ RNA_def_property_update(prop, 0, "rna_Particle_redo_dependency");
+
+ prop = RNA_def_property(srna, "billboard_object", PROP_POINTER, PROP_NONE);
+ RNA_def_property_pointer_sdna(prop, NULL, "bb_ob");
+ RNA_def_property_struct_type(prop, "Object");
+ RNA_def_property_flag(prop, PROP_EDITABLE);
+ RNA_def_property_ui_text(prop, "Billboard Object", "Billboards face this object (default is active camera)");
+ RNA_def_property_update(prop, 0, "rna_Particle_redo");
+
+ /* boids */
+ prop = RNA_def_property(srna, "boids", PROP_POINTER, PROP_NONE);
+ RNA_def_property_struct_type(prop, "BoidSettings");
+ RNA_def_property_clear_flag(prop, PROP_EDITABLE);
+ RNA_def_property_ui_text(prop, "Boid Settings", "");
+
+ /* Fluid particles */
+ prop = RNA_def_property(srna, "fluid", PROP_POINTER, PROP_NONE);
+ RNA_def_property_struct_type(prop, "SPHFluidSettings");
+ RNA_def_property_clear_flag(prop, PROP_EDITABLE);
+ RNA_def_property_ui_text(prop, "SPH Fluid Settings", "");
+
+ /* Effector weights */
+ prop = RNA_def_property(srna, "effector_weights", PROP_POINTER, PROP_NONE);
+ RNA_def_property_struct_type(prop, "EffectorWeights");
+ RNA_def_property_clear_flag(prop, PROP_EDITABLE);
+ RNA_def_property_ui_text(prop, "Effector Weights", "");
+
+ /* animation here? */
+ rna_def_animdata_common(srna);
+
+ prop = RNA_def_property(srna, "force_field_1", PROP_POINTER, PROP_NONE);
+ RNA_def_property_pointer_sdna(prop, NULL, "pd");
+ RNA_def_property_struct_type(prop, "FieldSettings");
+ RNA_def_property_pointer_funcs(prop, "rna_Particle_field1_get", NULL, NULL, NULL);
+ RNA_def_property_ui_text(prop, "Force Field 1", "");
+
+ prop = RNA_def_property(srna, "force_field_2", PROP_POINTER, PROP_NONE);
+ RNA_def_property_pointer_sdna(prop, NULL, "pd2");
+ RNA_def_property_struct_type(prop, "FieldSettings");
+ RNA_def_property_pointer_funcs(prop, "rna_Particle_field2_get", NULL, NULL, NULL);
+ RNA_def_property_ui_text(prop, "Force Field 2", "");
+}
+
+static void rna_def_particle_target(BlenderRNA *brna)
+{
+ StructRNA *srna;
+ PropertyRNA *prop;
+
+ static EnumPropertyItem mode_items[] = {
+ {PTARGET_MODE_FRIEND, "FRIEND", 0, "Friend", ""},
+ {PTARGET_MODE_NEUTRAL, "NEUTRAL", 0, "Neutral", ""},
+ {PTARGET_MODE_ENEMY, "ENEMY", 0, "Enemy", ""},
+ {0, NULL, 0, NULL, NULL}
+ };
+
+
+ srna = RNA_def_struct(brna, "ParticleTarget", NULL);
+ RNA_def_struct_ui_text(srna, "Particle Target", "Target particle system");
+
+ prop = RNA_def_property(srna, "name", PROP_STRING, PROP_NONE);
+ RNA_def_property_string_funcs(prop, "rna_ParticleTarget_name_get", "rna_ParticleTarget_name_length", NULL);
+ RNA_def_property_ui_text(prop, "Name", "Particle target name");
+ RNA_def_property_clear_flag(prop, PROP_EDITABLE);
+ RNA_def_struct_name_property(srna, prop);
+
+ prop = RNA_def_property(srna, "object", PROP_POINTER, PROP_NONE);
+ RNA_def_property_pointer_sdna(prop, NULL, "ob");
+ RNA_def_property_flag(prop, PROP_EDITABLE);
+ RNA_def_property_ui_text(prop, "Target Object",
+ "The object that has the target particle system (empty if same object)");
+ RNA_def_property_update(prop, 0, "rna_Particle_target_reset");
+
+ prop = RNA_def_property(srna, "system", PROP_INT, PROP_UNSIGNED);
+ RNA_def_property_int_sdna(prop, NULL, "psys");
+ RNA_def_property_range(prop, 1, INT_MAX);
+ RNA_def_property_ui_text(prop, "Target Particle System", "The index of particle system on the target object");
+ RNA_def_property_update(prop, 0, "rna_Particle_target_reset");
+
+ prop = RNA_def_property(srna, "time", PROP_FLOAT, PROP_TIME);
+ RNA_def_property_float_sdna(prop, NULL, "time");
+ RNA_def_property_range(prop, 0.0, 30000.0f); /*TODO: replace 30000 with MAXFRAMEF when available in 2.5 */
+ RNA_def_property_ui_text(prop, "Time", "");
+ RNA_def_property_update(prop, 0, "rna_Particle_target_redo");
+
+ prop = RNA_def_property(srna, "duration", PROP_FLOAT, PROP_NONE);
+ RNA_def_property_float_sdna(prop, NULL, "duration");
+ RNA_def_property_range(prop, 0.0, 30000.0f); /*TODO: replace 30000 with MAXFRAMEF when available in 2.5 */
+ RNA_def_property_ui_text(prop, "Duration", "");
+ RNA_def_property_update(prop, 0, "rna_Particle_target_redo");
+
+ prop = RNA_def_property(srna, "is_valid", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "flag", PTARGET_VALID);
+ RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
+ RNA_def_property_ui_text(prop, "Valid", "Keyed particles target is valid");
+
+ prop = RNA_def_property(srna, "alliance", PROP_ENUM, PROP_NONE);
+ RNA_def_property_enum_sdna(prop, NULL, "mode");
+ RNA_def_property_enum_items(prop, mode_items);
+ RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
+ RNA_def_property_ui_text(prop, "Mode", "");
+ RNA_def_property_update(prop, 0, "rna_Particle_target_reset");
+
+}
+static void rna_def_particle_system(BlenderRNA *brna)
+{
+ StructRNA *srna;
+ PropertyRNA *prop;
+
+ FunctionRNA *func;
+ PropertyRNA *parm;
+
+ static EnumPropertyItem resolution_items[] = {
+ {eModifierMode_Realtime, "PREVIEW", 0, "Preview", "Apply modifier preview settings"},
+ {eModifierMode_Render, "RENDER", 0, "Render", "Apply modifier render settings"},
+ {0, NULL, 0, NULL, NULL}
+ };
+
+ srna = RNA_def_struct(brna, "ParticleSystem", NULL);
+ RNA_def_struct_ui_text(srna, "Particle System", "Particle system in an object");
+ RNA_def_struct_ui_icon(srna, ICON_PARTICLE_DATA);
+
+ prop = RNA_def_property(srna, "name", PROP_STRING, PROP_NONE);
+ RNA_def_property_ui_text(prop, "Name", "Particle system name");
+ RNA_def_property_update(prop, NC_OBJECT | ND_MODIFIER | NA_RENAME, NULL);
+ RNA_def_property_string_funcs(prop, NULL, NULL, "rna_ParticleSystem_name_set");
+ RNA_def_struct_name_property(srna, prop);
+
+ /* access to particle settings is redirected through functions */
+ /* to allow proper id-buttons functionality */
+ prop = RNA_def_property(srna, "settings", PROP_POINTER, PROP_NONE);
+ /*RNA_def_property_pointer_sdna(prop, NULL, "part"); */
+ RNA_def_property_struct_type(prop, "ParticleSettings");
+ RNA_def_property_flag(prop, PROP_EDITABLE | PROP_NEVER_NULL);
+ RNA_def_property_pointer_funcs(prop, "rna_particle_settings_get", "rna_particle_settings_set", NULL, NULL);
+ RNA_def_property_ui_text(prop, "Settings", "Particle system settings");
+ RNA_def_property_update(prop, 0, "rna_Particle_reset");
+
+ prop = RNA_def_property(srna, "particles", PROP_COLLECTION, PROP_NONE);
+ RNA_def_property_collection_sdna(prop, NULL, "particles", "totpart");
+ RNA_def_property_struct_type(prop, "Particle");
+ RNA_def_property_ui_text(prop, "Particles", "Particles generated by the particle system");
+
+ prop = RNA_def_property(srna, "child_particles", PROP_COLLECTION, PROP_NONE);
+ RNA_def_property_collection_sdna(prop, NULL, "child", "totchild");
+ RNA_def_property_struct_type(prop, "ChildParticle");
+ RNA_def_property_ui_text(prop, "Child Particles", "Child particles generated by the particle system");
+
+ prop = RNA_def_property(srna, "seed", PROP_INT, PROP_UNSIGNED);
+ RNA_def_property_ui_text(prop, "Seed", "Offset in the random number table, to get a different randomized result");
+ RNA_def_property_update(prop, 0, "rna_Particle_reset");
+
+ prop = RNA_def_property(srna, "child_seed", PROP_INT, PROP_UNSIGNED);
+ RNA_def_property_ui_text(prop, "Child Seed",
+ "Offset in the random number table for child particles, to get a different "
+ "randomized result");
+ RNA_def_property_update(prop, 0, "rna_Particle_redo_child");
+
+ /* hair */
+ prop = RNA_def_property(srna, "is_global_hair", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "flag", PSYS_GLOBAL_HAIR);
+ RNA_def_property_clear_flag(prop, PROP_EDITABLE);
+ RNA_def_property_ui_text(prop, "Global Hair", "Hair keys are in global coordinate space");
+
+ prop = RNA_def_property(srna, "use_hair_dynamics", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "flag", PSYS_HAIR_DYNAMICS);
+ 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, "cloth", PROP_POINTER, PROP_NONE);
+ RNA_def_property_pointer_sdna(prop, NULL, "clmd");
+ RNA_def_property_struct_type(prop, "ClothModifier");
+ RNA_def_property_flag(prop, PROP_NEVER_NULL);
+ RNA_def_property_clear_flag(prop, PROP_EDITABLE);
+ RNA_def_property_ui_text(prop, "Cloth", "Cloth dynamics for hair");
+
+ /* reactor */
+ prop = RNA_def_property(srna, "reactor_target_object", PROP_POINTER, PROP_NONE);
+ RNA_def_property_pointer_sdna(prop, NULL, "target_ob");
+ RNA_def_property_flag(prop, PROP_EDITABLE);
+ RNA_def_property_ui_text(prop, "Reactor Target Object",
+ "For reactor systems, the object that has the target particle system "
+ "(empty if same object)");
+ RNA_def_property_update(prop, 0, "rna_Particle_reset");
+
+ prop = RNA_def_property(srna, "reactor_target_particle_system", PROP_INT, PROP_UNSIGNED);
+ RNA_def_property_int_sdna(prop, NULL, "target_psys");
+ RNA_def_property_range(prop, 1, SHRT_MAX);
+ RNA_def_property_ui_text(prop, "Reactor Target Particle System",
+ "For reactor systems, index of particle system on the target object");
+ RNA_def_property_update(prop, 0, "rna_Particle_reset");
+
+ /* keyed */
+ prop = RNA_def_property(srna, "use_keyed_timing", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "flag", PSYS_KEYED_TIMING);
+ RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
+ RNA_def_property_ui_text(prop, "Keyed timing", "Use key times");
+ RNA_def_property_update(prop, 0, "rna_Particle_redo");
+
+ prop = RNA_def_property(srna, "targets", PROP_COLLECTION, PROP_NONE);
+ RNA_def_property_struct_type(prop, "ParticleTarget");
+ RNA_def_property_ui_text(prop, "Targets", "Target particle systems");
+
+ prop = RNA_def_property(srna, "active_particle_target", PROP_POINTER, PROP_NONE);
+ RNA_def_property_struct_type(prop, "ParticleTarget");
+ RNA_def_property_pointer_funcs(prop, "rna_ParticleSystem_active_particle_target_get", NULL, NULL, NULL);
+ RNA_def_property_ui_text(prop, "Active Particle Target", "");
+
+ prop = RNA_def_property(srna, "active_particle_target_index", PROP_INT, PROP_UNSIGNED);
+ RNA_def_property_int_funcs(prop, "rna_ParticleSystem_active_particle_target_index_get",
+ "rna_ParticleSystem_active_particle_target_index_set",
+ "rna_ParticleSystem_active_particle_target_index_range");
+ RNA_def_property_ui_text(prop, "Active Particle Target Index", "");
+
+ /* billboard */
+ prop = RNA_def_property(srna, "billboard_normal_uv", PROP_STRING, PROP_NONE);
+ RNA_def_property_string_sdna(prop, NULL, "bb_uvname[0]");
+ RNA_def_property_string_maxlength(prop, 32);
+ RNA_def_property_ui_text(prop, "Billboard Normal UV", "UV map to control billboard normals");
+
+ prop = RNA_def_property(srna, "billboard_time_index_uv", PROP_STRING, PROP_NONE);
+ RNA_def_property_string_sdna(prop, NULL, "bb_uvname[1]");
+ RNA_def_property_string_maxlength(prop, 32);
+ RNA_def_property_ui_text(prop, "Billboard Time Index UV", "UV map to control billboard time index (X-Y)");
+
+ prop = RNA_def_property(srna, "billboard_split_uv", PROP_STRING, PROP_NONE);
+ RNA_def_property_string_sdna(prop, NULL, "bb_uvname[2]");
+ RNA_def_property_string_maxlength(prop, 32);
+ RNA_def_property_ui_text(prop, "Billboard Split UV", "UV map to control billboard splitting");
+
+ /* vertex groups */
+
+ /* note, internally store as ints, access as strings */
+#if 0 /* int access. works ok but isn't useful for the UI */
+ prop = RNA_def_property(srna, "vertex_group_density", PROP_INT, PROP_NONE);
+ RNA_def_property_int_sdna(prop, NULL, "vgroup[0]");
+ RNA_def_property_ui_text(prop, "Vertex Group Density", "Vertex group to control density");
+ RNA_def_property_update(prop, 0, "rna_Particle_reset");
+#endif
+
+ prop = RNA_def_property(srna, "vertex_group_density", PROP_STRING, PROP_NONE);
+ RNA_def_property_string_funcs(prop, "rna_ParticleVGroup_name_get_0", "rna_ParticleVGroup_name_len_0",
+ "rna_ParticleVGroup_name_set_0");
+ RNA_def_property_ui_text(prop, "Vertex Group Density", "Vertex group to control density");
+ RNA_def_property_update(prop, 0, "rna_Particle_reset");
+
+ prop = RNA_def_property(srna, "invert_vertex_group_density", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "vg_neg", (1 << PSYS_VG_DENSITY));
+ RNA_def_property_ui_text(prop, "Vertex Group Density Negate", "Negate the effect of the density vertex group");
+ RNA_def_property_update(prop, 0, "rna_Particle_reset");
+
+ prop = RNA_def_property(srna, "vertex_group_velocity", PROP_STRING, PROP_NONE);
+ RNA_def_property_string_funcs(prop, "rna_ParticleVGroup_name_get_1", "rna_ParticleVGroup_name_len_1",
+ "rna_ParticleVGroup_name_set_1");
+ RNA_def_property_ui_text(prop, "Vertex Group Velocity", "Vertex group to control velocity");
+ RNA_def_property_update(prop, 0, "rna_Particle_reset");
+
+ prop = RNA_def_property(srna, "invert_vertex_group_velocity", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "vg_neg", (1 << PSYS_VG_VEL));
+ RNA_def_property_ui_text(prop, "Vertex Group Velocity Negate", "Negate the effect of the velocity vertex group");
+ RNA_def_property_update(prop, 0, "rna_Particle_reset");
+
+ prop = RNA_def_property(srna, "vertex_group_length", PROP_STRING, PROP_NONE);
+ RNA_def_property_string_funcs(prop, "rna_ParticleVGroup_name_get_2", "rna_ParticleVGroup_name_len_2",
+ "rna_ParticleVGroup_name_set_2");
+ RNA_def_property_ui_text(prop, "Vertex Group Length", "Vertex group to control length");
+ RNA_def_property_update(prop, 0, "rna_Particle_redo");
+
+ prop = RNA_def_property(srna, "invert_vertex_group_length", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "vg_neg", (1 << PSYS_VG_LENGTH));
+ RNA_def_property_ui_text(prop, "Vertex Group Length Negate", "Negate the effect of the length vertex group");
+ RNA_def_property_update(prop, 0, "rna_Particle_redo");
+
+ prop = RNA_def_property(srna, "vertex_group_clump", PROP_STRING, PROP_NONE);
+ RNA_def_property_string_funcs(prop, "rna_ParticleVGroup_name_get_3", "rna_ParticleVGroup_name_len_3",
+ "rna_ParticleVGroup_name_set_3");
+ RNA_def_property_ui_text(prop, "Vertex Group Clump", "Vertex group to control clump");
+ RNA_def_property_update(prop, 0, "rna_Particle_redo_child");
+
+ prop = RNA_def_property(srna, "invert_vertex_group_clump", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "vg_neg", (1 << PSYS_VG_CLUMP));
+ RNA_def_property_ui_text(prop, "Vertex Group Clump Negate", "Negate the effect of the clump vertex group");
+ RNA_def_property_update(prop, 0, "rna_Particle_redo_child");
+
+ prop = RNA_def_property(srna, "vertex_group_kink", PROP_STRING, PROP_NONE);
+ RNA_def_property_string_funcs(prop, "rna_ParticleVGroup_name_get_4", "rna_ParticleVGroup_name_len_4",
+ "rna_ParticleVGroup_name_set_4");
+ RNA_def_property_ui_text(prop, "Vertex Group Kink", "Vertex group to control kink");
+ RNA_def_property_update(prop, 0, "rna_Particle_redo_child");
+
+ prop = RNA_def_property(srna, "invert_vertex_group_kink", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "vg_neg", (1 << PSYS_VG_KINK));
+ RNA_def_property_ui_text(prop, "Vertex Group Kink Negate", "Negate the effect of the kink vertex group");
+ RNA_def_property_update(prop, 0, "rna_Particle_redo_child");
+
+ prop = RNA_def_property(srna, "vertex_group_roughness_1", PROP_STRING, PROP_NONE);
+ RNA_def_property_string_funcs(prop, "rna_ParticleVGroup_name_get_5", "rna_ParticleVGroup_name_len_5",
+ "rna_ParticleVGroup_name_set_5");
+ RNA_def_property_ui_text(prop, "Vertex Group Roughness 1", "Vertex group to control roughness 1");
+ RNA_def_property_update(prop, 0, "rna_Particle_redo_child");
+
+ prop = RNA_def_property(srna, "invert_vertex_group_roughness_1", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "vg_neg", (1 << PSYS_VG_ROUGH1));
+ RNA_def_property_ui_text(prop, "Vertex Group Roughness 1 Negate",
+ "Negate the effect of the roughness 1 vertex group");
+ RNA_def_property_update(prop, 0, "rna_Particle_redo_child");
+
+ prop = RNA_def_property(srna, "vertex_group_roughness_2", PROP_STRING, PROP_NONE);
+ RNA_def_property_string_funcs(prop, "rna_ParticleVGroup_name_get_6", "rna_ParticleVGroup_name_len_6",
+ "rna_ParticleVGroup_name_set_6");
+ RNA_def_property_ui_text(prop, "Vertex Group Roughness 2", "Vertex group to control roughness 2");
+ RNA_def_property_update(prop, 0, "rna_Particle_redo_child");
+
+ prop = RNA_def_property(srna, "invert_vertex_group_roughness_2", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "vg_neg", (1 << PSYS_VG_ROUGH2));
+ RNA_def_property_ui_text(prop, "Vertex Group Roughness 2 Negate",
+ "Negate the effect of the roughness 2 vertex group");
+ RNA_def_property_update(prop, 0, "rna_Particle_redo_child");
+
+ prop = RNA_def_property(srna, "vertex_group_roughness_end", PROP_STRING, PROP_NONE);
+ RNA_def_property_string_funcs(prop, "rna_ParticleVGroup_name_get_7", "rna_ParticleVGroup_name_len_7",
+ "rna_ParticleVGroup_name_set_7");
+ RNA_def_property_ui_text(prop, "Vertex Group Roughness End", "Vertex group to control roughness end");
+ RNA_def_property_update(prop, 0, "rna_Particle_redo_child");
+
+ prop = RNA_def_property(srna, "invert_vertex_group_roughness_end", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "vg_neg", (1 << PSYS_VG_ROUGHE));
+ RNA_def_property_ui_text(prop, "Vertex Group Roughness End Negate",
+ "Negate the effect of the roughness end vertex group");
+ RNA_def_property_update(prop, 0, "rna_Particle_redo_child");
+
+ prop = RNA_def_property(srna, "vertex_group_size", PROP_STRING, PROP_NONE);
+ RNA_def_property_string_funcs(prop, "rna_ParticleVGroup_name_get_8", "rna_ParticleVGroup_name_len_8",
+ "rna_ParticleVGroup_name_set_8");
+ RNA_def_property_ui_text(prop, "Vertex Group Size", "Vertex group to control size");
+ RNA_def_property_update(prop, 0, "rna_Particle_reset");
+
+ prop = RNA_def_property(srna, "invert_vertex_group_size", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "vg_neg", (1 << PSYS_VG_SIZE));
+ RNA_def_property_ui_text(prop, "Vertex Group Size Negate", "Negate the effect of the size vertex group");
+ RNA_def_property_update(prop, 0, "rna_Particle_reset");
+
+ prop = RNA_def_property(srna, "vertex_group_tangent", PROP_STRING, PROP_NONE);
+ RNA_def_property_string_funcs(prop, "rna_ParticleVGroup_name_get_9", "rna_ParticleVGroup_name_len_9",
+ "rna_ParticleVGroup_name_set_9");
+ RNA_def_property_ui_text(prop, "Vertex Group Tangent", "Vertex group to control tangent");
+ RNA_def_property_update(prop, 0, "rna_Particle_reset");
+
+ prop = RNA_def_property(srna, "invert_vertex_group_tangent", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "vg_neg", (1 << PSYS_VG_TAN));
+ RNA_def_property_ui_text(prop, "Vertex Group Tangent Negate", "Negate the effect of the tangent vertex group");
+ RNA_def_property_update(prop, 0, "rna_Particle_reset");
+
+ prop = RNA_def_property(srna, "vertex_group_rotation", PROP_STRING, PROP_NONE);
+ RNA_def_property_string_funcs(prop, "rna_ParticleVGroup_name_get_10", "rna_ParticleVGroup_name_len_10",
+ "rna_ParticleVGroup_name_set_10");
+ RNA_def_property_ui_text(prop, "Vertex Group Rotation", "Vertex group to control rotation");
+ RNA_def_property_update(prop, 0, "rna_Particle_reset");
+
+ prop = RNA_def_property(srna, "invert_vertex_group_rotation", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "vg_neg", (1 << PSYS_VG_ROT));
+ RNA_def_property_ui_text(prop, "Vertex Group Rotation Negate", "Negate the effect of the rotation vertex group");
+ RNA_def_property_update(prop, 0, "rna_Particle_reset");
+
+ prop = RNA_def_property(srna, "vertex_group_field", PROP_STRING, PROP_NONE);
+ RNA_def_property_string_funcs(prop, "rna_ParticleVGroup_name_get_11", "rna_ParticleVGroup_name_len_11",
+ "rna_ParticleVGroup_name_set_11");
+ RNA_def_property_ui_text(prop, "Vertex Group Field", "Vertex group to control field");
+ RNA_def_property_update(prop, 0, "rna_Particle_reset");
+
+ prop = RNA_def_property(srna, "invert_vertex_group_field", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "vg_neg", (1 << PSYS_VG_EFFECTOR));
+ RNA_def_property_ui_text(prop, "Vertex Group Field Negate", "Negate the effect of the field vertex group");
+ RNA_def_property_update(prop, 0, "rna_Particle_reset");
+
+ /* pointcache */
+ prop = RNA_def_property(srna, "point_cache", PROP_POINTER, PROP_NONE);
+ RNA_def_property_flag(prop, PROP_NEVER_NULL);
+ RNA_def_property_pointer_sdna(prop, NULL, "pointcache");
+ RNA_def_property_struct_type(prop, "PointCache");
+ RNA_def_property_ui_text(prop, "Point Cache", "");
+
+ prop = RNA_def_property(srna, "has_multiple_caches", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_funcs(prop, "rna_ParticleSystem_multiple_caches_get", NULL);
+ RNA_def_property_clear_flag(prop, PROP_EDITABLE);
+ RNA_def_property_ui_text(prop, "Multiple Caches", "Particle system has multiple point caches");
+
+ /* offset ob */
+ prop = RNA_def_property(srna, "parent", PROP_POINTER, PROP_NONE);
+ RNA_def_property_pointer_sdna(prop, NULL, "parent");
+ RNA_def_property_flag(prop, PROP_EDITABLE);
+ RNA_def_property_ui_text(prop, "Parent",
+ "Use this object's coordinate system instead of global coordinate system");
+ RNA_def_property_update(prop, 0, "rna_Particle_redo");
+
+ /* hair or cache editing */
+ prop = RNA_def_property(srna, "is_editable", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_funcs(prop, "rna_ParticleSystem_editable_get", NULL);
+ RNA_def_property_clear_flag(prop, PROP_EDITABLE);
+ RNA_def_property_ui_text(prop, "Editable", "Particle system can be edited in particle mode");
+
+ prop = RNA_def_property(srna, "is_edited", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_funcs(prop, "rna_ParticleSystem_edited_get", NULL);
+ RNA_def_property_clear_flag(prop, PROP_EDITABLE);
+ RNA_def_property_ui_text(prop, "Edited", "Particle system has been edited in particle mode");
+
+ /* Read-only: this is calculated internally. Changing it would only affect
+ * the next time-step. The user should change ParticlSettings.subframes or
+ * ParticleSettings.courant_target instead. */
+ prop = RNA_def_property(srna, "dt_frac", PROP_FLOAT, PROP_NONE);
+ RNA_def_property_range(prop, 1.0f / 101.0f, 1.0f);
+ RNA_def_property_ui_text(prop, "Timestep", "The current simulation time step size, as a fraction of a frame");
+ RNA_def_property_clear_flag(prop, PROP_EDITABLE);
+
+ RNA_def_struct_path_func(srna, "rna_ParticleSystem_path");
+
+ /* set viewport or render resolution */
+ func = RNA_def_function(srna, "set_resolution", "rna_ParticleSystem_set_resolution");
+ RNA_def_function_ui_description(func, "Set the resolution to use for the number of particles");
+ RNA_def_pointer(func, "scene", "Scene", "", "Scene");
+ RNA_def_pointer(func, "object", "Object", "", "Object");
+ RNA_def_enum(func, "resolution", resolution_items, 0, "", "Resolution settings to apply");
+
+ /* extract cached hair location data */
+ func = RNA_def_function(srna, "co_hair", "rna_ParticleSystem_co_hair");
+ RNA_def_function_ui_description(func, "Obtain cache hair data");
+ parm = RNA_def_pointer(func, "object", "Object", "", "Object");
+ RNA_def_parameter_flags(parm, PROP_NEVER_NULL, PARM_REQUIRED);
+ RNA_def_int(func, "particle_no", 0, INT_MIN, INT_MAX, "Particle no", "", INT_MIN, INT_MAX);
+ RNA_def_int(func, "step", 0, INT_MIN, INT_MAX, "step no", "", INT_MIN, INT_MAX);
+ parm = RNA_def_float_vector(func, "co", 3, NULL, -FLT_MAX, FLT_MAX, "Co",
+ "Exported hairkey location", -1e4, 1e4);
+ RNA_def_parameter_flags(parm, PROP_THICK_WRAP, 0);
+ RNA_def_function_output(func, parm);
+
+ /* extract hair UVs */
+ func = RNA_def_function(srna, "uv_on_emitter", "rna_ParticleSystem_uv_on_emitter");
+ RNA_def_function_ui_description(func, "Obtain uv for all particles");
+ RNA_def_function_flag(func, FUNC_USE_REPORTS);
+ parm = RNA_def_pointer(func, "modifier", "ParticleSystemModifier", "", "Particle modifier");
+ RNA_def_parameter_flags(parm, PROP_NEVER_NULL, PARM_REQUIRED);
+ prop = RNA_def_pointer(func, "particle", "Particle", "", "Particle");
+ RNA_def_parameter_flags(parm, PROP_NEVER_NULL, PARM_REQUIRED);
+ RNA_def_int(func, "particle_no", 0, INT_MIN, INT_MAX, "Particle no", "", INT_MIN, INT_MAX);
+ RNA_def_int(func, "uv_no", 0, INT_MIN, INT_MAX, "UV no", "", INT_MIN, INT_MAX);
+ parm = RNA_def_property(func, "uv", PROP_FLOAT, PROP_COORDS);
+ RNA_def_property_array(parm, 2);
+ RNA_def_parameter_flags(parm, PROP_THICK_WRAP, 0);
+ RNA_def_function_output(func, parm);
+
+ /* extract hair mcols */
+ func = RNA_def_function(srna, "mcol_on_emitter", "rna_ParticleSystem_mcol_on_emitter");
+ RNA_def_function_flag(func, FUNC_USE_REPORTS);
+ RNA_def_function_ui_description(func, "Obtain mcol for all particles");
+ parm = RNA_def_pointer(func, "modifier", "ParticleSystemModifier", "", "Particle modifier");
+ RNA_def_parameter_flags(parm, PROP_NEVER_NULL, PARM_REQUIRED);
+ parm = RNA_def_pointer(func, "particle", "Particle", "", "Particle");
+ RNA_def_parameter_flags(parm, PROP_NEVER_NULL, PARM_REQUIRED);
+ RNA_def_int(func, "particle_no", 0, INT_MIN, INT_MAX, "Particle no", "", INT_MIN, INT_MAX);
+ RNA_def_int(func, "vcol_no", 0, INT_MIN, INT_MAX, "vcol no", "", INT_MIN, INT_MAX);
+ parm = RNA_def_property(func, "mcol", PROP_FLOAT, PROP_COLOR);
+ RNA_def_property_array(parm, 3);
+ RNA_def_parameter_flags(parm, PROP_THICK_WRAP, 0);
+ RNA_def_function_output(func, parm);
+
+}
+
+void RNA_def_particle(BlenderRNA *brna)
+{
+ rna_def_particle_target(brna);
+ rna_def_fluid_settings(brna);
+ rna_def_particle_hair_key(brna);
+ rna_def_particle_key(brna);
+
+ rna_def_child_particle(brna);
+ rna_def_particle(brna);
+ rna_def_particle_dupliweight(brna);
+ rna_def_particle_system(brna);
+ rna_def_particle_settings_mtex(brna);
+ rna_def_particle_settings(brna);
+}
+
+#endif
diff --git a/source/blender/makesrna/intern/rna_rigidbody.c b/source/blender/makesrna/intern/rna_rigidbody.c
index be835238911..a1a7efdaba5 100644
--- a/source/blender/makesrna/intern/rna_rigidbody.c
+++ b/source/blender/makesrna/intern/rna_rigidbody.c
@@ -109,7 +109,8 @@ static EnumPropertyItem rigidbody_mesh_source_items[] = {
static void rna_RigidBodyWorld_reset(Main *UNUSED(bmain), Scene *UNUSED(scene), PointerRNA *ptr)
{
RigidBodyWorld *rbw = (RigidBodyWorld *)ptr->data;
- UNUSED_VARS(rbw);
+
+ BKE_rigidbody_cache_reset(rbw);
}
static char *rna_RigidBodyWorld_path(PointerRNA *UNUSED(ptr))
@@ -148,10 +149,10 @@ static void rna_RigidBodyWorld_split_impulse_set(PointerRNA *ptr, int value)
static void rna_RigidBodyOb_reset(Main *UNUSED(bmain), Scene *scene, PointerRNA *UNUSED(ptr))
{
RigidBodyWorld *rbw = scene->rigidbody_world;
- UNUSED_VARS(rbw);
+
+ BKE_rigidbody_cache_reset(rbw);
}
-
static void rna_RigidBodyOb_shape_update(Main *bmain, Scene *scene, PointerRNA *ptr)
{
Object *ob = ptr->id.data;
@@ -161,10 +162,12 @@ static void rna_RigidBodyOb_shape_update(Main *bmain, Scene *scene, PointerRNA *
WM_main_add_notifier(NC_OBJECT | ND_DRAW, ob);
}
-static void rna_RigidBodyOb_shape_reset(Main *UNUSED(bmain), Scene *UNUSED(scene), PointerRNA *ptr)
+static void rna_RigidBodyOb_shape_reset(Main *UNUSED(bmain), Scene *scene, PointerRNA *ptr)
{
+ RigidBodyWorld *rbw = scene->rigidbody_world;
RigidBodyOb *rbo = (RigidBodyOb *)ptr->data;
+ BKE_rigidbody_cache_reset(rbw);
if (rbo->physics_shape)
rbo->flag |= RBO_FLAG_NEEDS_RESHAPE;
}
@@ -796,6 +799,12 @@ static void rna_def_rigidbody_world(BlenderRNA *brna)
"stability a little so use only when necessary)");
RNA_def_property_update(prop, NC_SCENE, "rna_RigidBodyWorld_reset");
+ /* cache */
+ prop = RNA_def_property(srna, "point_cache", PROP_POINTER, PROP_NONE);
+ RNA_def_property_flag(prop, PROP_NEVER_NULL);
+ RNA_def_property_pointer_sdna(prop, NULL, "pointcache");
+ RNA_def_property_ui_text(prop, "Point Cache", "");
+
/* effector weights */
prop = RNA_def_property(srna, "effector_weights", PROP_POINTER, PROP_NONE);
RNA_def_property_struct_type(prop, "EffectorWeights");
diff --git a/source/blender/makesrna/intern/rna_scene.c b/source/blender/makesrna/intern/rna_scene.c
index b4201dd296e..ddfb5dc6d61 100644
--- a/source/blender/makesrna/intern/rna_scene.c
+++ b/source/blender/makesrna/intern/rna_scene.c
@@ -29,6 +29,7 @@
#include "DNA_brush_types.h"
#include "DNA_group_types.h"
#include "DNA_modifier_types.h"
+#include "DNA_particle_types.h"
#include "DNA_rigidbody_types.h"
#include "DNA_scene_types.h"
#include "DNA_linestyle_types.h"
@@ -423,6 +424,7 @@ EnumPropertyItem rna_enum_bake_pass_filter_type_items[] = {
#include "BKE_image.h"
#include "BKE_main.h"
#include "BKE_node.h"
+#include "BKE_pointcache.h"
#include "BKE_scene.h"
#include "BKE_depsgraph.h"
#include "BKE_mesh.h"
@@ -1652,6 +1654,15 @@ static void rna_Scene_use_nodes_update(bContext *C, PointerRNA *ptr)
ED_node_composit_default(C, scene);
}
+static void rna_Physics_update(Main *UNUSED(bmain), Scene *UNUSED(scene), PointerRNA *ptr)
+{
+ Scene *scene = (Scene *)ptr->id.data;
+ Base *base;
+
+ for (base = scene->base.first; base; base = base->next)
+ BKE_ptcache_object_reset(scene, base->object, PTCACHE_RESET_DEPSGRAPH);
+}
+
static void rna_Scene_editmesh_select_mode_set(PointerRNA *ptr, const int *value)
{
Scene *scene = (Scene *)ptr->id.data;
@@ -1688,6 +1699,7 @@ static void rna_Scene_editmesh_select_mode_update(Main *UNUSED(bmain), Scene *sc
static void object_simplify_update(Object *ob)
{
ModifierData *md;
+ ParticleSystem *psys;
if ((ob->id.tag & LIB_TAG_DOIT) == 0) {
return;
@@ -1696,11 +1708,14 @@ static void object_simplify_update(Object *ob)
ob->id.tag &= ~LIB_TAG_DOIT;
for (md = ob->modifiers.first; md; md = md->next) {
- if (ELEM(md->type, eModifierType_Subsurf, eModifierType_Multires)) {
+ if (ELEM(md->type, eModifierType_Subsurf, eModifierType_Multires, eModifierType_ParticleSystem)) {
DAG_id_tag_update(&ob->id, OB_RECALC_DATA);
}
}
+ for (psys = ob->particlesystem.first; psys; psys = psys->next)
+ psys->recalc |= PSYS_RECALC_CHILD;
+
if (ob->dup_group) {
GroupObject *gob;
@@ -2470,6 +2485,10 @@ static void rna_def_tool_settings(BlenderRNA *brna)
RNA_def_property_pointer_sdna(prop, NULL, "uvsculpt");
RNA_def_property_ui_text(prop, "UV Sculpt", "");
+ prop = RNA_def_property(srna, "particle_edit", PROP_POINTER, PROP_NONE);
+ RNA_def_property_pointer_sdna(prop, NULL, "particle");
+ RNA_def_property_ui_text(prop, "Particle Edit", "");
+
prop = RNA_def_property(srna, "use_uv_sculpt", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_boolean_sdna(prop, NULL, "use_uv_sculpt", 1);
RNA_def_property_ui_text(prop, "UV Sculpt", "Enable brush for UV sculpting");
@@ -6521,12 +6540,22 @@ static void rna_def_scene_render_data(BlenderRNA *brna)
RNA_def_property_ui_text(prop, "Simplify Subdivision", "Global maximum subdivision level");
RNA_def_property_update(prop, 0, "rna_Scene_simplify_update");
+ prop = RNA_def_property(srna, "simplify_child_particles", PROP_FLOAT, PROP_FACTOR);
+ RNA_def_property_float_sdna(prop, NULL, "simplify_particles");
+ RNA_def_property_ui_text(prop, "Simplify Child Particles", "Global child particles percentage");
+ RNA_def_property_update(prop, 0, "rna_Scene_simplify_update");
+
prop = RNA_def_property(srna, "simplify_subdivision_render", PROP_INT, PROP_UNSIGNED);
RNA_def_property_int_sdna(prop, NULL, "simplify_subsurf_render");
RNA_def_property_ui_range(prop, 0, 6, 1, -1);
RNA_def_property_ui_text(prop, "Simplify Subdivision", "Global maximum subdivision level during rendering");
RNA_def_property_update(prop, 0, "rna_Scene_simplify_update");
+ prop = RNA_def_property(srna, "simplify_child_particles_render", PROP_FLOAT, PROP_FACTOR);
+ RNA_def_property_float_sdna(prop, NULL, "simplify_particles_render");
+ RNA_def_property_ui_text(prop, "Simplify Child Particles", "Global child particles percentage during rendering");
+ RNA_def_property_update(prop, 0, "rna_Scene_simplify_update");
+
prop = RNA_def_property(srna, "simplify_shadow_samples", PROP_INT, PROP_UNSIGNED);
RNA_def_property_int_sdna(prop, NULL, "simplify_shadowsamples");
RNA_def_property_ui_range(prop, 1, 16, 1, -1);
@@ -7103,10 +7132,12 @@ void RNA_def_scene(BlenderRNA *brna)
RNA_def_property_array(prop, 3);
RNA_def_property_ui_range(prop, -200.0f, 200.0f, 1, 2);
RNA_def_property_ui_text(prop, "Gravity", "Constant acceleration in a given direction");
+ RNA_def_property_update(prop, 0, "rna_Physics_update");
prop = RNA_def_property(srna, "use_gravity", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_boolean_sdna(prop, NULL, "physics_settings.flag", PHYS_GLOBAL_GRAVITY);
RNA_def_property_ui_text(prop, "Global Gravity", "Use global gravity for all dynamics");
+ RNA_def_property_update(prop, 0, "rna_Physics_update");
/* Render Data */
prop = RNA_def_property(srna, "render", PROP_POINTER, PROP_NONE);
diff --git a/source/blender/makesrna/intern/rna_sculpt_paint.c b/source/blender/makesrna/intern/rna_sculpt_paint.c
index d1974005fce..7f405f0fb1f 100644
--- a/source/blender/makesrna/intern/rna_sculpt_paint.c
+++ b/source/blender/makesrna/intern/rna_sculpt_paint.c
@@ -34,7 +34,6 @@
#include "DNA_ID.h"
#include "DNA_scene_types.h"
#include "DNA_brush_types.h"
-#include "DNA_object_types.h"
#include "DNA_screen_types.h"
#include "DNA_space_types.h"
@@ -49,6 +48,18 @@
#include "BLI_utildefines.h"
#include "bmesh.h"
+static EnumPropertyItem particle_edit_hair_brush_items[] = {
+ {PE_BRUSH_NONE, "NONE", 0, "None", "Don't use any brush"},
+ {PE_BRUSH_COMB, "COMB", 0, "Comb", "Comb hairs"},
+ {PE_BRUSH_SMOOTH, "SMOOTH", 0, "Smooth", "Smooth hairs"},
+ {PE_BRUSH_ADD, "ADD", 0, "Add", "Add hairs"},
+ {PE_BRUSH_LENGTH, "LENGTH", 0, "Length", "Make hairs longer or shorter"},
+ {PE_BRUSH_PUFF, "PUFF", 0, "Puff", "Make hairs stand up"},
+ {PE_BRUSH_CUT, "CUT", 0, "Cut", "Cut hairs"},
+ {PE_BRUSH_WEIGHT, "WEIGHT", 0, "Weight", "Weight hair particles"},
+ {0, NULL, 0, NULL, NULL}
+};
+
EnumPropertyItem rna_enum_gpencil_sculpt_brush_items[] = {
{GP_EDITBRUSH_TYPE_SMOOTH, "SMOOTH", 0, "Smooth", "Smooth stroke points"},
{GP_EDITBRUSH_TYPE_THICKNESS, "THICKNESS", 0, "Thickness", "Adjust thickness of strokes"},
@@ -89,16 +100,137 @@ EnumPropertyItem rna_enum_symmetrize_direction_items[] = {
#include "BKE_context.h"
#include "BKE_DerivedMesh.h"
+#include "BKE_pointcache.h"
+#include "BKE_particle.h"
#include "BKE_depsgraph.h"
#include "BKE_pbvh.h"
#include "GPU_buffers.h"
+#include "ED_particle.h"
+
static void rna_GPencil_update(Main *UNUSED(bmain), Scene *UNUSED(scene), PointerRNA *UNUSED(ptr))
{
WM_main_add_notifier(NC_GPENCIL | NA_EDITED, NULL);
}
+static EnumPropertyItem particle_edit_disconnected_hair_brush_items[] = {
+ {PE_BRUSH_NONE, "NONE", 0, "None", "Don't use any brush"},
+ {PE_BRUSH_COMB, "COMB", 0, "Comb", "Comb hairs"},
+ {PE_BRUSH_SMOOTH, "SMOOTH", 0, "Smooth", "Smooth hairs"},
+ {PE_BRUSH_LENGTH, "LENGTH", 0, "Length", "Make hairs longer or shorter"},
+ {PE_BRUSH_CUT, "CUT", 0, "Cut", "Cut hairs"},
+ {PE_BRUSH_WEIGHT, "WEIGHT", 0, "Weight", "Weight hair particles"},
+ {0, NULL, 0, NULL, NULL}
+};
+
+static EnumPropertyItem particle_edit_cache_brush_items[] = {
+ {PE_BRUSH_NONE, "NONE", 0, "None", "Don't use any brush"},
+ {PE_BRUSH_COMB, "COMB", 0, "Comb", "Comb paths"},
+ {PE_BRUSH_SMOOTH, "SMOOTH", 0, "Smooth", "Smooth paths"},
+ {PE_BRUSH_LENGTH, "LENGTH", 0, "Length", "Make paths longer or shorter"},
+ {0, NULL, 0, NULL, NULL}
+};
+
+static PointerRNA rna_ParticleEdit_brush_get(PointerRNA *ptr)
+{
+ ParticleEditSettings *pset = (ParticleEditSettings *)ptr->data;
+ ParticleBrushData *brush = NULL;
+
+ if (pset->brushtype != PE_BRUSH_NONE)
+ brush = &pset->brush[pset->brushtype];
+
+ return rna_pointer_inherit_refine(ptr, &RNA_ParticleBrush, brush);
+}
+
+static PointerRNA rna_ParticleBrush_curve_get(PointerRNA *ptr)
+{
+ return rna_pointer_inherit_refine(ptr, &RNA_CurveMapping, NULL);
+}
+
+static void rna_ParticleEdit_redo(Main *UNUSED(bmain), Scene *scene, PointerRNA *UNUSED(ptr))
+{
+ Object *ob = (scene->basact) ? scene->basact->object : NULL;
+ PTCacheEdit *edit = PE_get_current(scene, ob);
+
+ if (!edit)
+ return;
+
+ psys_free_path_cache(edit->psys, edit);
+}
+
+static void rna_ParticleEdit_update(Main *UNUSED(bmain), Scene *scene, PointerRNA *UNUSED(ptr))
+{
+ Object *ob = (scene->basact) ? scene->basact->object : NULL;
+
+ if (ob) DAG_id_tag_update(&ob->id, OB_RECALC_DATA);
+}
+static void rna_ParticleEdit_tool_set(PointerRNA *ptr, int value)
+{
+ ParticleEditSettings *pset = (ParticleEditSettings *)ptr->data;
+
+ /* redraw hair completely if weight brush is/was used */
+ if ((pset->brushtype == PE_BRUSH_WEIGHT || value == PE_BRUSH_WEIGHT) && pset->scene) {
+ Object *ob = (pset->scene->basact) ? pset->scene->basact->object : NULL;
+ if (ob) {
+ DAG_id_tag_update(&ob->id, OB_RECALC_DATA);
+ WM_main_add_notifier(NC_OBJECT | ND_PARTICLE | NA_EDITED, NULL);
+ }
+ }
+
+ pset->brushtype = value;
+}
+static EnumPropertyItem *rna_ParticleEdit_tool_itemf(bContext *C, PointerRNA *UNUSED(ptr),
+ PropertyRNA *UNUSED(prop), bool *UNUSED(r_free))
+{
+ Scene *scene = CTX_data_scene(C);
+ Object *ob = (scene->basact) ? scene->basact->object : NULL;
+#if 0
+ PTCacheEdit *edit = PE_get_current(scene, ob);
+ ParticleSystem *psys = edit ? edit->psys : NULL;
+#else
+ /* use this rather than PE_get_current() - because the editing cache is
+ * dependent on the cache being updated which can happen after this UI
+ * draws causing a glitch [#28883] */
+ ParticleSystem *psys = psys_get_current(ob);
+#endif
+
+ if (psys) {
+ if (psys->flag & PSYS_GLOBAL_HAIR) {
+ return particle_edit_disconnected_hair_brush_items;
+ }
+ else {
+ return particle_edit_hair_brush_items;
+ }
+ }
+
+ return particle_edit_cache_brush_items;
+}
+
+static int rna_ParticleEdit_editable_get(PointerRNA *ptr)
+{
+ ParticleEditSettings *pset = (ParticleEditSettings *)ptr->data;
+
+ return (pset->object && pset->scene && PE_get_current(pset->scene, pset->object));
+}
+static int rna_ParticleEdit_hair_get(PointerRNA *ptr)
+{
+ ParticleEditSettings *pset = (ParticleEditSettings *)ptr->data;
+
+ if (pset->scene) {
+ PTCacheEdit *edit = PE_get_current(pset->scene, pset->object);
+
+ return (edit && edit->psys);
+ }
+
+ return 0;
+}
+
+static char *rna_ParticleEdit_path(PointerRNA *UNUSED(ptr))
+{
+ return BLI_strdup("tool_settings.particle_edit");
+}
+
static int rna_Brush_mode_poll(PointerRNA *ptr, PointerRNA value)
{
Scene *scene = (Scene *)ptr->id.data;
@@ -178,6 +310,11 @@ static char *rna_UvSculpt_path(PointerRNA *UNUSED(ptr))
return BLI_strdup("tool_settings.uv_sculpt");
}
+static char *rna_ParticleBrush_path(PointerRNA *UNUSED(ptr))
+{
+ return BLI_strdup("tool_settings.particle_edit.brush");
+}
+
static void rna_Paint_brush_update(Main *UNUSED(bmain), Scene *UNUSED(scene), PointerRNA *ptr)
{
Paint *paint = ptr->data;
@@ -680,6 +817,188 @@ static void rna_def_image_paint(BlenderRNA *brna)
RNA_def_property_clear_flag(prop, PROP_EDITABLE);
}
+static void rna_def_particle_edit(BlenderRNA *brna)
+{
+ StructRNA *srna;
+ PropertyRNA *prop;
+
+ static EnumPropertyItem select_mode_items[] = {
+ {SCE_SELECT_PATH, "PATH", ICON_PARTICLE_PATH, "Path", "Path edit mode"},
+ {SCE_SELECT_POINT, "POINT", ICON_PARTICLE_POINT, "Point", "Point select mode"},
+ {SCE_SELECT_END, "TIP", ICON_PARTICLE_TIP, "Tip", "Tip select mode"},
+ {0, NULL, 0, NULL, NULL}
+ };
+
+ static EnumPropertyItem puff_mode[] = {
+ {0, "ADD", 0, "Add", "Make hairs more puffy"},
+ {1, "SUB", 0, "Sub", "Make hairs less puffy"},
+ {0, NULL, 0, NULL, NULL}
+ };
+
+ static EnumPropertyItem length_mode[] = {
+ {0, "GROW", 0, "Grow", "Make hairs longer"},
+ {1, "SHRINK", 0, "Shrink", "Make hairs shorter"},
+ {0, NULL, 0, NULL, NULL}
+ };
+
+ static EnumPropertyItem edit_type_items[] = {
+ {PE_TYPE_PARTICLES, "PARTICLES", 0, "Particles", ""},
+ {PE_TYPE_SOFTBODY, "SOFT_BODY", 0, "Soft body", ""},
+ {PE_TYPE_CLOTH, "CLOTH", 0, "Cloth", ""},
+ {0, NULL, 0, NULL, NULL}
+ };
+
+
+ /* edit */
+
+ srna = RNA_def_struct(brna, "ParticleEdit", NULL);
+ RNA_def_struct_sdna(srna, "ParticleEditSettings");
+ RNA_def_struct_path_func(srna, "rna_ParticleEdit_path");
+ RNA_def_struct_ui_text(srna, "Particle Edit", "Properties of particle editing mode");
+
+ prop = RNA_def_property(srna, "tool", PROP_ENUM, PROP_NONE);
+ RNA_def_property_enum_sdna(prop, NULL, "brushtype");
+ RNA_def_property_enum_items(prop, particle_edit_hair_brush_items);
+ RNA_def_property_enum_funcs(prop, NULL, "rna_ParticleEdit_tool_set", "rna_ParticleEdit_tool_itemf");
+ RNA_def_property_ui_text(prop, "Tool", "");
+
+ prop = RNA_def_property(srna, "select_mode", PROP_ENUM, PROP_NONE);
+ RNA_def_property_enum_bitflag_sdna(prop, NULL, "selectmode");
+ RNA_def_property_enum_items(prop, select_mode_items);
+ RNA_def_property_ui_text(prop, "Selection Mode", "Particle select and display mode");
+ RNA_def_property_update(prop, NC_OBJECT | ND_DRAW, "rna_ParticleEdit_update");
+
+ prop = RNA_def_property(srna, "use_preserve_length", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "flag", PE_KEEP_LENGTHS);
+ RNA_def_property_ui_text(prop, "Keep Lengths", "Keep path lengths constant");
+
+ prop = RNA_def_property(srna, "use_preserve_root", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "flag", PE_LOCK_FIRST);
+ RNA_def_property_ui_text(prop, "Keep Root", "Keep root keys unmodified");
+
+ prop = RNA_def_property(srna, "use_emitter_deflect", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "flag", PE_DEFLECT_EMITTER);
+ RNA_def_property_ui_text(prop, "Deflect Emitter", "Keep paths from intersecting the emitter");
+
+ prop = RNA_def_property(srna, "emitter_distance", PROP_FLOAT, PROP_UNSIGNED);
+ RNA_def_property_float_sdna(prop, NULL, "emitterdist");
+ RNA_def_property_ui_range(prop, 0.0f, 10.0f, 10, 3);
+ RNA_def_property_ui_text(prop, "Emitter Distance", "Distance to keep particles away from the emitter");
+
+ prop = RNA_def_property(srna, "use_fade_time", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "flag", PE_FADE_TIME);
+ RNA_def_property_ui_text(prop, "Fade Time", "Fade paths and keys further away from current frame");
+ RNA_def_property_update(prop, NC_OBJECT | ND_DRAW, "rna_ParticleEdit_update");
+
+ prop = RNA_def_property(srna, "use_auto_velocity", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "flag", PE_AUTO_VELOCITY);
+ RNA_def_property_ui_text(prop, "Auto Velocity", "Calculate point velocities automatically");
+
+ prop = RNA_def_property(srna, "show_particles", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "flag", PE_DRAW_PART);
+ RNA_def_property_ui_text(prop, "Draw Particles", "Draw actual particles");
+ RNA_def_property_update(prop, NC_OBJECT | ND_DRAW, "rna_ParticleEdit_redo");
+
+ prop = RNA_def_property(srna, "use_default_interpolate", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "flag", PE_INTERPOLATE_ADDED);
+ RNA_def_property_ui_text(prop, "Interpolate", "Interpolate new particles from the existing ones");
+
+ prop = RNA_def_property(srna, "default_key_count", PROP_INT, PROP_NONE);
+ RNA_def_property_int_sdna(prop, NULL, "totaddkey");
+ RNA_def_property_range(prop, 2, SHRT_MAX);
+ RNA_def_property_ui_range(prop, 2, 20, 10, 3);
+ RNA_def_property_ui_text(prop, "Keys", "How many keys to make new particles with");
+
+ prop = RNA_def_property(srna, "brush", PROP_POINTER, PROP_NONE);
+ RNA_def_property_struct_type(prop, "ParticleBrush");
+ RNA_def_property_pointer_funcs(prop, "rna_ParticleEdit_brush_get", NULL, NULL, NULL);
+ RNA_def_property_ui_text(prop, "Brush", "");
+
+ prop = RNA_def_property(srna, "draw_step", PROP_INT, PROP_NONE);
+ RNA_def_property_range(prop, 1, 10);
+ RNA_def_property_ui_text(prop, "Steps", "How many steps to draw the path with");
+ RNA_def_property_update(prop, NC_OBJECT | ND_DRAW, "rna_ParticleEdit_redo");
+
+ prop = RNA_def_property(srna, "fade_frames", PROP_INT, PROP_NONE);
+ RNA_def_property_range(prop, 1, 100);
+ RNA_def_property_ui_text(prop, "Frames", "How many frames to fade");
+ RNA_def_property_update(prop, NC_OBJECT | ND_DRAW, "rna_ParticleEdit_update");
+
+ prop = RNA_def_property(srna, "type", PROP_ENUM, PROP_NONE);
+ RNA_def_property_enum_sdna(prop, NULL, "edittype");
+ RNA_def_property_enum_items(prop, edit_type_items);
+ RNA_def_property_ui_text(prop, "Type", "");
+ RNA_def_property_update(prop, NC_OBJECT | ND_DRAW, "rna_ParticleEdit_redo");
+
+ prop = RNA_def_property(srna, "is_editable", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_funcs(prop, "rna_ParticleEdit_editable_get", NULL);
+ RNA_def_property_clear_flag(prop, PROP_EDITABLE);
+ RNA_def_property_ui_text(prop, "Editable", "A valid edit mode exists");
+
+ prop = RNA_def_property(srna, "is_hair", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_funcs(prop, "rna_ParticleEdit_hair_get", NULL);
+ RNA_def_property_clear_flag(prop, PROP_EDITABLE);
+ RNA_def_property_ui_text(prop, "Hair", "Editing hair");
+
+ prop = RNA_def_property(srna, "object", PROP_POINTER, PROP_NONE);
+ RNA_def_property_clear_flag(prop, PROP_EDITABLE);
+ RNA_def_property_ui_text(prop, "Object", "The edited object");
+
+ prop = RNA_def_property(srna, "shape_object", PROP_POINTER, PROP_NONE);
+ RNA_def_property_flag(prop, PROP_EDITABLE);
+ RNA_def_property_ui_text(prop, "Shape Object", "Outer shape to use for tools");
+ RNA_def_property_pointer_funcs(prop, NULL, NULL, NULL, "rna_Mesh_object_poll");
+ RNA_def_property_update(prop, NC_OBJECT | ND_DRAW, "rna_ParticleEdit_redo");
+
+ /* brush */
+
+ srna = RNA_def_struct(brna, "ParticleBrush", NULL);
+ RNA_def_struct_sdna(srna, "ParticleBrushData");
+ RNA_def_struct_path_func(srna, "rna_ParticleBrush_path");
+ RNA_def_struct_ui_text(srna, "Particle Brush", "Particle editing brush");
+
+ prop = RNA_def_property(srna, "size", PROP_INT, PROP_PIXEL);
+ RNA_def_property_range(prop, 1, SHRT_MAX);
+ RNA_def_property_ui_range(prop, 1, MAX_BRUSH_PIXEL_RADIUS, 10, 3);
+ RNA_def_property_ui_text(prop, "Radius", "Radius of the brush in pixels");
+
+ prop = RNA_def_property(srna, "strength", PROP_FLOAT, PROP_FACTOR);
+ RNA_def_property_range(prop, 0.001, 1.0);
+ RNA_def_property_ui_text(prop, "Strength", "Brush strength");
+
+ prop = RNA_def_property(srna, "count", PROP_INT, PROP_NONE);
+ RNA_def_property_range(prop, 1, 1000);
+ RNA_def_property_ui_range(prop, 1, 100, 10, 3);
+ RNA_def_property_ui_text(prop, "Count", "Particle count");
+
+ prop = RNA_def_property(srna, "steps", PROP_INT, PROP_NONE);
+ RNA_def_property_int_sdna(prop, NULL, "step");
+ RNA_def_property_range(prop, 1, SHRT_MAX);
+ RNA_def_property_ui_range(prop, 1, 50, 10, 3);
+ RNA_def_property_ui_text(prop, "Steps", "Brush steps");
+
+ prop = RNA_def_property(srna, "puff_mode", PROP_ENUM, PROP_NONE);
+ RNA_def_property_enum_sdna(prop, NULL, "invert");
+ RNA_def_property_enum_items(prop, puff_mode);
+ RNA_def_property_ui_text(prop, "Puff Mode", "");
+
+ prop = RNA_def_property(srna, "use_puff_volume", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "flag", PE_BRUSH_DATA_PUFF_VOLUME);
+ RNA_def_property_ui_text(prop, "Puff Volume",
+ "Apply puff to unselected end-points (helps maintain hair volume when puffing root)");
+
+ prop = RNA_def_property(srna, "length_mode", PROP_ENUM, PROP_NONE);
+ RNA_def_property_enum_sdna(prop, NULL, "invert");
+ RNA_def_property_enum_items(prop, length_mode);
+ RNA_def_property_ui_text(prop, "Length Mode", "");
+
+ /* dummy */
+ prop = RNA_def_property(srna, "curve", PROP_POINTER, PROP_NONE);
+ RNA_def_property_struct_type(prop, "CurveMapping");
+ RNA_def_property_pointer_funcs(prop, "rna_ParticleBrush_curve_get", NULL, NULL, NULL);
+ RNA_def_property_ui_text(prop, "Curve", "");
+}
+
static void rna_def_gpencil_sculpt(BlenderRNA *brna)
{
static EnumPropertyItem prop_direction_items[] = {
@@ -801,6 +1120,7 @@ void RNA_def_sculpt_paint(BlenderRNA *brna)
rna_def_uv_sculpt(brna);
rna_def_vertex_paint(brna);
rna_def_image_paint(brna);
+ rna_def_particle_edit(brna);
rna_def_gpencil_sculpt(brna);
RNA_define_animate_sdna(true);
}
diff --git a/source/blender/makesrna/intern/rna_smoke.c b/source/blender/makesrna/intern/rna_smoke.c
index 08054315334..6db370fc152 100644
--- a/source/blender/makesrna/intern/rna_smoke.c
+++ b/source/blender/makesrna/intern/rna_smoke.c
@@ -36,6 +36,7 @@
#include "BKE_modifier.h"
#include "BKE_smoke.h"
+#include "BKE_pointcache.h"
#include "BLI_threads.h"
@@ -52,6 +53,7 @@
#include "BKE_context.h"
#include "BKE_depsgraph.h"
+#include "BKE_particle.h"
#include "BKE_texture.h"
#include "smoke_API.h"
@@ -68,11 +70,35 @@ static void rna_Smoke_dependency_update(Main *bmain, Scene *scene, PointerRNA *p
DAG_relations_tag_update(bmain);
}
+static void rna_Smoke_resetCache(Main *UNUSED(bmain), Scene *UNUSED(scene), PointerRNA *ptr)
+{
+ SmokeDomainSettings *settings = (SmokeDomainSettings *)ptr->data;
+ if (settings->smd && settings->smd->domain)
+ settings->point_cache[0]->flag |= PTCACHE_OUTDATED;
+ DAG_id_tag_update(ptr->id.data, OB_RECALC_DATA);
+}
+
+static void rna_Smoke_cachetype_set(struct PointerRNA *ptr, int value)
+{
+ SmokeDomainSettings *settings = (SmokeDomainSettings *)ptr->data;
+ Object *ob = (Object *)ptr->id.data;
+
+ if (value != settings->cache_file_format) {
+ /* Clear old caches. */
+ PTCacheID id;
+ BKE_ptcache_id_from_smoke(&id, ob, settings->smd);
+ BKE_ptcache_id_clear(&id, PTCACHE_CLEAR_ALL, 0);
+
+ settings->cache_file_format = value;
+ }
+}
+
static void rna_Smoke_reset(Main *bmain, Scene *scene, PointerRNA *ptr)
{
SmokeDomainSettings *settings = (SmokeDomainSettings *)ptr->data;
smokeModifier_reset(settings->smd);
+ rna_Smoke_resetCache(bmain, scene, ptr);
rna_Smoke_update(bmain, scene, ptr);
}
@@ -83,6 +109,9 @@ static void rna_Smoke_reset_dependency(Main *bmain, Scene *scene, PointerRNA *pt
smokeModifier_reset(settings->smd);
+ if (settings->smd && settings->smd->domain)
+ settings->smd->domain->point_cache[0]->flag |= PTCACHE_OUTDATED;
+
rna_Smoke_dependency_update(bmain, scene, ptr);
}
@@ -392,6 +421,12 @@ static void rna_def_smoke_domain_settings(BlenderRNA *brna)
{ 0, NULL, 0, NULL, NULL }
};
+ static EnumPropertyItem smoke_cache_comp_items[] = {
+ {SM_CACHE_LIGHT, "CACHELIGHT", 0, "Light", "Fast but not so effective compression"},
+ {SM_CACHE_HEAVY, "CACHEHEAVY", 0, "Heavy", "Effective but slow compression"},
+ {0, NULL, 0, NULL, NULL}
+ };
+
static EnumPropertyItem smoke_highres_sampling_items[] = {
{SM_HRES_FULLSAMPLE, "FULLSAMPLE", 0, "Full Sample", ""},
{SM_HRES_LINEAR, "LINEAR", 0, "Linear", ""},
@@ -413,6 +448,14 @@ static void rna_def_smoke_domain_settings(BlenderRNA *brna)
{0, NULL, 0, NULL, NULL}
};
+ static EnumPropertyItem cache_file_type_items[] = {
+ {PTCACHE_FILE_PTCACHE, "POINTCACHE", 0, "Point Cache", "Blender specific point cache file format"},
+#ifdef WITH_OPENVDB
+ {PTCACHE_FILE_OPENVDB, "OPENVDB", 0, "OpenVDB", "OpenVDB file format"},
+#endif
+ {0, NULL, 0, NULL, NULL}
+ };
+
static EnumPropertyItem smoke_view_items[] = {
{MOD_SMOKE_SLICE_VIEW_ALIGNED, "VIEW_ALIGNED", 0, "View", "Slice volume parallel to the view plane"},
{MOD_SMOKE_SLICE_AXIS_ALIGNED, "AXIS_ALIGNED", 0, "Axis", "Slice volume parallel to the major axis"},
@@ -484,7 +527,7 @@ static void rna_def_smoke_domain_settings(BlenderRNA *brna)
RNA_def_property_ui_range(prop, -5.0, 5.0, 0.02, 5);
RNA_def_property_ui_text(prop, "Density",
"How much density affects smoke motion (higher value results in faster rising smoke)");
- RNA_def_property_update(prop, NC_OBJECT | ND_MODIFIER, "rna_Smoke_update");
+ RNA_def_property_update(prop, NC_OBJECT | ND_MODIFIER, "rna_Smoke_resetCache");
prop = RNA_def_property(srna, "beta", PROP_FLOAT, PROP_NONE);
RNA_def_property_float_sdna(prop, NULL, "beta");
@@ -492,7 +535,7 @@ static void rna_def_smoke_domain_settings(BlenderRNA *brna)
RNA_def_property_ui_range(prop, -5.0, 5.0, 0.02, 5);
RNA_def_property_ui_text(prop, "Heat",
"How much heat affects smoke motion (higher value results in faster rising smoke)");
- RNA_def_property_update(prop, NC_OBJECT | ND_MODIFIER, "rna_Smoke_update");
+ RNA_def_property_update(prop, NC_OBJECT | ND_MODIFIER, "rna_Smoke_resetCache");
prop = RNA_def_property(srna, "collision_group", PROP_POINTER, PROP_NONE);
RNA_def_property_pointer_sdna(prop, NULL, "coll_group");
@@ -520,24 +563,34 @@ static void rna_def_smoke_domain_settings(BlenderRNA *brna)
RNA_def_property_range(prop, 0.0, 10.0);
RNA_def_property_ui_range(prop, 0.0, 10.0, 1, 2);
RNA_def_property_ui_text(prop, "Strength", "Strength of noise");
- RNA_def_property_update(prop, NC_OBJECT | ND_MODIFIER, "rna_Smoke_update");
+ RNA_def_property_update(prop, NC_OBJECT | ND_MODIFIER, "rna_Smoke_resetCache");
prop = RNA_def_property(srna, "dissolve_speed", PROP_INT, PROP_NONE);
RNA_def_property_int_sdna(prop, NULL, "diss_speed");
RNA_def_property_range(prop, 1.0, 10000.0);
RNA_def_property_ui_range(prop, 1.0, 10000.0, 1, -1);
RNA_def_property_ui_text(prop, "Dissolve Speed", "Dissolve Speed");
- RNA_def_property_update(prop, NC_OBJECT | ND_MODIFIER, "rna_Smoke_update");
+ RNA_def_property_update(prop, NC_OBJECT | ND_MODIFIER, "rna_Smoke_resetCache");
prop = RNA_def_property(srna, "use_dissolve_smoke", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_boolean_sdna(prop, NULL, "flags", MOD_SMOKE_DISSOLVE);
RNA_def_property_ui_text(prop, "Dissolve Smoke", "Enable smoke to disappear over time");
- RNA_def_property_update(prop, NC_OBJECT | ND_MODIFIER, "rna_Smoke_update");
+ RNA_def_property_update(prop, NC_OBJECT | ND_MODIFIER, "rna_Smoke_resetCache");
prop = RNA_def_property(srna, "use_dissolve_smoke_log", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_boolean_sdna(prop, NULL, "flags", MOD_SMOKE_DISSOLVE_LOG);
RNA_def_property_ui_text(prop, "Logarithmic dissolve", "Using 1/x ");
- RNA_def_property_update(prop, NC_OBJECT | ND_MODIFIER, "rna_Smoke_update");
+ RNA_def_property_update(prop, NC_OBJECT | ND_MODIFIER, "rna_Smoke_resetCache");
+
+ prop = RNA_def_property(srna, "point_cache", PROP_POINTER, PROP_NONE);
+ RNA_def_property_flag(prop, PROP_NEVER_NULL);
+ RNA_def_property_pointer_sdna(prop, NULL, "point_cache[0]");
+ RNA_def_property_ui_text(prop, "Point Cache", "");
+
+ prop = RNA_def_property(srna, "point_cache_compress_type", PROP_ENUM, PROP_NONE);
+ RNA_def_property_enum_sdna(prop, NULL, "cache_comp");
+ RNA_def_property_enum_items(prop, smoke_cache_comp_items);
+ RNA_def_property_ui_text(prop, "Cache Compression", "Compression method to be used");
prop = RNA_def_property(srna, "openvdb_cache_compress_type", PROP_ENUM, PROP_NONE);
RNA_def_property_enum_sdna(prop, NULL, "openvdb_comp");
@@ -567,21 +620,21 @@ static void rna_def_smoke_domain_settings(BlenderRNA *brna)
prop = RNA_def_property(srna, "highres_sampling", PROP_ENUM, PROP_NONE);
RNA_def_property_enum_items(prop, smoke_highres_sampling_items);
RNA_def_property_ui_text(prop, "Emitter", "Method for sampling the high resolution flow");
- RNA_def_property_update(prop, NC_OBJECT | ND_MODIFIER, "rna_Smoke_update");
+ RNA_def_property_update(prop, NC_OBJECT | ND_MODIFIER, "rna_Smoke_resetCache");
prop = RNA_def_property(srna, "time_scale", PROP_FLOAT, PROP_NONE);
RNA_def_property_float_sdna(prop, NULL, "time_scale");
RNA_def_property_range(prop, 0.2, 1.5);
RNA_def_property_ui_range(prop, 0.2, 1.5, 0.02, 5);
RNA_def_property_ui_text(prop, "Time Scale", "Adjust simulation speed");
- RNA_def_property_update(prop, NC_OBJECT | ND_MODIFIER, "rna_Smoke_update");
+ RNA_def_property_update(prop, NC_OBJECT | ND_MODIFIER, "rna_Smoke_resetCache");
prop = RNA_def_property(srna, "vorticity", PROP_FLOAT, PROP_NONE);
RNA_def_property_float_sdna(prop, NULL, "vorticity");
RNA_def_property_range(prop, 0.01, 4.0);
RNA_def_property_ui_range(prop, 0.01, 4.0, 0.02, 5);
RNA_def_property_ui_text(prop, "Vorticity", "Amount of turbulence/rotation in fluid");
- RNA_def_property_update(prop, NC_OBJECT | ND_MODIFIER, "rna_Smoke_update");
+ RNA_def_property_update(prop, NC_OBJECT | ND_MODIFIER, "rna_Smoke_resetCache");
prop = RNA_def_property(srna, "density_grid", PROP_FLOAT, PROP_NONE);
RNA_def_property_array(prop, 32);
@@ -641,36 +694,36 @@ static void rna_def_smoke_domain_settings(BlenderRNA *brna)
RNA_def_property_range(prop, 0.01, 4.0);
RNA_def_property_ui_range(prop, 0.01, 2.0, 1.0, 5);
RNA_def_property_ui_text(prop, "Speed", "Speed of the burning reaction (use larger values for smaller flame)");
- RNA_def_property_update(prop, NC_OBJECT | ND_MODIFIER, "rna_Smoke_update");
+ RNA_def_property_update(prop, NC_OBJECT | ND_MODIFIER, "rna_Smoke_resetCache");
prop = RNA_def_property(srna, "flame_smoke", PROP_FLOAT, PROP_NONE);
RNA_def_property_range(prop, 0.0, 8.0);
RNA_def_property_ui_range(prop, 0.0, 4.0, 1.0, 5);
RNA_def_property_ui_text(prop, "Smoke", "Amount of smoke created by burning fuel");
- RNA_def_property_update(prop, NC_OBJECT | ND_MODIFIER, "rna_Smoke_update");
+ RNA_def_property_update(prop, NC_OBJECT | ND_MODIFIER, "rna_Smoke_resetCache");
prop = RNA_def_property(srna, "flame_vorticity", PROP_FLOAT, PROP_NONE);
RNA_def_property_range(prop, 0.0, 2.0);
RNA_def_property_ui_range(prop, 0.0, 1.0, 1.0, 5);
RNA_def_property_ui_text(prop, "Vorticity", "Additional vorticity for the flames");
- RNA_def_property_update(prop, NC_OBJECT | ND_MODIFIER, "rna_Smoke_update");
+ RNA_def_property_update(prop, NC_OBJECT | ND_MODIFIER, "rna_Smoke_resetCache");
prop = RNA_def_property(srna, "flame_ignition", PROP_FLOAT, PROP_NONE);
RNA_def_property_range(prop, 0.5, 5.0);
RNA_def_property_ui_range(prop, 0.5, 2.5, 1.0, 5);
RNA_def_property_ui_text(prop, "Ignition", "Minimum temperature of flames");
- RNA_def_property_update(prop, NC_OBJECT | ND_MODIFIER, "rna_Smoke_update");
+ RNA_def_property_update(prop, NC_OBJECT | ND_MODIFIER, "rna_Smoke_resetCache");
prop = RNA_def_property(srna, "flame_max_temp", PROP_FLOAT, PROP_NONE);
RNA_def_property_range(prop, 1.0, 10.0);
RNA_def_property_ui_range(prop, 1.0, 5.0, 1.0, 5);
RNA_def_property_ui_text(prop, "Maximum", "Maximum temperature of flames");
- RNA_def_property_update(prop, NC_OBJECT | ND_MODIFIER, "rna_Smoke_update");
+ RNA_def_property_update(prop, NC_OBJECT | ND_MODIFIER, "rna_Smoke_resetCache");
prop = RNA_def_property(srna, "flame_smoke_color", PROP_FLOAT, PROP_COLOR_GAMMA);
RNA_def_property_array(prop, 3);
RNA_def_property_ui_text(prop, "Smoke Color", "Color of smoke emitted from burning fuel");
- RNA_def_property_update(prop, NC_OBJECT | ND_MODIFIER, "rna_Smoke_update");
+ RNA_def_property_update(prop, NC_OBJECT | ND_MODIFIER, "rna_Smoke_resetCache");
prop = RNA_def_property(srna, "use_adaptive_domain", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_boolean_sdna(prop, NULL, "flags", MOD_SMOKE_ADAPTIVE_DOMAIN);
@@ -683,20 +736,28 @@ static void rna_def_smoke_domain_settings(BlenderRNA *brna)
RNA_def_property_range(prop, 0, 512);
RNA_def_property_ui_range(prop, 0, 512, 2, -1);
RNA_def_property_ui_text(prop, "Additional", "Maximum number of additional cells");
- RNA_def_property_update(prop, NC_OBJECT | ND_MODIFIER, "rna_Smoke_update");
+ RNA_def_property_update(prop, NC_OBJECT | ND_MODIFIER, "rna_Smoke_resetCache");
prop = RNA_def_property(srna, "adapt_margin", PROP_INT, PROP_NONE);
RNA_def_property_int_sdna(prop, NULL, "adapt_margin");
RNA_def_property_range(prop, 2, 24);
RNA_def_property_ui_range(prop, 2, 24, 2, -1);
RNA_def_property_ui_text(prop, "Margin", "Margin added around fluid to minimize boundary interference");
- RNA_def_property_update(prop, NC_OBJECT | ND_MODIFIER, "rna_Smoke_update");
+ RNA_def_property_update(prop, NC_OBJECT | ND_MODIFIER, "rna_Smoke_resetCache");
prop = RNA_def_property(srna, "adapt_threshold", PROP_FLOAT, PROP_NONE);
RNA_def_property_range(prop, 0.01, 0.5);
RNA_def_property_ui_range(prop, 0.01, 0.5, 1.0, 5);
RNA_def_property_ui_text(prop, "Threshold",
"Maximum amount of fluid cell can contain before it is considered empty");
+ RNA_def_property_update(prop, NC_OBJECT | ND_MODIFIER, "rna_Smoke_resetCache");
+
+ prop = RNA_def_property(srna, "cache_file_format", PROP_ENUM, PROP_NONE);
+ RNA_def_property_enum_sdna(prop, NULL, "cache_file_format");
+ RNA_def_property_enum_items(prop, cache_file_type_items);
+ RNA_def_property_enum_funcs(prop, NULL, "rna_Smoke_cachetype_set", NULL);
+ RNA_def_property_ui_text(prop, "File Format", "Select the file format to be used for caching");
+ RNA_def_property_update(prop, NC_OBJECT | ND_MODIFIER, "rna_Smoke_resetCache");
/* display settings */
@@ -850,6 +911,13 @@ static void rna_def_smoke_flow_settings(BlenderRNA *brna)
RNA_def_property_ui_text(prop, "Temp. Diff.", "Temperature difference to ambient temperature");
RNA_def_property_update(prop, NC_OBJECT | ND_MODIFIER, "rna_Smoke_reset");
+ prop = RNA_def_property(srna, "particle_system", PROP_POINTER, PROP_NONE);
+ RNA_def_property_pointer_sdna(prop, NULL, "psys");
+ RNA_def_property_struct_type(prop, "ParticleSystem");
+ RNA_def_property_flag(prop, PROP_EDITABLE);
+ RNA_def_property_ui_text(prop, "Particle Systems", "Particle systems emitted from the object");
+ RNA_def_property_update(prop, 0, "rna_Smoke_reset_dependency");
+
prop = RNA_def_property(srna, "smoke_flow_type", PROP_ENUM, PROP_NONE);
RNA_def_property_enum_sdna(prop, NULL, "type");
RNA_def_property_enum_items(prop, smoke_flow_types);
diff --git a/source/blender/makesrna/intern/rna_space.c b/source/blender/makesrna/intern/rna_space.c
index 672322cb40d..97217f749d6 100644
--- a/source/blender/makesrna/intern/rna_space.c
+++ b/source/blender/makesrna/intern/rna_space.c
@@ -206,6 +206,7 @@ static EnumPropertyItem buttons_context_items[] = {
{BCONTEXT_BONE_CONSTRAINT, "BONE_CONSTRAINT", ICON_CONSTRAINT_BONE, "Bone Constraints", "Bone constraints"},
{BCONTEXT_MATERIAL, "MATERIAL", ICON_MATERIAL, "Material", "Material"},
{BCONTEXT_TEXTURE, "TEXTURE", ICON_TEXTURE, "Texture", "Texture"},
+ {BCONTEXT_PARTICLE, "PARTICLES", ICON_PARTICLES, "Particles", "Particle"},
{BCONTEXT_PHYSICS, "PHYSICS", ICON_PHYSICS, "Physics", "Physics"},
{0, NULL, 0, NULL, NULL}
};
@@ -215,6 +216,7 @@ static EnumPropertyItem buttons_texture_context_items[] = {
{SB_TEXC_MATERIAL, "MATERIAL", ICON_MATERIAL, "", "Show material textures"},
{SB_TEXC_WORLD, "WORLD", ICON_WORLD, "", "Show world textures"},
{SB_TEXC_LAMP, "LAMP", ICON_LAMP, "", "Show lamp textures"},
+ {SB_TEXC_PARTICLES, "PARTICLES", ICON_PARTICLES, "", "Show particles textures"},
{SB_TEXC_LINESTYLE, "LINESTYLE", ICON_LINE_DATA, "", "Show linestyle textures"},
{SB_TEXC_OTHER, "OTHER", ICON_TEXTURE, "", "Show other data textures"},
{0, NULL, 0, NULL, NULL}
@@ -1111,6 +1113,10 @@ static EnumPropertyItem *rna_SpaceProperties_context_itemf(bContext *UNUSED(C),
RNA_enum_items_add_value(&item, &totitem, buttons_context_items, BCONTEXT_TEXTURE);
}
+ if (sbuts->pathflag & (1 << BCONTEXT_PARTICLE)) {
+ RNA_enum_items_add_value(&item, &totitem, buttons_context_items, BCONTEXT_PARTICLE);
+ }
+
if (sbuts->pathflag & (1 << BCONTEXT_PHYSICS)) {
RNA_enum_items_add_value(&item, &totitem, buttons_context_items, BCONTEXT_PHYSICS);
}
@@ -1154,6 +1160,10 @@ static EnumPropertyItem *rna_SpaceProperties_texture_context_itemf(bContext *C,
RNA_enum_items_add_value(&item, &totitem, buttons_texture_context_items, SB_TEXC_MATERIAL);
}
+ if (ED_texture_context_check_particles(C)) {
+ RNA_enum_items_add_value(&item, &totitem, buttons_texture_context_items, SB_TEXC_PARTICLES);
+ }
+
if (ED_texture_context_check_linestyle(C)) {
RNA_enum_items_add_value(&item, &totitem, buttons_texture_context_items, SB_TEXC_LINESTYLE);
}
@@ -3741,6 +3751,11 @@ static void rna_def_space_time(BlenderRNA *brna)
RNA_def_property_ui_text(prop, "Softbody", "Show the active object's softbody point cache");
RNA_def_property_update(prop, NC_SPACE | ND_SPACE_TIME, NULL);
+ prop = RNA_def_property(srna, "cache_particles", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "cache_display", TIME_CACHE_PARTICLES);
+ RNA_def_property_ui_text(prop, "Particles", "Show the active object's particle point cache");
+ RNA_def_property_update(prop, NC_SPACE | ND_SPACE_TIME, NULL);
+
prop = RNA_def_property(srna, "cache_cloth", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_boolean_sdna(prop, NULL, "cache_display", TIME_CACHE_CLOTH);
RNA_def_property_ui_text(prop, "Cloth", "Show the active object's cloth point cache");
@@ -3879,6 +3894,8 @@ static void rna_def_fileselect_params(BlenderRNA *brna)
{FILTER_ID_MSK, "MASK", ICON_MOD_MASK, "Masks", "Show/hide Mask data-blocks"},
{FILTER_ID_NT, "NODE_TREE", ICON_NODETREE, "Node Trees", "Show/hide Node Tree data-blocks"},
{FILTER_ID_OB, "OBJECT", ICON_OBJECT_DATA, "Objects", "Show/hide Object data-blocks"},
+ {FILTER_ID_PA, "PARTICLE_SETTINGS", ICON_PARTICLE_DATA,
+ "Particles Settings", "Show/hide Particle Settings data-blocks"},
{FILTER_ID_PAL, "PALETTE", ICON_COLOR, "Palettes", "Show/hide Palette data-blocks"},
{FILTER_ID_PC, "PAINT_CURVE", ICON_CURVE_BEZCURVE, "Paint Curves", "Show/hide Paint Curve data-blocks"},
{FILTER_ID_SCE, "SCENE", ICON_SCENE_DATA, "Scenes", "Show/hide Scene data-blocks"},
@@ -3907,7 +3924,7 @@ static void rna_def_fileselect_params(BlenderRNA *brna)
"IMAGE", ICON_IMAGE_DATA, "Images & Sounds", "Show/hide images, movie clips, sounds and masks"},
{FILTER_ID_CA | FILTER_ID_LA | FILTER_ID_SPK | FILTER_ID_WO,
"ENVIRONMENT", ICON_WORLD_DATA, "Environment", "Show/hide worlds, lamps, cameras and speakers"},
- {FILTER_ID_BR | FILTER_ID_GD | FILTER_ID_PAL | FILTER_ID_PC | FILTER_ID_TXT | FILTER_ID_VF | FILTER_ID_CF,
+ {FILTER_ID_BR | FILTER_ID_GD | FILTER_ID_PA | FILTER_ID_PAL | FILTER_ID_PC | FILTER_ID_TXT | FILTER_ID_VF | FILTER_ID_CF,
"MISC", ICON_GREASEPENCIL, "Miscellaneous", "Show/hide other data types"},
{0, NULL, 0, NULL, NULL}
};
diff --git a/source/blender/makesrna/intern/rna_texture.c b/source/blender/makesrna/intern/rna_texture.c
index 959f30170f5..1e88585a286 100644
--- a/source/blender/makesrna/intern/rna_texture.c
+++ b/source/blender/makesrna/intern/rna_texture.c
@@ -35,6 +35,7 @@
#include "DNA_texture_types.h"
#include "DNA_world_types.h"
#include "DNA_node_types.h"
+#include "DNA_particle_types.h"
#include "DNA_scene_types.h" /* MAXFRAME only */
#include "BLI_utildefines.h"
@@ -252,6 +253,20 @@ void rna_TextureSlot_update(Main *UNUSED(bmain), Scene *scene, PointerRNA *ptr)
case ID_LS:
WM_main_add_notifier(NC_LINESTYLE, id);
break;
+ case ID_PA:
+ {
+ MTex *mtex = ptr->data;
+ int recalc = OB_RECALC_DATA;
+
+ if (mtex->mapto & PAMAP_INIT)
+ recalc |= PSYS_RECALC_RESET;
+ if (mtex->mapto & PAMAP_CHILD)
+ recalc |= PSYS_RECALC_CHILD;
+
+ DAG_id_tag_update(id, recalc);
+ WM_main_add_notifier(NC_OBJECT | ND_PARTICLE | NA_EDITED, NULL);
+ break;
+ }
}
}
@@ -421,6 +436,29 @@ static void rna_Envmap_update_generic(Main *bmain, Scene *scene, PointerRNA *ptr
rna_Texture_update(bmain, scene, ptr);
}
+static PointerRNA rna_PointDensity_psys_get(PointerRNA *ptr)
+{
+ PointDensity *pd = ptr->data;
+ Object *ob = pd->object;
+ ParticleSystem *psys = NULL;
+ PointerRNA value;
+
+ if (ob && pd->psys)
+ psys = BLI_findlink(&ob->particlesystem, pd->psys - 1);
+
+ RNA_pointer_create(&ob->id, &RNA_ParticleSystem, psys, &value);
+ return value;
+}
+
+static void rna_PointDensity_psys_set(PointerRNA *ptr, PointerRNA value)
+{
+ PointDensity *pd = ptr->data;
+ Object *ob = pd->object;
+
+ if (ob && value.id.data == ob)
+ pd->psys = BLI_findindex(&ob->particlesystem, value.data) + 1;
+}
+
static char *rna_PointDensity_path(PointerRNA *UNUSED(ptr))
{
return BLI_sprintfN("point_density");
@@ -1661,6 +1699,13 @@ static void rna_def_texture_pointdensity(BlenderRNA *brna)
RNA_def_property_flag(prop, PROP_EDITABLE);
RNA_def_property_update(prop, 0, "rna_Texture_update");
+ prop = RNA_def_property(srna, "particle_system", PROP_POINTER, PROP_NONE);
+ RNA_def_property_ui_text(prop, "Particle System", "Particle System to render as points");
+ RNA_def_property_struct_type(prop, "ParticleSystem");
+ RNA_def_property_pointer_funcs(prop, "rna_PointDensity_psys_get", "rna_PointDensity_psys_set", NULL, NULL);
+ RNA_def_property_flag(prop, PROP_EDITABLE);
+ RNA_def_property_update(prop, 0, "rna_Texture_update");
+
prop = RNA_def_property(srna, "particle_cache_space", PROP_ENUM, PROP_NONE);
RNA_def_property_enum_sdna(prop, NULL, "psys_cache_space");
RNA_def_property_enum_items(prop, particle_cache_items);
diff --git a/source/blender/makesrna/intern/rna_userdef.c b/source/blender/makesrna/intern/rna_userdef.c
index 0a00b966aa9..beb1d890ba9 100644
--- a/source/blender/makesrna/intern/rna_userdef.c
+++ b/source/blender/makesrna/intern/rna_userdef.c
@@ -3787,6 +3787,10 @@ static void rna_def_userdef_edit(BlenderRNA *brna)
prop = RNA_def_property(srna, "use_duplicate_action", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_boolean_sdna(prop, NULL, "dupflag", USER_DUP_ACT);
RNA_def_property_ui_text(prop, "Duplicate Action", "Causes actions to be duplicated with the object");
+
+ prop = RNA_def_property(srna, "use_duplicate_particle", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "dupflag", USER_DUP_PSYS);
+ RNA_def_property_ui_text(prop, "Duplicate Particle", "Causes particle systems to be duplicated with the object");
/* currently only used for insert offset (aka auto-offset), maybe also be useful for later stuff though */
prop = RNA_def_property(srna, "node_margin", PROP_INT, PROP_NONE);