Cleanup: style
This commit is contained in:
@@ -57,7 +57,7 @@ static int rule_add_exec(bContext *C, wmOperator *op)
|
|||||||
{
|
{
|
||||||
PointerRNA ptr = CTX_data_pointer_get_type(C, "particle_settings", &RNA_ParticleSettings);
|
PointerRNA ptr = CTX_data_pointer_get_type(C, "particle_settings", &RNA_ParticleSettings);
|
||||||
ParticleSettings *part = ptr.data;
|
ParticleSettings *part = ptr.data;
|
||||||
int type= RNA_enum_get(op->ptr, "type");
|
int type = RNA_enum_get(op->ptr, "type");
|
||||||
|
|
||||||
BoidRule *rule;
|
BoidRule *rule;
|
||||||
BoidState *state;
|
BoidState *state;
|
||||||
@@ -67,7 +67,7 @@ static int rule_add_exec(bContext *C, wmOperator *op)
|
|||||||
|
|
||||||
state = boid_get_current_state(part->boids);
|
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->flag &= ~BOIDRULE_CURRENT;
|
||||||
|
|
||||||
rule = boid_new_rule(type);
|
rule = boid_new_rule(type);
|
||||||
@@ -75,7 +75,7 @@ static int rule_add_exec(bContext *C, wmOperator *op)
|
|||||||
|
|
||||||
BLI_addtail(&state->rules, rule);
|
BLI_addtail(&state->rules, rule);
|
||||||
|
|
||||||
DAG_id_tag_update(&part->id, OB_RECALC_DATA|PSYS_RECALC_RESET);
|
DAG_id_tag_update(&part->id, OB_RECALC_DATA | PSYS_RECALC_RESET);
|
||||||
|
|
||||||
return OPERATOR_FINISHED;
|
return OPERATOR_FINISHED;
|
||||||
}
|
}
|
||||||
@@ -92,7 +92,7 @@ void BOID_OT_rule_add(wmOperatorType *ot)
|
|||||||
ot->exec = rule_add_exec;
|
ot->exec = rule_add_exec;
|
||||||
|
|
||||||
/* flags */
|
/* 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", "");
|
ot->prop = RNA_def_enum(ot->srna, "type", rna_enum_boidrule_type_items, 0, "Type", "");
|
||||||
}
|
}
|
||||||
@@ -109,7 +109,7 @@ static int rule_del_exec(bContext *C, wmOperator *UNUSED(op))
|
|||||||
|
|
||||||
state = boid_get_current_state(part->boids);
|
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) {
|
if (rule->flag & BOIDRULE_CURRENT) {
|
||||||
BLI_remlink(&state->rules, rule);
|
BLI_remlink(&state->rules, rule);
|
||||||
MEM_freeN(rule);
|
MEM_freeN(rule);
|
||||||
@@ -122,7 +122,7 @@ static int rule_del_exec(bContext *C, wmOperator *UNUSED(op))
|
|||||||
rule->flag |= BOIDRULE_CURRENT;
|
rule->flag |= BOIDRULE_CURRENT;
|
||||||
|
|
||||||
DAG_relations_tag_update(bmain);
|
DAG_relations_tag_update(bmain);
|
||||||
DAG_id_tag_update(&part->id, OB_RECALC_DATA|PSYS_RECALC_RESET);
|
DAG_id_tag_update(&part->id, OB_RECALC_DATA | PSYS_RECALC_RESET);
|
||||||
|
|
||||||
return OPERATOR_FINISHED;
|
return OPERATOR_FINISHED;
|
||||||
}
|
}
|
||||||
@@ -138,7 +138,7 @@ void BOID_OT_rule_del(wmOperatorType *ot)
|
|||||||
ot->exec = rule_del_exec;
|
ot->exec = rule_del_exec;
|
||||||
|
|
||||||
/* flags */
|
/* flags */
|
||||||
ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
|
ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
|
||||||
}
|
}
|
||||||
|
|
||||||
/************************ move up/down boid rule operators *********************/
|
/************************ move up/down boid rule operators *********************/
|
||||||
@@ -153,12 +153,12 @@ static int rule_move_up_exec(bContext *C, wmOperator *UNUSED(op))
|
|||||||
return OPERATOR_CANCELLED;
|
return OPERATOR_CANCELLED;
|
||||||
|
|
||||||
state = boid_get_current_state(part->boids);
|
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) {
|
if (rule->flag & BOIDRULE_CURRENT && rule->prev) {
|
||||||
BLI_remlink(&state->rules, rule);
|
BLI_remlink(&state->rules, rule);
|
||||||
BLI_insertlinkbefore(&state->rules, rule->prev, rule);
|
BLI_insertlinkbefore(&state->rules, rule->prev, rule);
|
||||||
|
|
||||||
DAG_id_tag_update(&part->id, OB_RECALC_DATA|PSYS_RECALC_RESET);
|
DAG_id_tag_update(&part->id, OB_RECALC_DATA | PSYS_RECALC_RESET);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -175,7 +175,7 @@ void BOID_OT_rule_move_up(wmOperatorType *ot)
|
|||||||
ot->exec = rule_move_up_exec;
|
ot->exec = rule_move_up_exec;
|
||||||
|
|
||||||
/* flags */
|
/* flags */
|
||||||
ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
|
ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int rule_move_down_exec(bContext *C, wmOperator *UNUSED(op))
|
static int rule_move_down_exec(bContext *C, wmOperator *UNUSED(op))
|
||||||
@@ -189,12 +189,12 @@ static int rule_move_down_exec(bContext *C, wmOperator *UNUSED(op))
|
|||||||
return OPERATOR_CANCELLED;
|
return OPERATOR_CANCELLED;
|
||||||
|
|
||||||
state = boid_get_current_state(part->boids);
|
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) {
|
if (rule->flag & BOIDRULE_CURRENT && rule->next) {
|
||||||
BLI_remlink(&state->rules, rule);
|
BLI_remlink(&state->rules, rule);
|
||||||
BLI_insertlinkafter(&state->rules, rule->next, rule);
|
BLI_insertlinkafter(&state->rules, rule->next, rule);
|
||||||
|
|
||||||
DAG_id_tag_update(&part->id, OB_RECALC_DATA|PSYS_RECALC_RESET);
|
DAG_id_tag_update(&part->id, OB_RECALC_DATA | PSYS_RECALC_RESET);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -211,7 +211,7 @@ void BOID_OT_rule_move_down(wmOperatorType *ot)
|
|||||||
ot->exec = rule_move_down_exec;
|
ot->exec = rule_move_down_exec;
|
||||||
|
|
||||||
/* flags */
|
/* flags */
|
||||||
ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
|
ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -225,7 +225,7 @@ static int state_add_exec(bContext *C, wmOperator *UNUSED(op))
|
|||||||
if (!part || part->phystype != PART_PHYS_BOIDS)
|
if (!part || part->phystype != PART_PHYS_BOIDS)
|
||||||
return OPERATOR_CANCELLED;
|
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->flag &= ~BOIDSTATE_CURRENT;
|
||||||
|
|
||||||
state = boid_new_state(part->boids);
|
state = boid_new_state(part->boids);
|
||||||
@@ -247,7 +247,7 @@ void BOID_OT_state_add(wmOperatorType *ot)
|
|||||||
ot->exec = state_add_exec;
|
ot->exec = state_add_exec;
|
||||||
|
|
||||||
/* flags */
|
/* flags */
|
||||||
ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
|
ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
|
||||||
}
|
}
|
||||||
static int state_del_exec(bContext *C, wmOperator *UNUSED(op))
|
static int state_del_exec(bContext *C, wmOperator *UNUSED(op))
|
||||||
{
|
{
|
||||||
@@ -259,7 +259,7 @@ static int state_del_exec(bContext *C, wmOperator *UNUSED(op))
|
|||||||
if (!part || part->phystype != PART_PHYS_BOIDS)
|
if (!part || part->phystype != PART_PHYS_BOIDS)
|
||||||
return OPERATOR_CANCELLED;
|
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) {
|
if (state->flag & BOIDSTATE_CURRENT) {
|
||||||
BLI_remlink(&part->boids->states, state);
|
BLI_remlink(&part->boids->states, state);
|
||||||
MEM_freeN(state);
|
MEM_freeN(state);
|
||||||
@@ -278,7 +278,7 @@ static int state_del_exec(bContext *C, wmOperator *UNUSED(op))
|
|||||||
state->flag |= BOIDSTATE_CURRENT;
|
state->flag |= BOIDSTATE_CURRENT;
|
||||||
|
|
||||||
DAG_relations_tag_update(bmain);
|
DAG_relations_tag_update(bmain);
|
||||||
DAG_id_tag_update(&part->id, OB_RECALC_DATA|PSYS_RECALC_RESET);
|
DAG_id_tag_update(&part->id, OB_RECALC_DATA | PSYS_RECALC_RESET);
|
||||||
|
|
||||||
return OPERATOR_FINISHED;
|
return OPERATOR_FINISHED;
|
||||||
}
|
}
|
||||||
@@ -294,7 +294,7 @@ void BOID_OT_state_del(wmOperatorType *ot)
|
|||||||
ot->exec = state_del_exec;
|
ot->exec = state_del_exec;
|
||||||
|
|
||||||
/* flags */
|
/* flags */
|
||||||
ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
|
ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
|
||||||
}
|
}
|
||||||
|
|
||||||
/************************ move up/down boid state operators *********************/
|
/************************ move up/down boid state operators *********************/
|
||||||
@@ -310,7 +310,7 @@ static int state_move_up_exec(bContext *C, wmOperator *UNUSED(op))
|
|||||||
|
|
||||||
boids = part->boids;
|
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) {
|
if (state->flag & BOIDSTATE_CURRENT && state->prev) {
|
||||||
BLI_remlink(&boids->states, state);
|
BLI_remlink(&boids->states, state);
|
||||||
BLI_insertlinkbefore(&boids->states, state->prev, state);
|
BLI_insertlinkbefore(&boids->states, state->prev, state);
|
||||||
@@ -330,7 +330,7 @@ void BOID_OT_state_move_up(wmOperatorType *ot)
|
|||||||
ot->exec = state_move_up_exec;
|
ot->exec = state_move_up_exec;
|
||||||
|
|
||||||
/* flags */
|
/* flags */
|
||||||
ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
|
ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int state_move_down_exec(bContext *C, wmOperator *UNUSED(op))
|
static int state_move_down_exec(bContext *C, wmOperator *UNUSED(op))
|
||||||
@@ -345,11 +345,11 @@ static int state_move_down_exec(bContext *C, wmOperator *UNUSED(op))
|
|||||||
|
|
||||||
boids = part->boids;
|
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) {
|
if (state->flag & BOIDSTATE_CURRENT && state->next) {
|
||||||
BLI_remlink(&boids->states, state);
|
BLI_remlink(&boids->states, state);
|
||||||
BLI_insertlinkafter(&boids->states, state->next, state);
|
BLI_insertlinkafter(&boids->states, state->next, state);
|
||||||
DAG_id_tag_update(&part->id, OB_RECALC_DATA|PSYS_RECALC_RESET);
|
DAG_id_tag_update(&part->id, OB_RECALC_DATA | PSYS_RECALC_RESET);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -366,5 +366,5 @@ void BOID_OT_state_move_down(wmOperatorType *ot)
|
|||||||
ot->exec = state_move_down_exec;
|
ot->exec = state_move_down_exec;
|
||||||
|
|
||||||
/* flags */
|
/* flags */
|
||||||
ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
|
ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
|
||||||
}
|
}
|
||||||
|
File diff suppressed because it is too large
Load Diff
@@ -70,15 +70,15 @@ static void undoptcache_from_editcache(PTCacheUndo *undo, PTCacheEdit *edit)
|
|||||||
|
|
||||||
size_t mem_used_prev = MEM_get_memory_in_use();
|
size_t mem_used_prev = MEM_get_memory_in_use();
|
||||||
|
|
||||||
undo->totpoint= edit->totpoint;
|
undo->totpoint = edit->totpoint;
|
||||||
|
|
||||||
if (edit->psys) {
|
if (edit->psys) {
|
||||||
ParticleData *pa;
|
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++) {
|
for (i = 0; i < edit->totpoint; i++, pa++) {
|
||||||
pa->hair= MEM_dupallocN(pa->hair);
|
pa->hair = MEM_dupallocN(pa->hair);
|
||||||
}
|
}
|
||||||
|
|
||||||
undo->psys_flag = edit->psys->flag;
|
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);
|
BLI_duplicatelist(&undo->mem_cache, &edit->pid.cache->mem_cache);
|
||||||
pm = undo->mem_cache.first;
|
pm = undo->mem_cache.first;
|
||||||
|
|
||||||
for (; pm; pm=pm->next) {
|
for (; pm; pm = pm->next) {
|
||||||
for (i=0; i<BPHYS_TOT_DATA; i++) {
|
for (i = 0; i < BPHYS_TOT_DATA; i++) {
|
||||||
pm->data[i] = MEM_dupallocN(pm->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;
|
undo->totpoint = edit->totpoint;
|
||||||
|
|
||||||
for (i=0; i<edit->totpoint; i++, point++) {
|
for (i = 0; i < edit->totpoint; i++, point++) {
|
||||||
point->keys= MEM_dupallocN(point->keys);
|
point->keys = MEM_dupallocN(point->keys);
|
||||||
/* no need to update edit key->co & key->time pointers here */
|
/* 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) {
|
if (edit->mirror_cache) {
|
||||||
MEM_freeN(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;
|
edit->totpoint = undo->totpoint;
|
||||||
|
|
||||||
LOOP_POINTS {
|
LOOP_POINTS {
|
||||||
point->keys= MEM_dupallocN(point->keys);
|
point->keys = MEM_dupallocN(point->keys);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (psys) {
|
if (psys) {
|
||||||
psys->particles= MEM_dupallocN(undo->particles);
|
psys->particles = MEM_dupallocN(undo->particles);
|
||||||
|
|
||||||
psys->totpart= undo->totpoint;
|
psys->totpart = undo->totpoint;
|
||||||
|
|
||||||
LOOP_POINTS {
|
LOOP_POINTS {
|
||||||
pa = psys->particles + p;
|
pa = psys->particles + p;
|
||||||
hkey= pa->hair = MEM_dupallocN(pa->hair);
|
hkey = pa->hair = MEM_dupallocN(pa->hair);
|
||||||
|
|
||||||
LOOP_KEYS {
|
LOOP_KEYS {
|
||||||
key->co= hkey->co;
|
key->co = hkey->co;
|
||||||
key->time= &hkey->time;
|
key->time = &hkey->time;
|
||||||
hkey++;
|
hkey++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -171,7 +171,7 @@ static void undoptcache_to_editcache(PTCacheUndo *undo, PTCacheEdit *edit)
|
|||||||
|
|
||||||
pm = edit->pid.cache->mem_cache.first;
|
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++) {
|
for (i = 0; i < BPHYS_TOT_DATA; i++) {
|
||||||
pm->data[i] = MEM_dupallocN(pm->data[i]);
|
pm->data[i] = MEM_dupallocN(pm->data[i]);
|
||||||
}
|
}
|
||||||
@@ -197,7 +197,7 @@ static void undoptcache_free_data(PTCacheUndo *undo)
|
|||||||
PTCacheEditPoint *point;
|
PTCacheEditPoint *point;
|
||||||
int i;
|
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) {
|
if (undo->particles && (undo->particles + i)->hair) {
|
||||||
MEM_freeN((undo->particles + i)->hair);
|
MEM_freeN((undo->particles + i)->hair);
|
||||||
}
|
}
|
||||||
|
@@ -32,19 +32,19 @@
|
|||||||
#ifndef __PARTICLE_EDIT_UTILDEFNIES_H__
|
#ifndef __PARTICLE_EDIT_UTILDEFNIES_H__
|
||||||
#define __PARTICLE_EDIT_UTILDEFNIES_H__
|
#define __PARTICLE_EDIT_UTILDEFNIES_H__
|
||||||
|
|
||||||
#define KEY_K PTCacheEditKey *key; int k
|
#define KEY_K PTCacheEditKey *key; int k
|
||||||
#define POINT_P PTCacheEditPoint *point; int p
|
#define POINT_P PTCacheEditPoint *point; int p
|
||||||
#define LOOP_POINTS for (p=0, point=edit->points; p<edit->totpoint; p++, point++)
|
#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_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_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_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_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_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_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_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_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 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__ */
|
#endif /* __PARTICLE_EDIT_UTILDEFNIES_H__ */
|
||||||
|
@@ -78,7 +78,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))
|
static int particle_system_add_exec(bContext *C, wmOperator *UNUSED(op))
|
||||||
{
|
{
|
||||||
Main *bmain = CTX_data_main(C);
|
Main *bmain = CTX_data_main(C);
|
||||||
Object *ob= ED_object_context(C);
|
Object *ob = ED_object_context(C);
|
||||||
Scene *scene = CTX_data_scene(C);
|
Scene *scene = CTX_data_scene(C);
|
||||||
|
|
||||||
if (!scene || !ob)
|
if (!scene || !ob)
|
||||||
@@ -86,8 +86,8 @@ static int particle_system_add_exec(bContext *C, wmOperator *UNUSED(op))
|
|||||||
|
|
||||||
object_add_particle_system(bmain, scene, ob, NULL);
|
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_PARTICLE, ob);
|
||||||
WM_event_add_notifier(C, NC_OBJECT|ND_POINTCACHE, ob);
|
WM_event_add_notifier(C, NC_OBJECT | ND_POINTCACHE, ob);
|
||||||
|
|
||||||
return OPERATOR_FINISHED;
|
return OPERATOR_FINISHED;
|
||||||
}
|
}
|
||||||
@@ -104,7 +104,7 @@ void OBJECT_OT_particle_system_add(wmOperatorType *ot)
|
|||||||
ot->exec = particle_system_add_exec;
|
ot->exec = particle_system_add_exec;
|
||||||
|
|
||||||
/* flags */
|
/* flags */
|
||||||
ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
|
ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int particle_system_remove_exec(bContext *C, wmOperator *UNUSED(op))
|
static int particle_system_remove_exec(bContext *C, wmOperator *UNUSED(op))
|
||||||
@@ -126,13 +126,13 @@ static int particle_system_remove_exec(bContext *C, wmOperator *UNUSED(op))
|
|||||||
if (mode_orig & OB_MODE_PARTICLE_EDIT) {
|
if (mode_orig & OB_MODE_PARTICLE_EDIT) {
|
||||||
if ((ob->mode & OB_MODE_PARTICLE_EDIT) == 0) {
|
if ((ob->mode & OB_MODE_PARTICLE_EDIT) == 0) {
|
||||||
if (scene->basact && scene->basact->object == ob) {
|
if (scene->basact && scene->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_PARTICLE, ob);
|
||||||
WM_event_add_notifier(C, NC_OBJECT|ND_POINTCACHE, ob);
|
WM_event_add_notifier(C, NC_OBJECT | ND_POINTCACHE, ob);
|
||||||
|
|
||||||
return OPERATOR_FINISHED;
|
return OPERATOR_FINISHED;
|
||||||
}
|
}
|
||||||
@@ -149,7 +149,7 @@ void OBJECT_OT_particle_system_remove(wmOperatorType *ot)
|
|||||||
ot->exec = particle_system_remove_exec;
|
ot->exec = particle_system_remove_exec;
|
||||||
|
|
||||||
/* flags */
|
/* flags */
|
||||||
ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
|
ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
|
||||||
}
|
}
|
||||||
|
|
||||||
/********************** new particle settings operator *********************/
|
/********************** new particle settings operator *********************/
|
||||||
@@ -162,7 +162,7 @@ static bool psys_poll(bContext *C)
|
|||||||
|
|
||||||
static int new_particle_settings_exec(bContext *C, wmOperator *UNUSED(op))
|
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;
|
ParticleSystem *psys;
|
||||||
ParticleSettings *part = NULL;
|
ParticleSettings *part = NULL;
|
||||||
Object *ob;
|
Object *ob;
|
||||||
@@ -174,11 +174,11 @@ static int new_particle_settings_exec(bContext *C, wmOperator *UNUSED(op))
|
|||||||
|
|
||||||
/* add or copy particle setting */
|
/* add or copy particle setting */
|
||||||
if (psys->part)
|
if (psys->part)
|
||||||
part= BKE_particlesettings_copy(bmain, psys->part);
|
part = BKE_particlesettings_copy(bmain, psys->part);
|
||||||
else
|
else
|
||||||
part= BKE_particlesettings_add(bmain, "ParticleSettings");
|
part = BKE_particlesettings_add(bmain, "ParticleSettings");
|
||||||
|
|
||||||
ob= ptr.id.data;
|
ob = ptr.id.data;
|
||||||
|
|
||||||
if (psys->part)
|
if (psys->part)
|
||||||
id_us_min(&psys->part->id);
|
id_us_min(&psys->part->id);
|
||||||
@@ -190,7 +190,7 @@ static int new_particle_settings_exec(bContext *C, wmOperator *UNUSED(op))
|
|||||||
DAG_relations_tag_update(bmain);
|
DAG_relations_tag_update(bmain);
|
||||||
DAG_id_tag_update(&ob->id, OB_RECALC_DATA);
|
DAG_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;
|
return OPERATOR_FINISHED;
|
||||||
}
|
}
|
||||||
@@ -207,7 +207,7 @@ void PARTICLE_OT_new(wmOperatorType *ot)
|
|||||||
ot->poll = psys_poll;
|
ot->poll = psys_poll;
|
||||||
|
|
||||||
/* flags */
|
/* flags */
|
||||||
ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
|
ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
|
||||||
}
|
}
|
||||||
|
|
||||||
/********************** keyed particle target operators *********************/
|
/********************** keyed particle target operators *********************/
|
||||||
@@ -216,7 +216,7 @@ static int new_particle_target_exec(bContext *C, wmOperator *UNUSED(op))
|
|||||||
{
|
{
|
||||||
Main *bmain = CTX_data_main(C);
|
Main *bmain = CTX_data_main(C);
|
||||||
PointerRNA ptr = CTX_data_pointer_get_type(C, "particle_system", &RNA_ParticleSystem);
|
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;
|
Object *ob = ptr.id.data;
|
||||||
|
|
||||||
ParticleTarget *pt;
|
ParticleTarget *pt;
|
||||||
@@ -225,7 +225,7 @@ static int new_particle_target_exec(bContext *C, wmOperator *UNUSED(op))
|
|||||||
return OPERATOR_CANCELLED;
|
return OPERATOR_CANCELLED;
|
||||||
|
|
||||||
pt = psys->targets.first;
|
pt = psys->targets.first;
|
||||||
for (; pt; pt=pt->next)
|
for (; pt; pt = pt->next)
|
||||||
pt->flag &= ~PTARGET_CURRENT;
|
pt->flag &= ~PTARGET_CURRENT;
|
||||||
|
|
||||||
pt = MEM_callocN(sizeof(ParticleTarget), "keyed particle target");
|
pt = MEM_callocN(sizeof(ParticleTarget), "keyed particle target");
|
||||||
@@ -238,7 +238,7 @@ static int new_particle_target_exec(bContext *C, wmOperator *UNUSED(op))
|
|||||||
DAG_relations_tag_update(bmain);
|
DAG_relations_tag_update(bmain);
|
||||||
DAG_id_tag_update(&ob->id, OB_RECALC_DATA);
|
DAG_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;
|
return OPERATOR_FINISHED;
|
||||||
}
|
}
|
||||||
@@ -254,14 +254,14 @@ void PARTICLE_OT_new_target(wmOperatorType *ot)
|
|||||||
ot->exec = new_particle_target_exec;
|
ot->exec = new_particle_target_exec;
|
||||||
|
|
||||||
/* flags */
|
/* flags */
|
||||||
ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
|
ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int remove_particle_target_exec(bContext *C, wmOperator *UNUSED(op))
|
static int remove_particle_target_exec(bContext *C, wmOperator *UNUSED(op))
|
||||||
{
|
{
|
||||||
Main *bmain = CTX_data_main(C);
|
Main *bmain = CTX_data_main(C);
|
||||||
PointerRNA ptr = CTX_data_pointer_get_type(C, "particle_system", &RNA_ParticleSystem);
|
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;
|
Object *ob = ptr.id.data;
|
||||||
|
|
||||||
ParticleTarget *pt;
|
ParticleTarget *pt;
|
||||||
@@ -270,7 +270,7 @@ static int remove_particle_target_exec(bContext *C, wmOperator *UNUSED(op))
|
|||||||
return OPERATOR_CANCELLED;
|
return OPERATOR_CANCELLED;
|
||||||
|
|
||||||
pt = psys->targets.first;
|
pt = psys->targets.first;
|
||||||
for (; pt; pt=pt->next) {
|
for (; pt; pt = pt->next) {
|
||||||
if (pt->flag & PTARGET_CURRENT) {
|
if (pt->flag & PTARGET_CURRENT) {
|
||||||
BLI_remlink(&psys->targets, pt);
|
BLI_remlink(&psys->targets, pt);
|
||||||
MEM_freeN(pt);
|
MEM_freeN(pt);
|
||||||
@@ -286,7 +286,7 @@ static int remove_particle_target_exec(bContext *C, wmOperator *UNUSED(op))
|
|||||||
DAG_relations_tag_update(bmain);
|
DAG_relations_tag_update(bmain);
|
||||||
DAG_id_tag_update(&ob->id, OB_RECALC_DATA);
|
DAG_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;
|
return OPERATOR_FINISHED;
|
||||||
}
|
}
|
||||||
@@ -302,7 +302,7 @@ void PARTICLE_OT_target_remove(wmOperatorType *ot)
|
|||||||
ot->exec = remove_particle_target_exec;
|
ot->exec = remove_particle_target_exec;
|
||||||
|
|
||||||
/* flags */
|
/* flags */
|
||||||
ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
|
ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
|
||||||
}
|
}
|
||||||
|
|
||||||
/************************ move up particle target operator *********************/
|
/************************ move up particle target operator *********************/
|
||||||
@@ -310,7 +310,7 @@ void PARTICLE_OT_target_remove(wmOperatorType *ot)
|
|||||||
static int target_move_up_exec(bContext *C, wmOperator *UNUSED(op))
|
static int target_move_up_exec(bContext *C, wmOperator *UNUSED(op))
|
||||||
{
|
{
|
||||||
PointerRNA ptr = CTX_data_pointer_get_type(C, "particle_system", &RNA_ParticleSystem);
|
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;
|
Object *ob = ptr.id.data;
|
||||||
ParticleTarget *pt;
|
ParticleTarget *pt;
|
||||||
|
|
||||||
@@ -318,13 +318,13 @@ static int target_move_up_exec(bContext *C, wmOperator *UNUSED(op))
|
|||||||
return OPERATOR_CANCELLED;
|
return OPERATOR_CANCELLED;
|
||||||
|
|
||||||
pt = psys->targets.first;
|
pt = psys->targets.first;
|
||||||
for (; pt; pt=pt->next) {
|
for (; pt; pt = pt->next) {
|
||||||
if (pt->flag & PTARGET_CURRENT && pt->prev) {
|
if (pt->flag & PTARGET_CURRENT && pt->prev) {
|
||||||
BLI_remlink(&psys->targets, pt);
|
BLI_remlink(&psys->targets, pt);
|
||||||
BLI_insertlinkbefore(&psys->targets, pt->prev, pt);
|
BLI_insertlinkbefore(&psys->targets, pt->prev, pt);
|
||||||
|
|
||||||
DAG_id_tag_update(&ob->id, OB_RECALC_DATA);
|
DAG_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;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -341,7 +341,7 @@ void PARTICLE_OT_target_move_up(wmOperatorType *ot)
|
|||||||
ot->exec = target_move_up_exec;
|
ot->exec = target_move_up_exec;
|
||||||
|
|
||||||
/* flags */
|
/* flags */
|
||||||
ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
|
ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
|
||||||
}
|
}
|
||||||
|
|
||||||
/************************ move down particle target operator *********************/
|
/************************ move down particle target operator *********************/
|
||||||
@@ -349,20 +349,20 @@ void PARTICLE_OT_target_move_up(wmOperatorType *ot)
|
|||||||
static int target_move_down_exec(bContext *C, wmOperator *UNUSED(op))
|
static int target_move_down_exec(bContext *C, wmOperator *UNUSED(op))
|
||||||
{
|
{
|
||||||
PointerRNA ptr = CTX_data_pointer_get_type(C, "particle_system", &RNA_ParticleSystem);
|
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;
|
Object *ob = ptr.id.data;
|
||||||
ParticleTarget *pt;
|
ParticleTarget *pt;
|
||||||
|
|
||||||
if (!psys)
|
if (!psys)
|
||||||
return OPERATOR_CANCELLED;
|
return OPERATOR_CANCELLED;
|
||||||
pt = psys->targets.first;
|
pt = psys->targets.first;
|
||||||
for (; pt; pt=pt->next) {
|
for (; pt; pt = pt->next) {
|
||||||
if (pt->flag & PTARGET_CURRENT && pt->next) {
|
if (pt->flag & PTARGET_CURRENT && pt->next) {
|
||||||
BLI_remlink(&psys->targets, pt);
|
BLI_remlink(&psys->targets, pt);
|
||||||
BLI_insertlinkafter(&psys->targets, pt->next, pt);
|
BLI_insertlinkafter(&psys->targets, pt->next, pt);
|
||||||
|
|
||||||
DAG_id_tag_update(&ob->id, OB_RECALC_DATA);
|
DAG_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;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -379,7 +379,7 @@ void PARTICLE_OT_target_move_down(wmOperatorType *ot)
|
|||||||
ot->exec = target_move_down_exec;
|
ot->exec = target_move_down_exec;
|
||||||
|
|
||||||
/* flags */
|
/* flags */
|
||||||
ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
|
ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
|
||||||
}
|
}
|
||||||
|
|
||||||
/************************ move up particle dupliweight operator *********************/
|
/************************ move up particle dupliweight operator *********************/
|
||||||
@@ -387,7 +387,7 @@ void PARTICLE_OT_target_move_down(wmOperatorType *ot)
|
|||||||
static int dupliob_move_up_exec(bContext *C, wmOperator *UNUSED(op))
|
static int dupliob_move_up_exec(bContext *C, wmOperator *UNUSED(op))
|
||||||
{
|
{
|
||||||
PointerRNA ptr = CTX_data_pointer_get_type(C, "particle_system", &RNA_ParticleSystem);
|
PointerRNA ptr = CTX_data_pointer_get_type(C, "particle_system", &RNA_ParticleSystem);
|
||||||
ParticleSystem *psys= ptr.data;
|
ParticleSystem *psys = ptr.data;
|
||||||
ParticleSettings *part;
|
ParticleSettings *part;
|
||||||
ParticleDupliWeight *dw;
|
ParticleDupliWeight *dw;
|
||||||
|
|
||||||
@@ -395,12 +395,12 @@ static int dupliob_move_up_exec(bContext *C, wmOperator *UNUSED(op))
|
|||||||
return OPERATOR_CANCELLED;
|
return OPERATOR_CANCELLED;
|
||||||
|
|
||||||
part = psys->part;
|
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) {
|
if (dw->flag & PART_DUPLIW_CURRENT && dw->prev) {
|
||||||
BLI_remlink(&part->dupliweights, dw);
|
BLI_remlink(&part->dupliweights, dw);
|
||||||
BLI_insertlinkbefore(&part->dupliweights, dw->prev, dw);
|
BLI_insertlinkbefore(&part->dupliweights, dw->prev, dw);
|
||||||
|
|
||||||
WM_event_add_notifier(C, NC_OBJECT|ND_PARTICLE, NULL);
|
WM_event_add_notifier(C, NC_OBJECT | ND_PARTICLE, NULL);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -417,7 +417,7 @@ void PARTICLE_OT_dupliob_move_up(wmOperatorType *ot)
|
|||||||
ot->exec = dupliob_move_up_exec;
|
ot->exec = dupliob_move_up_exec;
|
||||||
|
|
||||||
/* flags */
|
/* flags */
|
||||||
ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
|
ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
|
||||||
}
|
}
|
||||||
|
|
||||||
/********************** particle dupliweight operators *********************/
|
/********************** particle dupliweight operators *********************/
|
||||||
@@ -425,21 +425,21 @@ void PARTICLE_OT_dupliob_move_up(wmOperatorType *ot)
|
|||||||
static int copy_particle_dupliob_exec(bContext *C, wmOperator *UNUSED(op))
|
static int copy_particle_dupliob_exec(bContext *C, wmOperator *UNUSED(op))
|
||||||
{
|
{
|
||||||
PointerRNA ptr = CTX_data_pointer_get_type(C, "particle_system", &RNA_ParticleSystem);
|
PointerRNA ptr = CTX_data_pointer_get_type(C, "particle_system", &RNA_ParticleSystem);
|
||||||
ParticleSystem *psys= ptr.data;
|
ParticleSystem *psys = ptr.data;
|
||||||
ParticleSettings *part;
|
ParticleSettings *part;
|
||||||
ParticleDupliWeight *dw;
|
ParticleDupliWeight *dw;
|
||||||
|
|
||||||
if (!psys)
|
if (!psys)
|
||||||
return OPERATOR_CANCELLED;
|
return OPERATOR_CANCELLED;
|
||||||
part = psys->part;
|
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) {
|
if (dw->flag & PART_DUPLIW_CURRENT) {
|
||||||
dw->flag &= ~PART_DUPLIW_CURRENT;
|
dw->flag &= ~PART_DUPLIW_CURRENT;
|
||||||
dw = MEM_dupallocN(dw);
|
dw = MEM_dupallocN(dw);
|
||||||
dw->flag |= PART_DUPLIW_CURRENT;
|
dw->flag |= PART_DUPLIW_CURRENT;
|
||||||
BLI_addhead(&part->dupliweights, dw);
|
BLI_addhead(&part->dupliweights, dw);
|
||||||
|
|
||||||
WM_event_add_notifier(C, NC_OBJECT|ND_PARTICLE, NULL);
|
WM_event_add_notifier(C, NC_OBJECT | ND_PARTICLE, NULL);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -458,13 +458,13 @@ void PARTICLE_OT_dupliob_copy(wmOperatorType *ot)
|
|||||||
ot->exec = copy_particle_dupliob_exec;
|
ot->exec = copy_particle_dupliob_exec;
|
||||||
|
|
||||||
/* flags */
|
/* flags */
|
||||||
ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
|
ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int remove_particle_dupliob_exec(bContext *C, wmOperator *UNUSED(op))
|
static int remove_particle_dupliob_exec(bContext *C, wmOperator *UNUSED(op))
|
||||||
{
|
{
|
||||||
PointerRNA ptr = CTX_data_pointer_get_type(C, "particle_system", &RNA_ParticleSystem);
|
PointerRNA ptr = CTX_data_pointer_get_type(C, "particle_system", &RNA_ParticleSystem);
|
||||||
ParticleSystem *psys= ptr.data;
|
ParticleSystem *psys = ptr.data;
|
||||||
ParticleSettings *part;
|
ParticleSettings *part;
|
||||||
ParticleDupliWeight *dw;
|
ParticleDupliWeight *dw;
|
||||||
|
|
||||||
@@ -472,7 +472,7 @@ static int remove_particle_dupliob_exec(bContext *C, wmOperator *UNUSED(op))
|
|||||||
return OPERATOR_CANCELLED;
|
return OPERATOR_CANCELLED;
|
||||||
|
|
||||||
part = psys->part;
|
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) {
|
if (dw->flag & PART_DUPLIW_CURRENT) {
|
||||||
BLI_remlink(&part->dupliweights, dw);
|
BLI_remlink(&part->dupliweights, dw);
|
||||||
MEM_freeN(dw);
|
MEM_freeN(dw);
|
||||||
@@ -485,7 +485,7 @@ static int remove_particle_dupliob_exec(bContext *C, wmOperator *UNUSED(op))
|
|||||||
if (dw)
|
if (dw)
|
||||||
dw->flag |= PART_DUPLIW_CURRENT;
|
dw->flag |= PART_DUPLIW_CURRENT;
|
||||||
|
|
||||||
WM_event_add_notifier(C, NC_OBJECT|ND_PARTICLE, NULL);
|
WM_event_add_notifier(C, NC_OBJECT | ND_PARTICLE, NULL);
|
||||||
|
|
||||||
return OPERATOR_FINISHED;
|
return OPERATOR_FINISHED;
|
||||||
}
|
}
|
||||||
@@ -501,7 +501,7 @@ void PARTICLE_OT_dupliob_remove(wmOperatorType *ot)
|
|||||||
ot->exec = remove_particle_dupliob_exec;
|
ot->exec = remove_particle_dupliob_exec;
|
||||||
|
|
||||||
/* flags */
|
/* flags */
|
||||||
ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
|
ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
|
||||||
}
|
}
|
||||||
|
|
||||||
/************************ move down particle dupliweight operator *********************/
|
/************************ move down particle dupliweight operator *********************/
|
||||||
@@ -509,7 +509,7 @@ void PARTICLE_OT_dupliob_remove(wmOperatorType *ot)
|
|||||||
static int dupliob_move_down_exec(bContext *C, wmOperator *UNUSED(op))
|
static int dupliob_move_down_exec(bContext *C, wmOperator *UNUSED(op))
|
||||||
{
|
{
|
||||||
PointerRNA ptr = CTX_data_pointer_get_type(C, "particle_system", &RNA_ParticleSystem);
|
PointerRNA ptr = CTX_data_pointer_get_type(C, "particle_system", &RNA_ParticleSystem);
|
||||||
ParticleSystem *psys= ptr.data;
|
ParticleSystem *psys = ptr.data;
|
||||||
ParticleSettings *part;
|
ParticleSettings *part;
|
||||||
ParticleDupliWeight *dw;
|
ParticleDupliWeight *dw;
|
||||||
|
|
||||||
@@ -517,12 +517,12 @@ static int dupliob_move_down_exec(bContext *C, wmOperator *UNUSED(op))
|
|||||||
return OPERATOR_CANCELLED;
|
return OPERATOR_CANCELLED;
|
||||||
|
|
||||||
part = psys->part;
|
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) {
|
if (dw->flag & PART_DUPLIW_CURRENT && dw->next) {
|
||||||
BLI_remlink(&part->dupliweights, dw);
|
BLI_remlink(&part->dupliweights, dw);
|
||||||
BLI_insertlinkafter(&part->dupliweights, dw->next, dw);
|
BLI_insertlinkafter(&part->dupliweights, dw->next, dw);
|
||||||
|
|
||||||
WM_event_add_notifier(C, NC_OBJECT|ND_PARTICLE, NULL);
|
WM_event_add_notifier(C, NC_OBJECT | ND_PARTICLE, NULL);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -539,7 +539,7 @@ void PARTICLE_OT_dupliob_move_down(wmOperatorType *ot)
|
|||||||
ot->exec = dupliob_move_down_exec;
|
ot->exec = dupliob_move_down_exec;
|
||||||
|
|
||||||
/* flags */
|
/* flags */
|
||||||
ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
|
ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
|
||||||
}
|
}
|
||||||
|
|
||||||
/************************ connect/disconnect hair operators *********************/
|
/************************ connect/disconnect hair operators *********************/
|
||||||
@@ -547,7 +547,7 @@ void PARTICLE_OT_dupliob_move_down(wmOperatorType *ot)
|
|||||||
static void disconnect_hair(Main *bmain, Scene *scene, Object *ob, ParticleSystem *psys)
|
static void disconnect_hair(Main *bmain, Scene *scene, Object *ob, ParticleSystem *psys)
|
||||||
{
|
{
|
||||||
ParticleSystemModifierData *psmd = psys_get_modifier(ob, psys);
|
ParticleSystemModifierData *psmd = psys_get_modifier(ob, psys);
|
||||||
ParticleEditSettings *pset= PE_settings(scene);
|
ParticleEditSettings *pset = PE_settings(scene);
|
||||||
ParticleData *pa;
|
ParticleData *pa;
|
||||||
PTCacheEdit *edit;
|
PTCacheEdit *edit;
|
||||||
PTCacheEditPoint *point;
|
PTCacheEditPoint *point;
|
||||||
@@ -563,9 +563,9 @@ static void disconnect_hair(Main *bmain, Scene *scene, Object *ob, ParticleSyste
|
|||||||
return;
|
return;
|
||||||
|
|
||||||
edit = psys->edit;
|
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) {
|
if (point) {
|
||||||
ekey = point->keys;
|
ekey = point->keys;
|
||||||
point++;
|
point++;
|
||||||
@@ -573,7 +573,7 @@ static void disconnect_hair(Main *bmain, Scene *scene, Object *ob, ParticleSyste
|
|||||||
|
|
||||||
psys_mat_hair_to_global(ob, psmd->dm_final, psys->part->from, pa, hairmat);
|
psys_mat_hair_to_global(ob, psmd->dm_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);
|
mul_m4_v3(hairmat, key->co);
|
||||||
|
|
||||||
if (ekey) {
|
if (ekey) {
|
||||||
@@ -596,16 +596,16 @@ static void disconnect_hair(Main *bmain, Scene *scene, Object *ob, ParticleSyste
|
|||||||
static int disconnect_hair_exec(bContext *C, wmOperator *op)
|
static int disconnect_hair_exec(bContext *C, wmOperator *op)
|
||||||
{
|
{
|
||||||
Main *bmain = CTX_data_main(C);
|
Main *bmain = CTX_data_main(C);
|
||||||
Scene *scene= CTX_data_scene(C);
|
Scene *scene = CTX_data_scene(C);
|
||||||
Object *ob= ED_object_context(C);
|
Object *ob = ED_object_context(C);
|
||||||
ParticleSystem *psys= NULL;
|
ParticleSystem *psys = NULL;
|
||||||
const bool all = RNA_boolean_get(op->ptr, "all");
|
const bool all = RNA_boolean_get(op->ptr, "all");
|
||||||
|
|
||||||
if (!ob)
|
if (!ob)
|
||||||
return OPERATOR_CANCELLED;
|
return OPERATOR_CANCELLED;
|
||||||
|
|
||||||
if (all) {
|
if (all) {
|
||||||
for (psys=ob->particlesystem.first; psys; psys=psys->next) {
|
for (psys = ob->particlesystem.first; psys; psys = psys->next) {
|
||||||
disconnect_hair(bmain, scene, ob, psys);
|
disconnect_hair(bmain, scene, ob, psys);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -615,7 +615,7 @@ static int disconnect_hair_exec(bContext *C, wmOperator *op)
|
|||||||
}
|
}
|
||||||
|
|
||||||
DAG_id_tag_update(&ob->id, OB_RECALC_DATA);
|
DAG_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;
|
return OPERATOR_FINISHED;
|
||||||
}
|
}
|
||||||
@@ -645,7 +645,7 @@ static bool remap_hair_emitter(Main *bmain, Scene *scene, Object *ob, ParticleSy
|
|||||||
ParticleData *pa, *tpa;
|
ParticleData *pa, *tpa;
|
||||||
PTCacheEditPoint *edit_point;
|
PTCacheEditPoint *edit_point;
|
||||||
PTCacheEditKey *ekey;
|
PTCacheEditKey *ekey;
|
||||||
BVHTreeFromMesh bvhtree= {NULL};
|
BVHTreeFromMesh bvhtree = {NULL};
|
||||||
MFace *mface = NULL, *mf;
|
MFace *mface = NULL, *mf;
|
||||||
MEdge *medge = NULL, *me;
|
MEdge *medge = NULL, *me;
|
||||||
MVert *mvert;
|
MVert *mvert;
|
||||||
@@ -690,7 +690,7 @@ static bool remap_hair_emitter(Main *bmain, Scene *scene, Object *ob, ParticleSy
|
|||||||
mvert = dm->getVertArray(dm);
|
mvert = dm->getVertArray(dm);
|
||||||
|
|
||||||
/* convert to global coordinates */
|
/* convert to global coordinates */
|
||||||
for (i=0; i<numverts; i++)
|
for (i = 0; i < numverts; i++)
|
||||||
mul_m4_v3(to_mat, mvert[i].co);
|
mul_m4_v3(to_mat, mvert[i].co);
|
||||||
|
|
||||||
if (dm->getNumTessFaces(dm) != 0) {
|
if (dm->getNumTessFaces(dm) != 0) {
|
||||||
@@ -782,7 +782,7 @@ static bool remap_hair_emitter(Main *bmain, Scene *scene, Object *ob, ParticleSy
|
|||||||
sub_v3_v3v3(offset, nearest.co, from_co);
|
sub_v3_v3v3(offset, nearest.co, from_co);
|
||||||
|
|
||||||
if (edit_point) {
|
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];
|
float co_orig[3];
|
||||||
|
|
||||||
if (from_global)
|
if (from_global)
|
||||||
@@ -801,7 +801,7 @@ static bool remap_hair_emitter(Main *bmain, Scene *scene, Object *ob, ParticleSy
|
|||||||
edit_point++;
|
edit_point++;
|
||||||
}
|
}
|
||||||
else {
|
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];
|
float co_orig[3];
|
||||||
|
|
||||||
if (from_global)
|
if (from_global)
|
||||||
@@ -845,9 +845,9 @@ static bool connect_hair(Main *bmain, Scene *scene, Object *ob, ParticleSystem *
|
|||||||
static int connect_hair_exec(bContext *C, wmOperator *op)
|
static int connect_hair_exec(bContext *C, wmOperator *op)
|
||||||
{
|
{
|
||||||
Main *bmain = CTX_data_main(C);
|
Main *bmain = CTX_data_main(C);
|
||||||
Scene *scene= CTX_data_scene(C);
|
Scene *scene = CTX_data_scene(C);
|
||||||
Object *ob= ED_object_context(C);
|
Object *ob = ED_object_context(C);
|
||||||
ParticleSystem *psys= NULL;
|
ParticleSystem *psys = NULL;
|
||||||
const bool all = RNA_boolean_get(op->ptr, "all");
|
const bool all = RNA_boolean_get(op->ptr, "all");
|
||||||
bool any_connected = false;
|
bool any_connected = false;
|
||||||
|
|
||||||
@@ -855,7 +855,7 @@ static int connect_hair_exec(bContext *C, wmOperator *op)
|
|||||||
return OPERATOR_CANCELLED;
|
return OPERATOR_CANCELLED;
|
||||||
|
|
||||||
if (all) {
|
if (all) {
|
||||||
for (psys=ob->particlesystem.first; psys; psys=psys->next) {
|
for (psys = ob->particlesystem.first; psys; psys = psys->next) {
|
||||||
any_connected |= connect_hair(bmain, scene, ob, psys);
|
any_connected |= connect_hair(bmain, scene, ob, psys);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -871,7 +871,7 @@ static int connect_hair_exec(bContext *C, wmOperator *op)
|
|||||||
}
|
}
|
||||||
|
|
||||||
DAG_id_tag_update(&ob->id, OB_RECALC_DATA);
|
DAG_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;
|
return OPERATOR_FINISHED;
|
||||||
}
|
}
|
||||||
@@ -922,7 +922,7 @@ static void copy_particle_edit(Main *bmain, Scene *scene, Object *ob, ParticleSy
|
|||||||
LOOP_POINTS {
|
LOOP_POINTS {
|
||||||
HairKey *hkey = pa->hair;
|
HairKey *hkey = pa->hair;
|
||||||
|
|
||||||
point->keys= MEM_dupallocN(point->keys);
|
point->keys = MEM_dupallocN(point->keys);
|
||||||
LOOP_KEYS {
|
LOOP_KEYS {
|
||||||
key->co = hkey->co;
|
key->co = hkey->co;
|
||||||
key->time = &hkey->time;
|
key->time = &hkey->time;
|
||||||
@@ -1004,7 +1004,7 @@ static bool copy_particle_systems_to_object(Main *bmain,
|
|||||||
#define PSYS_FROM_NEXT(cur) (single_psys_from ? NULL : (cur)->next)
|
#define PSYS_FROM_NEXT(cur) (single_psys_from ? NULL : (cur)->next)
|
||||||
totpsys = single_psys_from ? 1 : BLI_listbase_count(&ob_from->particlesystem);
|
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;
|
cdmask = 0;
|
||||||
for (psys_from = PSYS_FROM_FIRST, i = 0;
|
for (psys_from = PSYS_FROM_FIRST, i = 0;
|
||||||
@@ -1070,7 +1070,7 @@ static bool copy_particle_systems_to_object(Main *bmain,
|
|||||||
psys;
|
psys;
|
||||||
psys = psys->next, psys_from = PSYS_FROM_NEXT(psys_from), ++i)
|
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) {
|
switch (space) {
|
||||||
case PAR_COPY_SPACE_OBJECT:
|
case PAR_COPY_SPACE_OBJECT:
|
||||||
@@ -1089,8 +1089,8 @@ static bool copy_particle_systems_to_object(Main *bmain,
|
|||||||
}
|
}
|
||||||
if (ob_from != ob_to) {
|
if (ob_from != ob_to) {
|
||||||
remap_hair_emitter(
|
remap_hair_emitter(
|
||||||
bmain, scene, ob_from, psys_from, ob_to, psys, psys->edit,
|
bmain, scene, ob_from, psys_from, ob_to, psys, psys->edit,
|
||||||
from_mat, to_mat, psys_from->flag & PSYS_GLOBAL_HAIR, psys->flag & PSYS_GLOBAL_HAIR);
|
from_mat, to_mat, psys_from->flag & PSYS_GLOBAL_HAIR, psys->flag & PSYS_GLOBAL_HAIR);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* tag for recalc */
|
/* tag for recalc */
|
||||||
|
Reference in New Issue
Block a user