SURenderingOptionsGetValue function throw exception


#1

I am using SDK_Win_x64_18-0-18664.zip. 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:
    excetion

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


#2

SUModelGetRenderingOptions(model, &ro);

Are you checking the return value?


#3

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


#4

I was referring to row 8, GetRenderingOptions

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


#5

Thanks for your replies.

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


#6

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;