Skip to content

Commit

Permalink
Use callback for replot_editing_solid
Browse files Browse the repository at this point in the history
  • Loading branch information
starseeker committed Jan 27, 2025
1 parent 9e9cd67 commit 89e3c87
Show file tree
Hide file tree
Showing 7 changed files with 20 additions and 17 deletions.
25 changes: 14 additions & 11 deletions src/mged/edsol.c
Original file line number Diff line number Diff line change
Expand Up @@ -316,20 +316,21 @@ init_sedit_vars(struct mged_state *s)
* All solid edit routines call this subroutine after
* making a change to es_int or s->s_edit->e_mat.
*/
void
replot_editing_solid(struct mged_state *s)
int
replot_editing_solid(int UNUSED(ac), const char **UNUSED(av), void *d, void *UNUSED(id))
{
struct mged_state *s = (struct mged_state *)d;
struct display_list *gdlp;
struct display_list *next_gdlp;
mat_t mat;
struct bv_scene_obj *sp;
struct directory *illdp;

if (!illump) {
return;
return BRLCAD_OK;
}
if (!illump->s_u_data)
return;
return BRLCAD_OK;
struct ged_bv_data *bdata = (struct ged_bv_data *)illump->s_u_data;
illdp = LAST_SOLID(bdata);

Expand All @@ -349,6 +350,8 @@ replot_editing_solid(struct mged_state *s)

gdlp = next_gdlp;
}

return BRLCAD_OK;
}


Expand Down Expand Up @@ -522,7 +525,7 @@ sedit(struct mged_state *s)

int flag = 0;
set_e_axes_pos(0, NULL, (void *)s, (void *)&flag);
replot_editing_solid(s);
replot_editing_solid(0, NULL, s, NULL);

if (update_views) {
dm_set_dirty(DMP, 1);
Expand Down Expand Up @@ -1068,7 +1071,7 @@ f_eqn(ClientData clientData, Tcl_Interp *UNUSED(interp), int argc, const char *a
return ret;

/* draw the new version of the solid */
replot_editing_solid(s);
replot_editing_solid(0, NULL, s, NULL);

/* update display information */
view_state->vs_flag = 1;
Expand Down Expand Up @@ -1655,7 +1658,7 @@ f_put_sedit(ClientData clientData, Tcl_Interp *interp, int argc, const char *arg

int flag = 0;
set_e_axes_pos(0, NULL, (void *)s, (void *)&flag);
replot_editing_solid(s);
replot_editing_solid(0, NULL, s, NULL);

return TCL_OK;
}
Expand Down Expand Up @@ -1705,7 +1708,7 @@ f_sedit_reset(ClientData clientData, Tcl_Interp *interp, int argc, const char *U
return TCL_ERROR; /* FAIL */
}
RT_CK_DB_INTERNAL(&s->s_edit->es_int);
replot_editing_solid(s);
replot_editing_solid(0, NULL, s, NULL);

/* Establish initial keypoint */
s->s_edit->e_keytag = "";
Expand Down Expand Up @@ -1919,7 +1922,7 @@ f_extrude(ClientData clientData, Tcl_Interp *interp, int argc, const char *argv[
}

/* draw the updated solid */
replot_editing_solid(s);
replot_editing_solid(0, NULL, s, NULL);
update_views = 1;
dm_set_dirty(DMP, 1);

Expand Down Expand Up @@ -1978,7 +1981,7 @@ f_mirface(ClientData clientData, Tcl_Interp *interp, int argc, const char *argv[
}

/* draw the updated solid */
replot_editing_solid(s);
replot_editing_solid(0, NULL, s, NULL);
view_state->vs_flag = 1;

return TCL_OK;
Expand Down Expand Up @@ -2067,7 +2070,7 @@ f_permute(ClientData clientData, Tcl_Interp *interp, int argc, const char *argv[
}

/* draw the updated solid */
replot_editing_solid(s);
replot_editing_solid(0, NULL, s, NULL);
view_state->vs_flag = 1;

return TCL_OK;
Expand Down
2 changes: 1 addition & 1 deletion src/mged/facedef.c
Original file line number Diff line number Diff line change
Expand Up @@ -313,7 +313,7 @@ f_facedef(ClientData clientData, Tcl_Interp *interp, int argc, const char *argv[
rt_db_free_internal(&intern);

/* draw the new solid */
replot_editing_solid(s);
replot_editing_solid(0, NULL, s, NULL);

end:
(void)signal(SIGINT, SIG_IGN);
Expand Down
2 changes: 1 addition & 1 deletion src/mged/mged.h
Original file line number Diff line number Diff line change
Expand Up @@ -596,7 +596,7 @@ void transform_editing_solid(
const mat_t mat,
struct rt_db_internal *is, /* input solid */
int freedbi);
void replot_editing_solid(struct mged_state *s);
int replot_editing_solid(int, const char **, void *, void *);
void sedit_abs_scale(struct mged_state *s);
void sedit_accept(struct mged_state *s);
void sedit_mouse(struct mged_state *s, const vect_t mousevec);
Expand Down
2 changes: 1 addition & 1 deletion src/mged/mged_impl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ mged_state_create(void)
// Register default callbacks
mged_state_clbk_set(s, 0, ECMD_PRINT_RESULTS, 0, GED_CLBK_DURING, mged_print_result, s);
mged_state_clbk_set(s, 0, ECMD_EAXES_POS , 0, GED_CLBK_DURING, set_e_axes_pos, s);
//mged_state_clbk_set(s, 0, ECMD_REPLOT_EDITING_SOLID, 0, GED_CLBK_DURING, replot_editing_solid, s);
mged_state_clbk_set(s, 0, ECMD_REPLOT_EDITING_SOLID, 0, GED_CLBK_DURING, replot_editing_solid, s);
//mged_state_clbk_set(s, 0, ECMD_VIEW_UPDATE, 0, GED_CLBK_DURING, ecmd_view_update, s);

return s;
Expand Down
2 changes: 1 addition & 1 deletion src/mged/primitives/edarb.c
Original file line number Diff line number Diff line change
Expand Up @@ -1162,7 +1162,7 @@ ecmd_arb_rotate_face(struct mged_state *s)
MAT_IDN(s->s_edit->incr_change);

/* no need to calc_planes again */
replot_editing_solid(s);
replot_editing_solid(0, NULL, s, NULL);

s->s_edit->e_inpara = 0;

Expand Down
2 changes: 1 addition & 1 deletion src/mged/primitives/ednmg.c
Original file line number Diff line number Diff line change
Expand Up @@ -855,7 +855,7 @@ void ecmd_nmg_lextru(struct mged_state *s)

es_eu = (struct edgeuse *)NULL;

replot_editing_solid(s);
replot_editing_solid(0, NULL, s, NULL);
view_state->vs_flag = 1;
}

Expand Down
2 changes: 1 addition & 1 deletion src/mged/tedit.c
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,7 @@ f_tedit(ClientData clientData, Tcl_Interp *interp, int argc, const char **UNUSED
}

/* Update the display */
replot_editing_solid(s);
replot_editing_solid(0, NULL, s, NULL);
view_state->vs_flag = 1;
Tcl_AppendResult(interp, "done\n", (char *)NULL);
}
Expand Down

0 comments on commit 89e3c87

Please sign in to comment.