add missing NULL checks from BKE_constraint_get_typeinfo(), so constraints from the future dont crash.
also remove some redundant NULL checks.
This commit is contained in:
parent
6e940a15cb
commit
8052bf0ec2
@ -1439,21 +1439,19 @@ void BKE_movieclip_unlink(Main *bmain, MovieClip *clip)
|
|||||||
bConstraint *con;
|
bConstraint *con;
|
||||||
|
|
||||||
for (con = ob->constraints.first; con; con = con->next) {
|
for (con = ob->constraints.first; con; con = con->next) {
|
||||||
bConstraintTypeInfo *cti = BKE_constraint_get_typeinfo(con);
|
if (con->type == CONSTRAINT_TYPE_FOLLOWTRACK) {
|
||||||
|
|
||||||
if (cti->type == CONSTRAINT_TYPE_FOLLOWTRACK) {
|
|
||||||
bFollowTrackConstraint *data = (bFollowTrackConstraint *) con->data;
|
bFollowTrackConstraint *data = (bFollowTrackConstraint *) con->data;
|
||||||
|
|
||||||
if (data->clip == clip)
|
if (data->clip == clip)
|
||||||
data->clip = NULL;
|
data->clip = NULL;
|
||||||
}
|
}
|
||||||
else if (cti->type == CONSTRAINT_TYPE_CAMERASOLVER) {
|
else if (con->type == CONSTRAINT_TYPE_CAMERASOLVER) {
|
||||||
bCameraSolverConstraint *data = (bCameraSolverConstraint *) con->data;
|
bCameraSolverConstraint *data = (bCameraSolverConstraint *) con->data;
|
||||||
|
|
||||||
if (data->clip == clip)
|
if (data->clip == clip)
|
||||||
data->clip = NULL;
|
data->clip = NULL;
|
||||||
}
|
}
|
||||||
else if (cti->type == CONSTRAINT_TYPE_OBJECTSOLVER) {
|
else if (con->type == CONSTRAINT_TYPE_OBJECTSOLVER) {
|
||||||
bObjectSolverConstraint *data = (bObjectSolverConstraint *) con->data;
|
bObjectSolverConstraint *data = (bObjectSolverConstraint *) con->data;
|
||||||
|
|
||||||
if (data->clip == clip)
|
if (data->clip == clip)
|
||||||
|
@ -8174,12 +8174,7 @@ static void do_versions(FileData *fd, Library *lib, Main *main)
|
|||||||
for (ob = main->object.first; ob; ob = ob->id.next) {
|
for (ob = main->object.first; ob; ob = ob->id.next) {
|
||||||
bConstraint *con;
|
bConstraint *con;
|
||||||
for (con = ob->constraints.first; con; con = con->next) {
|
for (con = ob->constraints.first; con; con = con->next) {
|
||||||
bConstraintTypeInfo *cti = BKE_constraint_get_typeinfo(con);
|
if (con->type == CONSTRAINT_TYPE_OBJECTSOLVER) {
|
||||||
|
|
||||||
if (!cti)
|
|
||||||
continue;
|
|
||||||
|
|
||||||
if (cti->type == CONSTRAINT_TYPE_OBJECTSOLVER) {
|
|
||||||
bObjectSolverConstraint *data = (bObjectSolverConstraint *)con->data;
|
bObjectSolverConstraint *data = (bObjectSolverConstraint *)con->data;
|
||||||
|
|
||||||
if (data->invmat[3][3] == 0.0f)
|
if (data->invmat[3][3] == 0.0f)
|
||||||
|
@ -875,7 +875,7 @@ static int modifier_remove_exec(bContext *C, wmOperator *op)
|
|||||||
ModifierData *md = edit_modifier_property_get(op, ob, 0);
|
ModifierData *md = edit_modifier_property_get(op, ob, 0);
|
||||||
int mode_orig = ob ? ob->mode : 0;
|
int mode_orig = ob ? ob->mode : 0;
|
||||||
|
|
||||||
if (!ob || !md || !ED_object_modifier_remove(op->reports, bmain, ob, md))
|
if (!md || !ED_object_modifier_remove(op->reports, bmain, ob, md))
|
||||||
return OPERATOR_CANCELLED;
|
return OPERATOR_CANCELLED;
|
||||||
|
|
||||||
WM_event_add_notifier(C, NC_OBJECT | ND_MODIFIER, ob);
|
WM_event_add_notifier(C, NC_OBJECT | ND_MODIFIER, ob);
|
||||||
@ -919,7 +919,7 @@ static int modifier_move_up_exec(bContext *C, wmOperator *op)
|
|||||||
Object *ob = ED_object_active_context(C);
|
Object *ob = ED_object_active_context(C);
|
||||||
ModifierData *md = edit_modifier_property_get(op, ob, 0);
|
ModifierData *md = edit_modifier_property_get(op, ob, 0);
|
||||||
|
|
||||||
if (!ob || !md || !ED_object_modifier_move_up(op->reports, ob, md))
|
if (!md || !ED_object_modifier_move_up(op->reports, ob, md))
|
||||||
return OPERATOR_CANCELLED;
|
return OPERATOR_CANCELLED;
|
||||||
|
|
||||||
DAG_id_tag_update(&ob->id, OB_RECALC_DATA);
|
DAG_id_tag_update(&ob->id, OB_RECALC_DATA);
|
||||||
@ -958,7 +958,7 @@ static int modifier_move_down_exec(bContext *C, wmOperator *op)
|
|||||||
Object *ob = ED_object_active_context(C);
|
Object *ob = ED_object_active_context(C);
|
||||||
ModifierData *md = edit_modifier_property_get(op, ob, 0);
|
ModifierData *md = edit_modifier_property_get(op, ob, 0);
|
||||||
|
|
||||||
if (!ob || !md || !ED_object_modifier_move_down(op->reports, ob, md))
|
if (!md || !ED_object_modifier_move_down(op->reports, ob, md))
|
||||||
return OPERATOR_CANCELLED;
|
return OPERATOR_CANCELLED;
|
||||||
|
|
||||||
DAG_id_tag_update(&ob->id, OB_RECALC_DATA);
|
DAG_id_tag_update(&ob->id, OB_RECALC_DATA);
|
||||||
@ -999,7 +999,7 @@ static int modifier_apply_exec(bContext *C, wmOperator *op)
|
|||||||
ModifierData *md = edit_modifier_property_get(op, ob, 0);
|
ModifierData *md = edit_modifier_property_get(op, ob, 0);
|
||||||
int apply_as = RNA_enum_get(op->ptr, "apply_as");
|
int apply_as = RNA_enum_get(op->ptr, "apply_as");
|
||||||
|
|
||||||
if (!ob || !md || !ED_object_modifier_apply(op->reports, scene, ob, md, apply_as)) {
|
if (!md || !ED_object_modifier_apply(op->reports, scene, ob, md, apply_as)) {
|
||||||
return OPERATOR_CANCELLED;
|
return OPERATOR_CANCELLED;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1049,7 +1049,7 @@ static int modifier_convert_exec(bContext *C, wmOperator *op)
|
|||||||
Object *ob = ED_object_active_context(C);
|
Object *ob = ED_object_active_context(C);
|
||||||
ModifierData *md = edit_modifier_property_get(op, ob, 0);
|
ModifierData *md = edit_modifier_property_get(op, ob, 0);
|
||||||
|
|
||||||
if (!ob || !md || !ED_object_modifier_convert(op->reports, bmain, scene, ob, md))
|
if (!md || !ED_object_modifier_convert(op->reports, bmain, scene, ob, md))
|
||||||
return OPERATOR_CANCELLED;
|
return OPERATOR_CANCELLED;
|
||||||
|
|
||||||
DAG_id_tag_update(&ob->id, OB_RECALC_DATA);
|
DAG_id_tag_update(&ob->id, OB_RECALC_DATA);
|
||||||
@ -1088,7 +1088,7 @@ static int modifier_copy_exec(bContext *C, wmOperator *op)
|
|||||||
Object *ob = ED_object_active_context(C);
|
Object *ob = ED_object_active_context(C);
|
||||||
ModifierData *md = edit_modifier_property_get(op, ob, 0);
|
ModifierData *md = edit_modifier_property_get(op, ob, 0);
|
||||||
|
|
||||||
if (!ob || !md || !ED_object_modifier_copy(op->reports, ob, md))
|
if (!md || !ED_object_modifier_copy(op->reports, ob, md))
|
||||||
return OPERATOR_CANCELLED;
|
return OPERATOR_CANCELLED;
|
||||||
|
|
||||||
DAG_id_tag_update(&ob->id, OB_RECALC_DATA);
|
DAG_id_tag_update(&ob->id, OB_RECALC_DATA);
|
||||||
|
@ -3094,8 +3094,8 @@ static void draw_em_fancy(Scene *scene, ARegion *ar, View3D *v3d,
|
|||||||
BMVert *eve_act = NULL;
|
BMVert *eve_act = NULL;
|
||||||
bool use_occlude_wire = (v3d->flag2 & V3D_OCCLUDE_WIRE) && (dt > OB_WIRE);
|
bool use_occlude_wire = (v3d->flag2 & V3D_OCCLUDE_WIRE) && (dt > OB_WIRE);
|
||||||
|
|
||||||
// if (cageDM) BLI_assert(!(cageDM->dirty & DM_DIRTY_NORMALS));
|
// BLI_assert(!cageDM || !(cageDM->dirty & DM_DIRTY_NORMALS));
|
||||||
if (finalDM) BLI_assert(!(finalDM->dirty & DM_DIRTY_NORMALS));
|
BLI_assert(!finalDM || !(finalDM->dirty & DM_DIRTY_NORMALS));
|
||||||
|
|
||||||
if (em->bm->selected.last) {
|
if (em->bm->selected.last) {
|
||||||
BMEditSelection *ese = em->bm->selected.last;
|
BMEditSelection *ese = em->bm->selected.last;
|
||||||
@ -7253,23 +7253,19 @@ void draw_object(Scene *scene, ARegion *ar, View3D *v3d, Base *base, const short
|
|||||||
cob = BKE_constraints_make_evalob(scene, ob, NULL, CONSTRAINT_OBTYPE_OBJECT);
|
cob = BKE_constraints_make_evalob(scene, ob, NULL, CONSTRAINT_OBTYPE_OBJECT);
|
||||||
|
|
||||||
for (curcon = list->first; curcon; curcon = curcon->next) {
|
for (curcon = list->first; curcon; curcon = curcon->next) {
|
||||||
bConstraintTypeInfo *cti = BKE_constraint_get_typeinfo(curcon);
|
if (ELEM(curcon->type, CONSTRAINT_TYPE_FOLLOWTRACK, CONSTRAINT_TYPE_OBJECTSOLVER)) {
|
||||||
ListBase targets = {NULL, NULL};
|
|
||||||
bConstraintTarget *ct;
|
|
||||||
|
|
||||||
if (ELEM(cti->type, CONSTRAINT_TYPE_FOLLOWTRACK, CONSTRAINT_TYPE_OBJECTSOLVER)) {
|
|
||||||
/* special case for object solver and follow track constraints because they don't fill
|
/* special case for object solver and follow track constraints because they don't fill
|
||||||
* constraint targets properly (design limitation -- scene is needed for their target
|
* constraint targets properly (design limitation -- scene is needed for their target
|
||||||
* but it can't be accessed from get_targets callvack) */
|
* but it can't be accessed from get_targets callvack) */
|
||||||
|
|
||||||
Object *camob = NULL;
|
Object *camob = NULL;
|
||||||
|
|
||||||
if (cti->type == CONSTRAINT_TYPE_FOLLOWTRACK) {
|
if (curcon->type == CONSTRAINT_TYPE_FOLLOWTRACK) {
|
||||||
bFollowTrackConstraint *data = (bFollowTrackConstraint *)curcon->data;
|
bFollowTrackConstraint *data = (bFollowTrackConstraint *)curcon->data;
|
||||||
|
|
||||||
camob = data->camera ? data->camera : scene->camera;
|
camob = data->camera ? data->camera : scene->camera;
|
||||||
}
|
}
|
||||||
else if (cti->type == CONSTRAINT_TYPE_OBJECTSOLVER) {
|
else if (curcon->type == CONSTRAINT_TYPE_OBJECTSOLVER) {
|
||||||
bObjectSolverConstraint *data = (bObjectSolverConstraint *)curcon->data;
|
bObjectSolverConstraint *data = (bObjectSolverConstraint *)curcon->data;
|
||||||
|
|
||||||
camob = data->camera ? data->camera : scene->camera;
|
camob = data->camera ? data->camera : scene->camera;
|
||||||
@ -7284,7 +7280,13 @@ void draw_object(Scene *scene, ARegion *ar, View3D *v3d, Base *base, const short
|
|||||||
setlinestyle(0);
|
setlinestyle(0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if ((curcon->flag & CONSTRAINT_EXPAND) && (cti->get_constraint_targets)) {
|
else {
|
||||||
|
bConstraintTypeInfo *cti = BKE_constraint_get_typeinfo(curcon);
|
||||||
|
|
||||||
|
if ((cti && cti->get_constraint_targets) && (curcon->flag & CONSTRAINT_EXPAND)) {
|
||||||
|
ListBase targets = {NULL, NULL};
|
||||||
|
bConstraintTarget *ct;
|
||||||
|
|
||||||
cti->get_constraint_targets(curcon, &targets);
|
cti->get_constraint_targets(curcon, &targets);
|
||||||
|
|
||||||
for (ct = targets.first; ct; ct = ct->next) {
|
for (ct = targets.first; ct; ct = ct->next) {
|
||||||
@ -7306,6 +7308,7 @@ void draw_object(Scene *scene, ARegion *ar, View3D *v3d, Base *base, const short
|
|||||||
cti->flush_constraint_targets(curcon, &targets, 1);
|
cti->flush_constraint_targets(curcon, &targets, 1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
BKE_constraints_clear_evalob(cob);
|
BKE_constraints_clear_evalob(cob);
|
||||||
}
|
}
|
||||||
|
@ -5880,14 +5880,8 @@ int EdgeSlide(TransInfo *t, const int UNUSED(mval[2]))
|
|||||||
|
|
||||||
t->values[0] = final;
|
t->values[0] = final;
|
||||||
|
|
||||||
/*do stuff here*/
|
/* do stuff here */
|
||||||
if (t->customData) {
|
|
||||||
doEdgeSlide(t, final);
|
doEdgeSlide(t, final);
|
||||||
}
|
|
||||||
else {
|
|
||||||
BLI_strncpy(str, IFACE_("Invalid Edge Selection"), MAX_INFO_LEN);
|
|
||||||
t->state = TRANS_CANCEL;
|
|
||||||
}
|
|
||||||
|
|
||||||
recalcData(t);
|
recalcData(t);
|
||||||
|
|
||||||
@ -6394,14 +6388,8 @@ int VertSlide(TransInfo *t, const int UNUSED(mval[2]))
|
|||||||
ofs += BLI_snprintf(str + ofs, MAX_INFO_LEN - ofs, IFACE_("Alt or (C)lamp: %s"), is_clamp ? on_str : off_str);
|
ofs += BLI_snprintf(str + ofs, MAX_INFO_LEN - ofs, IFACE_("Alt or (C)lamp: %s"), is_clamp ? on_str : off_str);
|
||||||
/* done with header string */
|
/* done with header string */
|
||||||
|
|
||||||
/*do stuff here*/
|
/* do stuff here */
|
||||||
if (t->customData) {
|
|
||||||
doVertSlide(t, final);
|
doVertSlide(t, final);
|
||||||
}
|
|
||||||
else {
|
|
||||||
BLI_strncpy(str, IFACE_("Invalid Vert Selection"), MAX_INFO_LEN);
|
|
||||||
t->state = TRANS_CANCEL;
|
|
||||||
}
|
|
||||||
|
|
||||||
recalcData(t);
|
recalcData(t);
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user