if I made some changes to a mesh object,and then using “obj.data.update()” to refrash the change in the viewport immediately with python.but how to do this in C code?
I try to using this function in C code and run this function via python with ctpyes:
void FUNC_reflash(Main* bmain)
{
bScreen *sc;
ScrArea *sa;
ARegion *ar;
for (sc =(bScreen *) bmain->screen.first; sc; sc =(bScreen *) sc->id.next)
{
for (sa =(ScrArea *) sc->areabase.first; sa; sa =(ScrArea *) sa->next)
{
if (sa->spacetype != SPACE_VIEW3D)
continue;
ED_area_tag_refresh(sa);
for (ar =(ARegion *) sa->regionbase.first; ar; ar =(ARegion *) ar->next)
{
RegionView3D *rv3d;
RenderEngine *engine;
if (ar->regiontype != RGN_TYPE_WINDOW)
continue;
ED_region_tag_redraw(ar);
}
}//for
}//for
}
void FUNC_update(bContext *C,Object*o)
{
Mesh*mesh=(Mesh*)o->data;
Main* bmain= CTX_data_main(C);
ED_mesh_update(bmain,mesh,C, 0, 0);
FUNC_reflash(bmain);
}
but It doesn’t works the same as “obj.data.update()” ,but why? since It’s py api definition is this in source\blender\makesrna\intern\rna_mesh_api.c: