SURenderingOptionsGetValue function throw exception

I am using I want to get the default front face color and back face color. The code in vs2017:

  1. int main() {

  2. SUInitialize();
  3. SUModelRef model = SU_INVALID;
  4. SUResult res = SUModelCreateFromFile(&model, "model.skp");
  5. if (res != SU_ERROR_NONE)
  6.     return 1;
  7. SURenderingOptionsRef ro;
  8. SUModelGetRenderingOptions(model, &ro);
  9. SUTypedValueRef value;
  10. SUTypedValueCreate(&value);
  11. res = SURenderingOptionsGetValue(ro, "FaceFrontColor", &value);
  12. SUColor color;
  13. SUTypedValueGetColor(value, &color);
  14. SUTypedValueRelease(&value);
  15. ...
  16. }
    when run the row 11 throw exception, as fallow:

I has checked this is not the utf8 coding problem.
I think this maybe the sdk’s bug. Has anybody ever had this question?

SUModelGetRenderingOptions(model, &ro);

Are you checking the return value?

I can’t get the return value, it has crashed.

I was referring to row 8, GetRenderingOptions

It may be that you need to call SUSceneGetUseRenderingOptions
Refer to this link: Getting Rendering Options DisplayColorByLayer

Thanks for your replies.

I have tried SUSceneGetUseRenderingOptions and SUSceneGetRenderingOptions, it has the same problem.

I pasted in your code, it was failing on SUTypedValueCreate because the passed value was not initially set, so try this…

SUTypedValueRef value = SU_INVALID;

This topic was automatically closed 91 days after the last reply. New replies are no longer allowed.