Notifications
Clear all
[Closed] Make Viewport snapshot
Page 2 / 2
Prev
Jul 14, 2015 11:24 am
Haha, this all works now.
my bad I set the index viewPanelIndex = 1; and Not 0
void BasicTools::Image(){
int viewPanelIndex = 0;
int index = 3;
IViewPanel* pPanel = GetViewPanelManager()->GetViewPanel(viewPanelIndex);
BITMAPINFO *bmi = NULL;
BITMAPINFOHEADER *bmih;
BitmapInfo biFile;
Bitmap *map;
int size;
TheManager->SelectFileOutput(&biFile, ip->GetMAXHWnd(), _M("Testing"));
//if(!biFile.Name()[0])
// return;
ViewExp *vpt = nullptr;
vpt = pPanel->GetViewExpByIndex(index).ToPointer();
vpt->getGW()->getDIB(NULL, &size);
bmi = (BITMAPINFO *)malloc(size);
bmih = (BITMAPINFOHEADER *)bmi;
vpt->getGW()->getDIB(bmi, &size);
biFile.SetWidth((WORD)bmih->biWidth);
biFile.SetHeight((WORD)bmih->biHeight);
biFile.SetType(BMM_TRUE_32);
map = TheManager->Create(&biFile);
map->OpenOutput(&biFile);
map->FromDib(bmi);
map->Write(&biFile);
map->Close(&biFile);
if(bmi)
free(bmi);
// ip->ReleaseViewport(vpt);
}
I’m not using ReleaseViewport not sure if this will give me problems in the end
Jul 14, 2015 11:24 am
Sorry for my stupid question, but I know nothing about SDK:
How can I insert your code in a maxscript file to test it?
Jul 14, 2015 11:24 am
No sorry, it has to be in a c++ plugin with function publishing to use in maxscript
Jul 14, 2015 11:24 am
hellow how to rename as jpg name four digits for examples
ı want to save
for t = animationrange.start to animationrange.end do
(viewport_snapshot (t as string + “_.jpg”) t
)
jpgs like that 0001.jpg ,0002.jpg ,0003.jpg ,0004.jpg
Jul 14, 2015 11:24 am
you can use this hack…
http://cganimator.com/uiaccessor-mini-tutorial-how-to-control-make-preview-dialog/
Page 2 / 2
Prev