PDA

View Full Version : Accessing MaxScript bitmaps from C++


Ganymedes
10-06-2009, 11:07 AM
Hi everyone

Is it possible to retrieve bitmap data from MaxScript? I've tried something like the following bit of code, but the Bitmap pointer I get back is always NULL...


FPValue fpVal;
PBBitmap bmpWrapper;

//if(!ExecuteMAXScriptScript("bm = bitmap 400 400 color:red", FALSE, &fpVal)) // OK
if(!ExecuteMAXScriptScript("getLastRenderedImage copy:false;", FALSE, &fpVal)) // OK
{
DebugPrint("MaxScript execution failed!\n");
return;
}

assert(fpVal.type == TYPE_BITMAP_BV); // OK

bmpWrapper = *fpVal.bm;

BitmapInfo& info = bmpWrapper.bi; // OK
ss << "Retrieved bitmap info: ";
ss << "Height: " << info.Height() << ", width: " << info.Width() << ", aspect: " << info.Aspect() << endl;
DebugPrint(ss.str().c_str());

Bitmap* pBmp = bmpWrapper.bm; // always NULL!

if(pBmp)
DebugPrint("pBmp is defined...\n");
else
{
DebugPrint("pBmp is NULL!\n");
return;
}


So far I've tested this with Max 2010 64-bit.

The thing that really puzzles me is that the rest checks out OK. The value type is what I expect, and the BitmapInfo contains the correct values...

This isn't a crucial issue for me (I'm basically a modeler playing around with the SDK to see what I can learn). But I've spent enough time trying to figure it out that I just want to know what's going on, just for the peace of mind :)


Thanks for any help

CGTalk Moderation
10-06-2009, 11:07 AM
This thread has been automatically closed as it remained inactive for 12 months. If you wish to continue the discussion, please create a new thread in the appropriate forum.