29 "Go to assigned object or loudest assigned signal source"},
34 "Get away from assigned object or loudest assigned signal source"},
39 "Maneuver to avoid collisions with other boids and deflector objects in "
46 "Move to center of neighbors and match their velocity"},
51 "Follow a boid or assigned object"},
56 "Maintain speed, flight level or wander"},
59 {eBoidRuleType_Protect,
63 "Go to enemy closest to target and attack when in range"},
68 "Find a deflector move to its other side from closest enemy"},
69 {eBoidRuleType_FollowPath,
73 "Move along a assigned curve or closest curve in a group"},
74 {eBoidRuleType_FollowWall,
78 "Move next to a deflector object's in direction of its tangent"},
80 {0,
nullptr, 0,
nullptr,
nullptr},
89 "Rules are gone through top to bottom (only the first rule which effect is above "
90 "fuzziness threshold is evaluated)"},
93 {0,
nullptr, 0,
nullptr,
nullptr},
101# include <fmt/format.h>
117 if (ptr->type == RNA_ParticleSystem) {
132 if (ptr->type == RNA_ParticleSystem) {
152 switch (rule->type) {
154 return RNA_BoidRuleGoal;
156 return RNA_BoidRuleAvoid;
158 return RNA_BoidRuleAvoidCollision;
160 return RNA_BoidRuleFollowLeader;
162 return RNA_BoidRuleAverageSpeed;
164 return RNA_BoidRuleFight;
170static std::optional<std::string> rna_BoidRule_path(
const PointerRNA *ptr)
173 char name_esc[
sizeof(rule->name) * 2];
175 return fmt::format(
"rules[\"{}\"]", name_esc);
183 for (; rule; rule = rule->next) {
190static void rna_BoidState_active_boid_rule_index_range(
198static int rna_BoidState_active_boid_rule_index_get(
PointerRNA *ptr)
204 for (; rule; rule = rule->next, i++) {
212static void rna_BoidState_active_boid_rule_index_set(
PointerRNA *ptr,
int value)
218 for (; rule; rule = rule->next, i++) {
228static int particle_id_check(
const PointerRNA *ptr)
230 const ID *
id = ptr->owner_id;
235static std::optional<std::string> rna_BoidSettings_path(
const PointerRNA *ptr)
239 if (particle_id_check(ptr)) {
242 if (part->boids == boids) {
261static void rna_BoidSettings_active_boid_state_index_range(
266 *
max =
max_ii(0, boids->states.count() - 1);
269static int rna_BoidSettings_active_boid_state_index_get(
PointerRNA *ptr)
283static void rna_BoidSettings_active_boid_state_index_set(
PointerRNA *ptr,
int value)
294 state->flag &= ~BOIDSTATE_CURRENT;
349 prop,
"Fear Factor",
"Avoid object if danger from it is above this threshold");
358 srna =
RNA_def_struct(brna,
"BoidRuleAvoidCollision",
"BoidRule");
524 prop,
"rna_BoidState_active_boid_rule_get",
nullptr,
nullptr,
nullptr);
529 "rna_BoidState_active_boid_rule_index_get",
530 "rna_BoidState_active_boid_rule_index_set",
531 "rna_BoidState_active_boid_rule_index_range");
590 prop,
"rna_BoidSettings_active_boid_state_get",
nullptr,
nullptr,
nullptr);
595 "rna_BoidSettings_active_boid_state_index_get",
596 "rna_BoidSettings_active_boid_state_index_set",
597 "rna_BoidSettings_active_boid_state_index_range");
631 prop,
"Min Air Speed",
"Minimum speed in air (relative to maximum speed)");
644 prop,
"Max Air Acceleration",
"Maximum acceleration in air (relative to maximum speed)");
651 "Max Air Angular Velocity",
652 "Maximum angular velocity in air (relative to 180 degrees)");
658 prop,
"Air Personal Space",
"Radius of boids personal space in air (% of particle size)");
676 prop,
"Max Land Acceleration",
"Maximum acceleration on land (relative to maximum speed)");
683 "Max Land Angular Velocity",
684 "Maximum angular velocity on land (relative to 180 degrees)");
690 prop,
"Land Personal Space",
"Radius of boids personal space on land (% of particle size)");
696 prop,
"Land Stick Force",
"How strong a force must be to start effecting a boid on land");
#define BOIDSTATE_CURRENT
#define BRULE_LEADER_IN_LINE
void WM_main_add_notifier(uint type, void *reference)
static const EnumPropertyItem boidruleset_type_items[]
void RNA_def_struct_ui_text(StructRNA *srna, const char *name, const char *description)
void RNA_def_property_ui_text(PropertyRNA *prop, const char *name, const char *description)
static void rna_def_boidrule_fight(BlenderRNA *brna)
static void rna_def_boidrule_avoid_collision(BlenderRNA *brna)
void RNA_def_property_pointer_sdna(PropertyRNA *prop, const char *structname, const char *propname)
void RNA_def_property_pointer_funcs(PropertyRNA *prop, const char *get, const char *set, const char *type_fn, const char *poll)
void RNA_def_struct_refine_func(StructRNA *srna, const char *refine)
void RNA_def_property_struct_type(PropertyRNA *prop, const char *type)
MINLINE int max_ii(int a, int b)
void RNA_def_boid(BlenderRNA *brna)
static void rna_def_boidrule(BlenderRNA *brna)
void RNA_def_property_float_sdna(PropertyRNA *prop, const char *structname, const char *propname)
PropertyRNA * RNA_def_property(StructOrFunctionRNA *cont_, const char *identifier_c_str, int type, int subtype)
static void rna_def_boid_settings(BlenderRNA *brna)
void RNA_def_struct_sdna(StructRNA *srna, const char *structname)
void RNA_def_property_enum_items(PropertyRNA *prop, const EnumPropertyItem *item)
void RNA_def_property_int_funcs(PropertyRNA *prop, const char *get, const char *set, const char *range)
void DEG_id_tag_update(ID *id, unsigned int flags)
void RNA_def_property_boolean_sdna(PropertyRNA *prop, const char *structname, const char *propname, int64_t booleanbit)
void RNA_def_property_range(PropertyRNA *prop, double min, double max)
char char size_t BLI_str_escape(char *__restrict dst, StringRef src, size_t dst_maxncpy) ATTR_NONNULL(1)
void RNA_def_struct_path_func(StructRNA *srna, const char *path)
@ BRULE_ACOLL_WITH_DEFLECTORS
const EnumPropertyItem rna_enum_boidrule_type_items[]
void RNA_def_property_enum_sdna(PropertyRNA *prop, const char *structname, const char *propname)
@ BRULE_GOAL_AVOID_PREDICT
void RNA_def_property_clear_flag(PropertyRNA *prop, PropertyFlag flag)
void RNA_def_property_flag(PropertyRNA *prop, PropertyFlag flag)
StructRNA * RNA_def_struct(BlenderRNA *brna, const char *identifier, const char *from)
ID_Type GS(const char *name)
void RNA_def_property_int_sdna(PropertyRNA *prop, const char *structname, const char *propname)
void RNA_def_property_update(PropertyRNA *prop, int noteflag, const char *func)
PointerRNA RNA_pointer_create_with_parent(const PointerRNA &parent, StructRNA *type, void *data)
void DEG_relations_tag_update(Main *bmain)
static void rna_def_boidrule_goal(BlenderRNA *brna)
@ eBoidRulesetType_Random
@ eBoidRulesetType_Average
void RNA_def_struct_name_property(StructRNA *srna, PropertyRNA *prop, const bool allow_replace)
static void rna_def_boidrule_average_speed(BlenderRNA *brna)
@ eBoidRuleType_AverageSpeed
@ eBoidRuleType_FollowLeader
@ eBoidRuleType_AvoidCollision
static void rna_def_boidrule_avoid(BlenderRNA *brna)
static void rna_def_boidrule_follow_leader(BlenderRNA *brna)
static void rna_def_boidstate(BlenderRNA *brna)