Is SURenderingOptionsGetValue supposed to work?


#1

i’m in the process of writing a sketchup importers for a 3d-application

SUResult res = SURenderingOptionsGetValue(rOpt, “FaceBackColor”, &val);
res is is always SU_ERROR_INVALID_OUTPUT
for any option-name i tried

what i need is EdgeColorMode, FaceColorMode, ForegroundColor, FaceBackColor, FaceFrontColor
every call with this strings returns SU_ERROR_INVALID_OUTPUT

guruware


#2

Can you provide a sample code snippet with more context?


#3

// that’s my current code

int skp_getRenderParams(SUModelRef model, SkpRenderParams* pRenderParams)
{
SUResult res = SU_ERROR_NONE;
SURenderingOptionsRef rOpt = SU_INVALID;

SUModelGetRenderingOptions(model, &rOpt);

if(SUIsValid(rOpt))
{
	SUTypedValueType valType = SUTypedValueType_Empty;
	SUTypedValueRef val = SU_INVALID;

	SUResult res = SURenderingOptionsGetValue(rOpt, "FaceBackColor", &val);

	// here res = SU_ERROR_INVALID_OUTPUT
	....
}
....

}

btw. i’m compiling using unicode char set
The key is assumed to be UTF-8 encoded, which is in this case,
just to make sure i used a unicode string L"FaceBackColor", converted it to utf-8…
same result: SU_ERROR_INVALID_OUTPUT

thanks for your help
guruware


#4

I’m not that familiar with the C API, @bugra or @Paul can give better answers. But I maybe you might need to use SUTypedValueCreate?


#5

ah, yes, that did it !
seems rather weird to me, as i don’t have to create a face to get its data
but that’s how it works… and i’m not really familiar with COM

thanks again
guruware


#6

I found the pattern odd as well to be honest. But I’m glad it worked.
Though I’m not sure if you need to explicitly release it after use…


#7

yes, it needs release after