Merge branch 'master' into blender2.8

This commit is contained in:
Campbell Barton 2018-08-14 10:02:43 +10:00
commit 5e8dbafb5b
5 changed files with 702 additions and 701 deletions

View File

@ -59,7 +59,7 @@ static int rule_add_exec(bContext *C, wmOperator *op)
{
PointerRNA ptr = CTX_data_pointer_get_type(C, "particle_settings", &RNA_ParticleSettings);
ParticleSettings *part = ptr.data;
int type= RNA_enum_get(op->ptr, "type");
int type = RNA_enum_get(op->ptr, "type");
BoidRule *rule;
BoidState *state;
@ -69,7 +69,7 @@ static int rule_add_exec(bContext *C, wmOperator *op)
state = boid_get_current_state(part->boids);
for (rule=state->rules.first; rule; rule=rule->next)
for (rule = state->rules.first; rule; rule = rule->next)
rule->flag &= ~BOIDRULE_CURRENT;
rule = boid_new_rule(type);
@ -77,7 +77,7 @@ static int rule_add_exec(bContext *C, wmOperator *op)
BLI_addtail(&state->rules, rule);
DEG_id_tag_update(&part->id, OB_RECALC_DATA|PSYS_RECALC_RESET);
DEG_id_tag_update(&part->id, OB_RECALC_DATA | PSYS_RECALC_RESET);
return OPERATOR_FINISHED;
}
@ -94,7 +94,7 @@ void BOID_OT_rule_add(wmOperatorType *ot)
ot->exec = rule_add_exec;
/* flags */
ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
ot->prop = RNA_def_enum(ot->srna, "type", rna_enum_boidrule_type_items, 0, "Type", "");
}
@ -111,7 +111,7 @@ static int rule_del_exec(bContext *C, wmOperator *UNUSED(op))
state = boid_get_current_state(part->boids);
for (rule=state->rules.first; rule; rule=rule->next) {
for (rule = state->rules.first; rule; rule = rule->next) {
if (rule->flag & BOIDRULE_CURRENT) {
BLI_remlink(&state->rules, rule);
MEM_freeN(rule);
@ -124,7 +124,7 @@ static int rule_del_exec(bContext *C, wmOperator *UNUSED(op))
rule->flag |= BOIDRULE_CURRENT;
DEG_relations_tag_update(bmain);
DEG_id_tag_update(&part->id, OB_RECALC_DATA|PSYS_RECALC_RESET);
DEG_id_tag_update(&part->id, OB_RECALC_DATA | PSYS_RECALC_RESET);
return OPERATOR_FINISHED;
}
@ -140,7 +140,7 @@ void BOID_OT_rule_del(wmOperatorType *ot)
ot->exec = rule_del_exec;
/* flags */
ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
}
/************************ move up/down boid rule operators *********************/
@ -155,12 +155,12 @@ static int rule_move_up_exec(bContext *C, wmOperator *UNUSED(op))
return OPERATOR_CANCELLED;
state = boid_get_current_state(part->boids);
for (rule = state->rules.first; rule; rule=rule->next) {
for (rule = state->rules.first; rule; rule = rule->next) {
if (rule->flag & BOIDRULE_CURRENT && rule->prev) {
BLI_remlink(&state->rules, rule);
BLI_insertlinkbefore(&state->rules, rule->prev, rule);
DEG_id_tag_update(&part->id, OB_RECALC_DATA|PSYS_RECALC_RESET);
DEG_id_tag_update(&part->id, OB_RECALC_DATA | PSYS_RECALC_RESET);
break;
}
}
@ -177,7 +177,7 @@ void BOID_OT_rule_move_up(wmOperatorType *ot)
ot->exec = rule_move_up_exec;
/* flags */
ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
}
static int rule_move_down_exec(bContext *C, wmOperator *UNUSED(op))
@ -191,12 +191,12 @@ static int rule_move_down_exec(bContext *C, wmOperator *UNUSED(op))
return OPERATOR_CANCELLED;
state = boid_get_current_state(part->boids);
for (rule = state->rules.first; rule; rule=rule->next) {
for (rule = state->rules.first; rule; rule = rule->next) {
if (rule->flag & BOIDRULE_CURRENT && rule->next) {
BLI_remlink(&state->rules, rule);
BLI_insertlinkafter(&state->rules, rule->next, rule);
DEG_id_tag_update(&part->id, OB_RECALC_DATA|PSYS_RECALC_RESET);
DEG_id_tag_update(&part->id, OB_RECALC_DATA | PSYS_RECALC_RESET);
break;
}
}
@ -213,7 +213,7 @@ void BOID_OT_rule_move_down(wmOperatorType *ot)
ot->exec = rule_move_down_exec;
/* flags */
ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
}
@ -227,7 +227,7 @@ static int state_add_exec(bContext *C, wmOperator *UNUSED(op))
if (!part || part->phystype != PART_PHYS_BOIDS)
return OPERATOR_CANCELLED;
for (state=part->boids->states.first; state; state=state->next)
for (state = part->boids->states.first; state; state = state->next)
state->flag &= ~BOIDSTATE_CURRENT;
state = boid_new_state(part->boids);
@ -249,7 +249,7 @@ void BOID_OT_state_add(wmOperatorType *ot)
ot->exec = state_add_exec;
/* flags */
ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
}
static int state_del_exec(bContext *C, wmOperator *UNUSED(op))
{
@ -261,7 +261,7 @@ static int state_del_exec(bContext *C, wmOperator *UNUSED(op))
if (!part || part->phystype != PART_PHYS_BOIDS)
return OPERATOR_CANCELLED;
for (state=part->boids->states.first; state; state=state->next) {
for (state = part->boids->states.first; state; state = state->next) {
if (state->flag & BOIDSTATE_CURRENT) {
BLI_remlink(&part->boids->states, state);
MEM_freeN(state);
@ -280,7 +280,7 @@ static int state_del_exec(bContext *C, wmOperator *UNUSED(op))
state->flag |= BOIDSTATE_CURRENT;
DEG_relations_tag_update(bmain);
DEG_id_tag_update(&part->id, OB_RECALC_DATA|PSYS_RECALC_RESET);
DEG_id_tag_update(&part->id, OB_RECALC_DATA | PSYS_RECALC_RESET);
return OPERATOR_FINISHED;
}
@ -296,7 +296,7 @@ void BOID_OT_state_del(wmOperatorType *ot)
ot->exec = state_del_exec;
/* flags */
ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
}
/************************ move up/down boid state operators *********************/
@ -312,7 +312,7 @@ static int state_move_up_exec(bContext *C, wmOperator *UNUSED(op))
boids = part->boids;
for (state = boids->states.first; state; state=state->next) {
for (state = boids->states.first; state; state = state->next) {
if (state->flag & BOIDSTATE_CURRENT && state->prev) {
BLI_remlink(&boids->states, state);
BLI_insertlinkbefore(&boids->states, state->prev, state);
@ -332,7 +332,7 @@ void BOID_OT_state_move_up(wmOperatorType *ot)
ot->exec = state_move_up_exec;
/* flags */
ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
}
static int state_move_down_exec(bContext *C, wmOperator *UNUSED(op))
@ -347,11 +347,11 @@ static int state_move_down_exec(bContext *C, wmOperator *UNUSED(op))
boids = part->boids;
for (state = boids->states.first; state; state=state->next) {
for (state = boids->states.first; state; state = state->next) {
if (state->flag & BOIDSTATE_CURRENT && state->next) {
BLI_remlink(&boids->states, state);
BLI_insertlinkafter(&boids->states, state->next, state);
DEG_id_tag_update(&part->id, OB_RECALC_DATA|PSYS_RECALC_RESET);
DEG_id_tag_update(&part->id, OB_RECALC_DATA | PSYS_RECALC_RESET);
break;
}
}
@ -368,5 +368,5 @@ void BOID_OT_state_move_down(wmOperatorType *ot)
ot->exec = state_move_down_exec;
/* flags */
ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
}

File diff suppressed because it is too large Load Diff

View File

@ -70,15 +70,15 @@ static void undoptcache_from_editcache(PTCacheUndo *undo, PTCacheEdit *edit)
size_t mem_used_prev = MEM_get_memory_in_use();
undo->totpoint= edit->totpoint;
undo->totpoint = edit->totpoint;
if (edit->psys) {
ParticleData *pa;
pa= undo->particles= MEM_dupallocN(edit->psys->particles);
pa = undo->particles = MEM_dupallocN(edit->psys->particles);
for (i=0; i<edit->totpoint; i++, pa++) {
pa->hair= MEM_dupallocN(pa->hair);
for (i = 0; i < edit->totpoint; i++, pa++) {
pa->hair = MEM_dupallocN(pa->hair);
}
undo->psys_flag = edit->psys->flag;
@ -89,18 +89,18 @@ static void undoptcache_from_editcache(PTCacheUndo *undo, PTCacheEdit *edit)
BLI_duplicatelist(&undo->mem_cache, &edit->pid.cache->mem_cache);
pm = undo->mem_cache.first;
for (; pm; pm=pm->next) {
for (i=0; i<BPHYS_TOT_DATA; i++) {
for (; pm; pm = pm->next) {
for (i = 0; i < BPHYS_TOT_DATA; i++) {
pm->data[i] = MEM_dupallocN(pm->data[i]);
}
}
}
point= undo->points = MEM_dupallocN(edit->points);
point = undo->points = MEM_dupallocN(edit->points);
undo->totpoint = edit->totpoint;
for (i=0; i<edit->totpoint; i++, point++) {
point->keys= MEM_dupallocN(point->keys);
for (i = 0; i < edit->totpoint; i++, point++) {
point->keys = MEM_dupallocN(point->keys);
/* no need to update edit key->co & key->time pointers here */
}
@ -133,28 +133,28 @@ static void undoptcache_to_editcache(PTCacheUndo *undo, PTCacheEdit *edit)
}
if (edit->mirror_cache) {
MEM_freeN(edit->mirror_cache);
edit->mirror_cache= NULL;
edit->mirror_cache = NULL;
}
edit->points= MEM_dupallocN(undo->points);
edit->points = MEM_dupallocN(undo->points);
edit->totpoint = undo->totpoint;
LOOP_POINTS {
point->keys= MEM_dupallocN(point->keys);
point->keys = MEM_dupallocN(point->keys);
}
if (psys) {
psys->particles= MEM_dupallocN(undo->particles);
psys->particles = MEM_dupallocN(undo->particles);
psys->totpart= undo->totpoint;
psys->totpart = undo->totpoint;
LOOP_POINTS {
pa = psys->particles + p;
hkey= pa->hair = MEM_dupallocN(pa->hair);
hkey = pa->hair = MEM_dupallocN(pa->hair);
LOOP_KEYS {
key->co= hkey->co;
key->time= &hkey->time;
key->co = hkey->co;
key->time = &hkey->time;
hkey++;
}
}
@ -171,7 +171,7 @@ static void undoptcache_to_editcache(PTCacheUndo *undo, PTCacheEdit *edit)
pm = edit->pid.cache->mem_cache.first;
for (; pm; pm=pm->next) {
for (; pm; pm = pm->next) {
for (i = 0; i < BPHYS_TOT_DATA; i++) {
pm->data[i] = MEM_dupallocN(pm->data[i]);
}
@ -197,7 +197,7 @@ static void undoptcache_free_data(PTCacheUndo *undo)
PTCacheEditPoint *point;
int i;
for (i = 0, point=undo->points; i < undo->totpoint; i++, point++) {
for (i = 0, point = undo->points; i < undo->totpoint; i++, point++) {
if (undo->particles && (undo->particles + i)->hair) {
MEM_freeN((undo->particles + i)->hair);
}

View File

@ -32,19 +32,19 @@
#ifndef __PARTICLE_EDIT_UTILDEFNIES_H__
#define __PARTICLE_EDIT_UTILDEFNIES_H__
#define KEY_K PTCacheEditKey *key; int k
#define POINT_P PTCacheEditPoint *point; int p
#define LOOP_POINTS for (p=0, point=edit->points; p<edit->totpoint; p++, point++)
#define LOOP_VISIBLE_POINTS for (p=0, point=edit->points; p<edit->totpoint; p++, point++) if (!(point->flag & PEP_HIDE))
#define LOOP_SELECTED_POINTS for (p=0, point=edit->points; p<edit->totpoint; p++, point++) if (point_is_selected(point))
#define LOOP_UNSELECTED_POINTS for (p=0, point=edit->points; p<edit->totpoint; p++, point++) if (!point_is_selected(point))
#define LOOP_EDITED_POINTS for (p=0, point=edit->points; p<edit->totpoint; p++, point++) if (point->flag & PEP_EDIT_RECALC)
#define LOOP_TAGGED_POINTS for (p=0, point=edit->points; p<edit->totpoint; p++, point++) if (point->flag & PEP_TAG)
#define LOOP_KEYS for (k=0, key=point->keys; k<point->totkey; k++, key++)
#define LOOP_VISIBLE_KEYS for (k=0, key=point->keys; k<point->totkey; k++, key++) if (!(key->flag & PEK_HIDE))
#define LOOP_SELECTED_KEYS for (k=0, key=point->keys; k<point->totkey; k++, key++) if ((key->flag & PEK_SELECT) && !(key->flag & PEK_HIDE))
#define LOOP_TAGGED_KEYS for (k=0, key=point->keys; k<point->totkey; k++, key++) if (key->flag & PEK_TAG)
#define KEY_K PTCacheEditKey *key; int k
#define POINT_P PTCacheEditPoint *point; int p
#define LOOP_POINTS for (p = 0, point = edit->points; p < edit->totpoint; p++, point++)
#define LOOP_VISIBLE_POINTS for (p = 0, point = edit->points; p < edit->totpoint; p++, point++) if (!(point->flag & PEP_HIDE))
#define LOOP_SELECTED_POINTS for (p = 0, point = edit->points; p < edit->totpoint; p++, point++) if (point_is_selected(point))
#define LOOP_UNSELECTED_POINTS for (p = 0, point = edit->points; p < edit->totpoint; p++, point++) if (!point_is_selected(point))
#define LOOP_EDITED_POINTS for (p = 0, point = edit->points; p < edit->totpoint; p++, point++) if (point->flag & PEP_EDIT_RECALC)
#define LOOP_TAGGED_POINTS for (p = 0, point = edit->points; p < edit->totpoint; p++, point++) if (point->flag & PEP_TAG)
#define LOOP_KEYS for (k = 0, key = point->keys; k < point->totkey; k++, key++)
#define LOOP_VISIBLE_KEYS for (k = 0, key = point->keys; k < point->totkey; k++, key++) if (!(key->flag & PEK_HIDE))
#define LOOP_SELECTED_KEYS for (k = 0, key = point->keys; k < point->totkey; k++, key++) if ((key->flag & PEK_SELECT) && !(key->flag & PEK_HIDE))
#define LOOP_TAGGED_KEYS for (k = 0, key = point->keys; k < point->totkey; k++, key++) if (key->flag & PEK_TAG)
#define KEY_WCO ((key->flag & PEK_USE_WCO) ? key->world_co : key->co)
#define KEY_WCO ((key->flag & PEK_USE_WCO) ? key->world_co : key->co)
#endif /* __PARTICLE_EDIT_UTILDEFNIES_H__ */

View File

@ -82,7 +82,7 @@ static float I[4][4] = {{1.0f, 0.0f, 0.0f, 0.0f}, {0.0f, 1.0f, 0.0f, 0.0f}, {0.0
static int particle_system_add_exec(bContext *C, wmOperator *UNUSED(op))
{
Main *bmain = CTX_data_main(C);
Object *ob= ED_object_context(C);
Object *ob = ED_object_context(C);
Scene *scene = CTX_data_scene(C);
if (!scene || !ob)
@ -90,8 +90,8 @@ static int particle_system_add_exec(bContext *C, wmOperator *UNUSED(op))
object_add_particle_system(bmain, scene, ob, NULL);
WM_event_add_notifier(C, NC_OBJECT|ND_PARTICLE, ob);
WM_event_add_notifier(C, NC_OBJECT|ND_POINTCACHE, ob);
WM_event_add_notifier(C, NC_OBJECT | ND_PARTICLE, ob);
WM_event_add_notifier(C, NC_OBJECT | ND_POINTCACHE, ob);
return OPERATOR_FINISHED;
}
@ -108,7 +108,7 @@ void OBJECT_OT_particle_system_add(wmOperatorType *ot)
ot->exec = particle_system_add_exec;
/* flags */
ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
}
static int particle_system_remove_exec(bContext *C, wmOperator *UNUSED(op))
@ -131,13 +131,13 @@ static int particle_system_remove_exec(bContext *C, wmOperator *UNUSED(op))
if (mode_orig & OB_MODE_PARTICLE_EDIT) {
if ((ob->mode & OB_MODE_PARTICLE_EDIT) == 0) {
if (view_layer->basact && view_layer->basact->object == ob) {
WM_event_add_notifier(C, NC_SCENE|ND_MODE|NS_MODE_OBJECT, NULL);
WM_event_add_notifier(C, NC_SCENE | ND_MODE | NS_MODE_OBJECT, NULL);
}
}
}
WM_event_add_notifier(C, NC_OBJECT|ND_PARTICLE, ob);
WM_event_add_notifier(C, NC_OBJECT|ND_POINTCACHE, ob);
WM_event_add_notifier(C, NC_OBJECT | ND_PARTICLE, ob);
WM_event_add_notifier(C, NC_OBJECT | ND_POINTCACHE, ob);
return OPERATOR_FINISHED;
}
@ -154,7 +154,7 @@ void OBJECT_OT_particle_system_remove(wmOperatorType *ot)
ot->exec = particle_system_remove_exec;
/* flags */
ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
}
/********************** new particle settings operator *********************/
@ -167,7 +167,7 @@ static bool psys_poll(bContext *C)
static int new_particle_settings_exec(bContext *C, wmOperator *UNUSED(op))
{
Main *bmain= CTX_data_main(C);
Main *bmain = CTX_data_main(C);
ParticleSystem *psys;
ParticleSettings *part = NULL;
Object *ob;
@ -179,11 +179,11 @@ static int new_particle_settings_exec(bContext *C, wmOperator *UNUSED(op))
/* add or copy particle setting */
if (psys->part)
part= BKE_particlesettings_copy(bmain, psys->part);
part = BKE_particlesettings_copy(bmain, psys->part);
else
part= BKE_particlesettings_add(bmain, "ParticleSettings");
part = BKE_particlesettings_add(bmain, "ParticleSettings");
ob= ptr.id.data;
ob = ptr.id.data;
if (psys->part)
id_us_min(&psys->part->id);
@ -195,7 +195,7 @@ static int new_particle_settings_exec(bContext *C, wmOperator *UNUSED(op))
DEG_relations_tag_update(bmain);
DEG_id_tag_update(&ob->id, OB_RECALC_DATA);
WM_event_add_notifier(C, NC_OBJECT|ND_PARTICLE, ob);
WM_event_add_notifier(C, NC_OBJECT | ND_PARTICLE, ob);
return OPERATOR_FINISHED;
}
@ -212,7 +212,7 @@ void PARTICLE_OT_new(wmOperatorType *ot)
ot->poll = psys_poll;
/* flags */
ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
}
/********************** keyed particle target operators *********************/
@ -221,7 +221,7 @@ static int new_particle_target_exec(bContext *C, wmOperator *UNUSED(op))
{
Main *bmain = CTX_data_main(C);
PointerRNA ptr = CTX_data_pointer_get_type(C, "particle_system", &RNA_ParticleSystem);
ParticleSystem *psys= ptr.data;
ParticleSystem *psys = ptr.data;
Object *ob = ptr.id.data;
ParticleTarget *pt;
@ -230,7 +230,7 @@ static int new_particle_target_exec(bContext *C, wmOperator *UNUSED(op))
return OPERATOR_CANCELLED;
pt = psys->targets.first;
for (; pt; pt=pt->next)
for (; pt; pt = pt->next)
pt->flag &= ~PTARGET_CURRENT;
pt = MEM_callocN(sizeof(ParticleTarget), "keyed particle target");
@ -243,7 +243,7 @@ static int new_particle_target_exec(bContext *C, wmOperator *UNUSED(op))
DEG_relations_tag_update(bmain);
DEG_id_tag_update(&ob->id, OB_RECALC_DATA);
WM_event_add_notifier(C, NC_OBJECT|ND_PARTICLE, ob);
WM_event_add_notifier(C, NC_OBJECT | ND_PARTICLE, ob);
return OPERATOR_FINISHED;
}
@ -259,14 +259,14 @@ void PARTICLE_OT_new_target(wmOperatorType *ot)
ot->exec = new_particle_target_exec;
/* flags */
ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
}
static int remove_particle_target_exec(bContext *C, wmOperator *UNUSED(op))
{
Main *bmain = CTX_data_main(C);
PointerRNA ptr = CTX_data_pointer_get_type(C, "particle_system", &RNA_ParticleSystem);
ParticleSystem *psys= ptr.data;
ParticleSystem *psys = ptr.data;
Object *ob = ptr.id.data;
ParticleTarget *pt;
@ -275,7 +275,7 @@ static int remove_particle_target_exec(bContext *C, wmOperator *UNUSED(op))
return OPERATOR_CANCELLED;
pt = psys->targets.first;
for (; pt; pt=pt->next) {
for (; pt; pt = pt->next) {
if (pt->flag & PTARGET_CURRENT) {
BLI_remlink(&psys->targets, pt);
MEM_freeN(pt);
@ -291,7 +291,7 @@ static int remove_particle_target_exec(bContext *C, wmOperator *UNUSED(op))
DEG_relations_tag_update(bmain);
DEG_id_tag_update(&ob->id, OB_RECALC_DATA);
WM_event_add_notifier(C, NC_OBJECT|ND_PARTICLE, ob);
WM_event_add_notifier(C, NC_OBJECT | ND_PARTICLE, ob);
return OPERATOR_FINISHED;
}
@ -307,7 +307,7 @@ void PARTICLE_OT_target_remove(wmOperatorType *ot)
ot->exec = remove_particle_target_exec;
/* flags */
ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
}
/************************ move up particle target operator *********************/
@ -315,7 +315,7 @@ void PARTICLE_OT_target_remove(wmOperatorType *ot)
static int target_move_up_exec(bContext *C, wmOperator *UNUSED(op))
{
PointerRNA ptr = CTX_data_pointer_get_type(C, "particle_system", &RNA_ParticleSystem);
ParticleSystem *psys= ptr.data;
ParticleSystem *psys = ptr.data;
Object *ob = ptr.id.data;
ParticleTarget *pt;
@ -323,13 +323,13 @@ static int target_move_up_exec(bContext *C, wmOperator *UNUSED(op))
return OPERATOR_CANCELLED;
pt = psys->targets.first;
for (; pt; pt=pt->next) {
for (; pt; pt = pt->next) {
if (pt->flag & PTARGET_CURRENT && pt->prev) {
BLI_remlink(&psys->targets, pt);
BLI_insertlinkbefore(&psys->targets, pt->prev, pt);
DEG_id_tag_update(&ob->id, OB_RECALC_DATA);
WM_event_add_notifier(C, NC_OBJECT|ND_PARTICLE, ob);
WM_event_add_notifier(C, NC_OBJECT | ND_PARTICLE, ob);
break;
}
}
@ -346,7 +346,7 @@ void PARTICLE_OT_target_move_up(wmOperatorType *ot)
ot->exec = target_move_up_exec;
/* flags */
ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
}
/************************ move down particle target operator *********************/
@ -354,20 +354,20 @@ void PARTICLE_OT_target_move_up(wmOperatorType *ot)
static int target_move_down_exec(bContext *C, wmOperator *UNUSED(op))
{
PointerRNA ptr = CTX_data_pointer_get_type(C, "particle_system", &RNA_ParticleSystem);
ParticleSystem *psys= ptr.data;
ParticleSystem *psys = ptr.data;
Object *ob = ptr.id.data;
ParticleTarget *pt;
if (!psys)
return OPERATOR_CANCELLED;
pt = psys->targets.first;
for (; pt; pt=pt->next) {
for (; pt; pt = pt->next) {
if (pt->flag & PTARGET_CURRENT && pt->next) {
BLI_remlink(&psys->targets, pt);
BLI_insertlinkafter(&psys->targets, pt->next, pt);
DEG_id_tag_update(&ob->id, OB_RECALC_DATA);
WM_event_add_notifier(C, NC_OBJECT|ND_PARTICLE, ob);
WM_event_add_notifier(C, NC_OBJECT | ND_PARTICLE, ob);
break;
}
}
@ -384,7 +384,7 @@ void PARTICLE_OT_target_move_down(wmOperatorType *ot)
ot->exec = target_move_down_exec;
/* flags */
ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
}
/************************ refresh dupli objects *********************/
@ -392,14 +392,14 @@ void PARTICLE_OT_target_move_down(wmOperatorType *ot)
static int dupliob_refresh_exec(bContext *C, wmOperator *UNUSED(op))
{
PointerRNA ptr = CTX_data_pointer_get_type(C, "particle_system", &RNA_ParticleSystem);
ParticleSystem *psys= ptr.data;
ParticleSystem *psys = ptr.data;
if (!psys)
return OPERATOR_CANCELLED;
psys_check_group_weights(psys->part);
DEG_id_tag_update(&psys->part->id, OB_RECALC_DATA | PSYS_RECALC_REDO);
WM_event_add_notifier(C, NC_OBJECT|ND_PARTICLE, NULL);
WM_event_add_notifier(C, NC_OBJECT | ND_PARTICLE, NULL);
return OPERATOR_FINISHED;
}
@ -413,7 +413,7 @@ void PARTICLE_OT_dupliob_refresh(wmOperatorType *ot)
ot->exec = dupliob_refresh_exec;
/* flags */
ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
}
/************************ move up particle dupliweight operator *********************/
@ -421,7 +421,7 @@ void PARTICLE_OT_dupliob_refresh(wmOperatorType *ot)
static int dupliob_move_up_exec(bContext *C, wmOperator *UNUSED(op))
{
PointerRNA ptr = CTX_data_pointer_get_type(C, "particle_system", &RNA_ParticleSystem);
ParticleSystem *psys= ptr.data;
ParticleSystem *psys = ptr.data;
ParticleSettings *part;
ParticleDupliWeight *dw;
@ -429,13 +429,13 @@ static int dupliob_move_up_exec(bContext *C, wmOperator *UNUSED(op))
return OPERATOR_CANCELLED;
part = psys->part;
for (dw=part->dupliweights.first; dw; dw=dw->next) {
for (dw = part->dupliweights.first; dw; dw = dw->next) {
if (dw->flag & PART_DUPLIW_CURRENT && dw->prev) {
BLI_remlink(&part->dupliweights, dw);
BLI_insertlinkbefore(&part->dupliweights, dw->prev, dw);
DEG_id_tag_update(&part->id, OB_RECALC_DATA | PSYS_RECALC_REDO);
WM_event_add_notifier(C, NC_OBJECT|ND_PARTICLE, NULL);
WM_event_add_notifier(C, NC_OBJECT | ND_PARTICLE, NULL);
break;
}
}
@ -452,7 +452,7 @@ void PARTICLE_OT_dupliob_move_up(wmOperatorType *ot)
ot->exec = dupliob_move_up_exec;
/* flags */
ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
}
/********************** particle dupliweight operators *********************/
@ -460,14 +460,14 @@ void PARTICLE_OT_dupliob_move_up(wmOperatorType *ot)
static int copy_particle_dupliob_exec(bContext *C, wmOperator *UNUSED(op))
{
PointerRNA ptr = CTX_data_pointer_get_type(C, "particle_system", &RNA_ParticleSystem);
ParticleSystem *psys= ptr.data;
ParticleSystem *psys = ptr.data;
ParticleSettings *part;
ParticleDupliWeight *dw;
if (!psys)
return OPERATOR_CANCELLED;
part = psys->part;
for (dw=part->dupliweights.first; dw; dw=dw->next) {
for (dw = part->dupliweights.first; dw; dw = dw->next) {
if (dw->flag & PART_DUPLIW_CURRENT) {
dw->flag &= ~PART_DUPLIW_CURRENT;
dw = MEM_dupallocN(dw);
@ -475,7 +475,7 @@ static int copy_particle_dupliob_exec(bContext *C, wmOperator *UNUSED(op))
BLI_addhead(&part->dupliweights, dw);
DEG_id_tag_update(&part->id, OB_RECALC_DATA | PSYS_RECALC_REDO);
WM_event_add_notifier(C, NC_OBJECT|ND_PARTICLE, NULL);
WM_event_add_notifier(C, NC_OBJECT | ND_PARTICLE, NULL);
break;
}
}
@ -494,13 +494,13 @@ void PARTICLE_OT_dupliob_copy(wmOperatorType *ot)
ot->exec = copy_particle_dupliob_exec;
/* flags */
ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
}
static int remove_particle_dupliob_exec(bContext *C, wmOperator *UNUSED(op))
{
PointerRNA ptr = CTX_data_pointer_get_type(C, "particle_system", &RNA_ParticleSystem);
ParticleSystem *psys= ptr.data;
ParticleSystem *psys = ptr.data;
ParticleSettings *part;
ParticleDupliWeight *dw;
@ -508,7 +508,7 @@ static int remove_particle_dupliob_exec(bContext *C, wmOperator *UNUSED(op))
return OPERATOR_CANCELLED;
part = psys->part;
for (dw=part->dupliweights.first; dw; dw=dw->next) {
for (dw = part->dupliweights.first; dw; dw = dw->next) {
if (dw->flag & PART_DUPLIW_CURRENT) {
BLI_remlink(&part->dupliweights, dw);
MEM_freeN(dw);
@ -522,7 +522,7 @@ static int remove_particle_dupliob_exec(bContext *C, wmOperator *UNUSED(op))
dw->flag |= PART_DUPLIW_CURRENT;
DEG_id_tag_update(&part->id, OB_RECALC_DATA | PSYS_RECALC_REDO);
WM_event_add_notifier(C, NC_OBJECT|ND_PARTICLE, NULL);
WM_event_add_notifier(C, NC_OBJECT | ND_PARTICLE, NULL);
return OPERATOR_FINISHED;
}
@ -538,7 +538,7 @@ void PARTICLE_OT_dupliob_remove(wmOperatorType *ot)
ot->exec = remove_particle_dupliob_exec;
/* flags */
ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
}
/************************ move down particle dupliweight operator *********************/
@ -546,7 +546,7 @@ void PARTICLE_OT_dupliob_remove(wmOperatorType *ot)
static int dupliob_move_down_exec(bContext *C, wmOperator *UNUSED(op))
{
PointerRNA ptr = CTX_data_pointer_get_type(C, "particle_system", &RNA_ParticleSystem);
ParticleSystem *psys= ptr.data;
ParticleSystem *psys = ptr.data;
ParticleSettings *part;
ParticleDupliWeight *dw;
@ -554,13 +554,13 @@ static int dupliob_move_down_exec(bContext *C, wmOperator *UNUSED(op))
return OPERATOR_CANCELLED;
part = psys->part;
for (dw=part->dupliweights.first; dw; dw=dw->next) {
for (dw = part->dupliweights.first; dw; dw = dw->next) {
if (dw->flag & PART_DUPLIW_CURRENT && dw->next) {
BLI_remlink(&part->dupliweights, dw);
BLI_insertlinkafter(&part->dupliweights, dw->next, dw);
DEG_id_tag_update(&part->id, OB_RECALC_DATA | PSYS_RECALC_REDO);
WM_event_add_notifier(C, NC_OBJECT|ND_PARTICLE, NULL);
WM_event_add_notifier(C, NC_OBJECT | ND_PARTICLE, NULL);
break;
}
}
@ -577,7 +577,7 @@ void PARTICLE_OT_dupliob_move_down(wmOperatorType *ot)
ot->exec = dupliob_move_down_exec;
/* flags */
ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
}
/************************ connect/disconnect hair operators *********************/
@ -587,7 +587,7 @@ static void disconnect_hair(
Object *ob, ParticleSystem *psys)
{
ParticleSystemModifierData *psmd = psys_get_modifier(ob, psys);
ParticleEditSettings *pset= PE_settings(scene);
ParticleEditSettings *pset = PE_settings(scene);
ParticleData *pa;
PTCacheEdit *edit;
PTCacheEditPoint *point;
@ -603,9 +603,9 @@ static void disconnect_hair(
return;
edit = psys->edit;
point= edit ? edit->points : NULL;
point = edit ? edit->points : NULL;
for (i=0, pa=psys->particles; i<psys->totpart; i++, pa++) {
for (i = 0, pa = psys->particles; i < psys->totpart; i++, pa++) {
if (point) {
ekey = point->keys;
point++;
@ -613,7 +613,7 @@ static void disconnect_hair(
psys_mat_hair_to_global(ob, psmd->mesh_final, psys->part->from, pa, hairmat);
for (k=0, key=pa->hair; k<pa->totkey; k++, key++) {
for (k = 0, key = pa->hair; k < pa->totkey; k++, key++) {
mul_m4_v3(hairmat, key->co);
if (ekey) {
@ -636,16 +636,16 @@ static void disconnect_hair(
static int disconnect_hair_exec(bContext *C, wmOperator *op)
{
Depsgraph *depsgraph = CTX_data_depsgraph(C);
Scene *scene= CTX_data_scene(C);
Object *ob= ED_object_context(C);
ParticleSystem *psys= NULL;
Scene *scene = CTX_data_scene(C);
Object *ob = ED_object_context(C);
ParticleSystem *psys = NULL;
const bool all = RNA_boolean_get(op->ptr, "all");
if (!ob)
return OPERATOR_CANCELLED;
if (all) {
for (psys=ob->particlesystem.first; psys; psys=psys->next) {
for (psys = ob->particlesystem.first; psys; psys = psys->next) {
disconnect_hair(depsgraph, scene, ob, psys);
}
}
@ -655,7 +655,7 @@ static int disconnect_hair_exec(bContext *C, wmOperator *op)
}
DEG_id_tag_update(&ob->id, OB_RECALC_DATA);
WM_event_add_notifier(C, NC_OBJECT|ND_PARTICLE, ob);
WM_event_add_notifier(C, NC_OBJECT | ND_PARTICLE, ob);
return OPERATOR_FINISHED;
}
@ -686,7 +686,7 @@ static bool remap_hair_emitter(
ParticleData *pa, *tpa;
PTCacheEditPoint *edit_point;
PTCacheEditKey *ekey;
BVHTreeFromMesh bvhtree= {NULL};
BVHTreeFromMesh bvhtree = {NULL};
MFace *mface = NULL, *mf;
MEdge *medge = NULL, *me;
MVert *mvert;
@ -737,7 +737,7 @@ static bool remap_hair_emitter(
mvert = mesh->mvert;
/* convert to global coordinates */
for (i=0; i<numverts; i++)
for (i = 0; i < numverts; i++)
mul_m4_v3(to_mat, mvert[i].co);
if (mesh->totface != 0) {
@ -829,7 +829,7 @@ static bool remap_hair_emitter(
sub_v3_v3v3(offset, nearest.co, from_co);
if (edit_point) {
for (k=0, key=pa->hair, tkey=tpa->hair, ekey = edit_point->keys; k<tpa->totkey; k++, key++, tkey++, ekey++) {
for (k = 0, key = pa->hair, tkey = tpa->hair, ekey = edit_point->keys; k < tpa->totkey; k++, key++, tkey++, ekey++) {
float co_orig[3];
if (from_global)
@ -848,7 +848,7 @@ static bool remap_hair_emitter(
edit_point++;
}
else {
for (k=0, key=pa->hair, tkey=tpa->hair; k<tpa->totkey; k++, key++, tkey++) {
for (k = 0, key = pa->hair, tkey = tpa->hair; k < tpa->totkey; k++, key++, tkey++) {
float co_orig[3];
if (from_global)
@ -895,9 +895,9 @@ static bool connect_hair(
static int connect_hair_exec(bContext *C, wmOperator *op)
{
Depsgraph *depsgraph = CTX_data_depsgraph(C);
Scene *scene= CTX_data_scene(C);
Object *ob= ED_object_context(C);
ParticleSystem *psys= NULL;
Scene *scene = CTX_data_scene(C);
Object *ob = ED_object_context(C);
ParticleSystem *psys = NULL;
const bool all = RNA_boolean_get(op->ptr, "all");
bool any_connected = false;
@ -905,7 +905,7 @@ static int connect_hair_exec(bContext *C, wmOperator *op)
return OPERATOR_CANCELLED;
if (all) {
for (psys=ob->particlesystem.first; psys; psys=psys->next) {
for (psys = ob->particlesystem.first; psys; psys = psys->next) {
any_connected |= connect_hair(depsgraph, scene, ob, psys);
}
}
@ -921,7 +921,7 @@ static int connect_hair_exec(bContext *C, wmOperator *op)
}
DEG_id_tag_update(&ob->id, OB_RECALC_DATA);
WM_event_add_notifier(C, NC_OBJECT|ND_PARTICLE, ob);
WM_event_add_notifier(C, NC_OBJECT | ND_PARTICLE, ob);
return OPERATOR_FINISHED;
}
@ -974,7 +974,7 @@ static void copy_particle_edit(
LOOP_POINTS {
HairKey *hkey = pa->hair;
point->keys= MEM_dupallocN(point->keys);
point->keys = MEM_dupallocN(point->keys);
LOOP_KEYS {
key->co = hkey->co;
key->time = &hkey->time;
@ -1058,7 +1058,7 @@ static bool copy_particle_systems_to_object(const bContext *C,
#define PSYS_FROM_NEXT(cur) (single_psys_from ? NULL : (cur)->next)
totpsys = single_psys_from ? 1 : BLI_listbase_count(&ob_from->particlesystem);
tmp_psys = MEM_mallocN(sizeof(ParticleSystem*) * totpsys, "temporary particle system array");
tmp_psys = MEM_mallocN(sizeof(ParticleSystem *) * totpsys, "temporary particle system array");
cdmask = 0;
for (psys_from = PSYS_FROM_FIRST, i = 0;
@ -1132,7 +1132,7 @@ static bool copy_particle_systems_to_object(const bContext *C,
psys;
psys = psys->next, psys_from = PSYS_FROM_NEXT(psys_from), ++i)
{
float (*from_mat)[4], (*to_mat)[4];
float(*from_mat)[4], (*to_mat)[4];
switch (space) {
case PAR_COPY_SPACE_OBJECT: