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;
|
||||
|
||||
for (con = ob->constraints.first; con; con = con->next) {
|
||||
bConstraintTypeInfo *cti = BKE_constraint_get_typeinfo(con);
|
||||
|
||||
if (cti->type == CONSTRAINT_TYPE_FOLLOWTRACK) {
|
||||
if (con->type == CONSTRAINT_TYPE_FOLLOWTRACK) {
|
||||
bFollowTrackConstraint *data = (bFollowTrackConstraint *) con->data;
|
||||
|
||||
if (data->clip == clip)
|
||||
data->clip = NULL;
|
||||
}
|
||||
else if (cti->type == CONSTRAINT_TYPE_CAMERASOLVER) {
|
||||
else if (con->type == CONSTRAINT_TYPE_CAMERASOLVER) {
|
||||
bCameraSolverConstraint *data = (bCameraSolverConstraint *) con->data;
|
||||
|
||||
if (data->clip == clip)
|
||||
data->clip = NULL;
|
||||
}
|
||||
else if (cti->type == CONSTRAINT_TYPE_OBJECTSOLVER) {
|
||||
else if (con->type == CONSTRAINT_TYPE_OBJECTSOLVER) {
|
||||
bObjectSolverConstraint *data = (bObjectSolverConstraint *) con->data;
|
||||
|
||||
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) {
|
||||
bConstraint *con;
|
||||
for (con = ob->constraints.first; con; con = con->next) {
|
||||
bConstraintTypeInfo *cti = BKE_constraint_get_typeinfo(con);
|
||||
|
||||
if (!cti)
|
||||
continue;
|
||||
|
||||
if (cti->type == CONSTRAINT_TYPE_OBJECTSOLVER) {
|
||||
if (con->type == CONSTRAINT_TYPE_OBJECTSOLVER) {
|
||||
bObjectSolverConstraint *data = (bObjectSolverConstraint *)con->data;
|
||||
|
||||
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);
|
||||
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;
|
||||
|
||||
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);
|
||||
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;
|
||||
|
||||
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);
|
||||
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;
|
||||
|
||||
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);
|
||||
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;
|
||||
}
|
||||
|
||||
@ -1049,7 +1049,7 @@ static int modifier_convert_exec(bContext *C, wmOperator *op)
|
||||
Object *ob = ED_object_active_context(C);
|
||||
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;
|
||||
|
||||
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);
|
||||
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;
|
||||
|
||||
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;
|
||||
bool use_occlude_wire = (v3d->flag2 & V3D_OCCLUDE_WIRE) && (dt > OB_WIRE);
|
||||
|
||||
// if (cageDM) BLI_assert(!(cageDM->dirty & DM_DIRTY_NORMALS));
|
||||
if (finalDM) BLI_assert(!(finalDM->dirty & DM_DIRTY_NORMALS));
|
||||
// BLI_assert(!cageDM || !(cageDM->dirty & DM_DIRTY_NORMALS));
|
||||
BLI_assert(!finalDM || !(finalDM->dirty & DM_DIRTY_NORMALS));
|
||||
|
||||
if (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);
|
||||
|
||||
for (curcon = list->first; curcon; curcon = curcon->next) {
|
||||
bConstraintTypeInfo *cti = BKE_constraint_get_typeinfo(curcon);
|
||||
ListBase targets = {NULL, NULL};
|
||||
bConstraintTarget *ct;
|
||||
|
||||
if (ELEM(cti->type, CONSTRAINT_TYPE_FOLLOWTRACK, CONSTRAINT_TYPE_OBJECTSOLVER)) {
|
||||
if (ELEM(curcon->type, CONSTRAINT_TYPE_FOLLOWTRACK, CONSTRAINT_TYPE_OBJECTSOLVER)) {
|
||||
/* 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
|
||||
* but it can't be accessed from get_targets callvack) */
|
||||
|
||||
Object *camob = NULL;
|
||||
|
||||
if (cti->type == CONSTRAINT_TYPE_FOLLOWTRACK) {
|
||||
if (curcon->type == CONSTRAINT_TYPE_FOLLOWTRACK) {
|
||||
bFollowTrackConstraint *data = (bFollowTrackConstraint *)curcon->data;
|
||||
|
||||
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;
|
||||
|
||||
camob = data->camera ? data->camera : scene->camera;
|
||||
@ -7284,26 +7280,33 @@ void draw_object(Scene *scene, ARegion *ar, View3D *v3d, Base *base, const short
|
||||
setlinestyle(0);
|
||||
}
|
||||
}
|
||||
else if ((curcon->flag & CONSTRAINT_EXPAND) && (cti->get_constraint_targets)) {
|
||||
cti->get_constraint_targets(curcon, &targets);
|
||||
|
||||
for (ct = targets.first; ct; ct = ct->next) {
|
||||
/* calculate target's matrix */
|
||||
if (cti->get_target_matrix)
|
||||
cti->get_target_matrix(curcon, cob, ct, BKE_scene_frame_get(scene));
|
||||
else
|
||||
unit_m4(ct->matrix);
|
||||
|
||||
setlinestyle(3);
|
||||
glBegin(GL_LINES);
|
||||
glVertex3fv(ct->matrix[3]);
|
||||
glVertex3fv(ob->obmat[3]);
|
||||
glEnd();
|
||||
setlinestyle(0);
|
||||
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);
|
||||
|
||||
for (ct = targets.first; ct; ct = ct->next) {
|
||||
/* calculate target's matrix */
|
||||
if (cti->get_target_matrix)
|
||||
cti->get_target_matrix(curcon, cob, ct, BKE_scene_frame_get(scene));
|
||||
else
|
||||
unit_m4(ct->matrix);
|
||||
|
||||
setlinestyle(3);
|
||||
glBegin(GL_LINES);
|
||||
glVertex3fv(ct->matrix[3]);
|
||||
glVertex3fv(ob->obmat[3]);
|
||||
glEnd();
|
||||
setlinestyle(0);
|
||||
}
|
||||
|
||||
if (cti->flush_constraint_targets)
|
||||
cti->flush_constraint_targets(curcon, &targets, 1);
|
||||
}
|
||||
|
||||
if (cti->flush_constraint_targets)
|
||||
cti->flush_constraint_targets(curcon, &targets, 1);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -5880,14 +5880,8 @@ int EdgeSlide(TransInfo *t, const int UNUSED(mval[2]))
|
||||
|
||||
t->values[0] = final;
|
||||
|
||||
/*do stuff here*/
|
||||
if (t->customData) {
|
||||
doEdgeSlide(t, final);
|
||||
}
|
||||
else {
|
||||
BLI_strncpy(str, IFACE_("Invalid Edge Selection"), MAX_INFO_LEN);
|
||||
t->state = TRANS_CANCEL;
|
||||
}
|
||||
/* do stuff here */
|
||||
doEdgeSlide(t, final);
|
||||
|
||||
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);
|
||||
/* done with header string */
|
||||
|
||||
/*do stuff here*/
|
||||
if (t->customData) {
|
||||
doVertSlide(t, final);
|
||||
}
|
||||
else {
|
||||
BLI_strncpy(str, IFACE_("Invalid Vert Selection"), MAX_INFO_LEN);
|
||||
t->state = TRANS_CANCEL;
|
||||
}
|
||||
/* do stuff here */
|
||||
doVertSlide(t, final);
|
||||
|
||||
recalcData(t);
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user