PDA

View Full Version : MImage::resize(int, int, boolean)


archaeology
11-23-2004, 06:09 PM
Does anyone know anything about the MImage object? Any advice on this is greatly appreciated. Here's the problem, I'm writing an exporter for X3D format and want to resize textures on export. Basically I've got everything working correctly except calling the resize procedure on an MImage object doesn't seem to do anything. The exported textures end up being the same size as the originals. I'm at a loss as to why. I posted on highend3d.com... nobody seemed to be able to find anything wrong with my code. I'm at a loss. The adjTexture variable is set to true, because the word "yes" prints out in the Output Window. See is my code below:

if(adjTexture)
{
int fWidth = x3dTextureWidth;
int fHeight = x3dTextureHeight;
fImage.resize(fWidth, fHeight, false);

msg.set("yes");
cout << msg << endl;

}

MString writeOutPath(localImagePath);
writeOutPath.operator +=(fileParts.operator [](0));
writeOutPath.operator +=(".");
writeOutPath.operator +=(fileParts.operator [](1));
fImage.writeToFile(writeOutPath, fileParts.operator [](1));

Any adivce someone can give on this is greatly appreciated.

Thanks,

Aaron

archaeology
11-23-2004, 07:47 PM
Well as it turns out I was using "unsigned int" when I should have been using "int".

I was using MGlobal::executeCommand in order to get the value of an int optionVar. Unfortunately for me, I was passing the the executeCommand an unsigned int, eventhought executeCommand will only accept the standard "int". Because of this, my "x3dTextureWidth" and "x3dTextureHeight" values were still null. So when I attempted to put those values in to the MImage::resize procedure, the MImage object didn't get resized.

Unfortunately, the resize procedure was returning an "MStatus::KSuccess" value, instead of a kFailure value so it was more difficult for me to track down.

So long story short - making x3dTextureWidth and x3dTextureHeight "int" instead of "unsigned int" did the trick.

Thanks,

Aaron

CGTalk Moderation
01-19-2006, 11:00 PM
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.