How to get the current viewport subd level?

Hi,

I'm trying to get the current viewport subd level.

I've tried this code but it always returns 0 no matter what.

var myMesh = Scene.getPrimarySelection().getObject().getCurrentShape().getFacetMesh();var currentSubDLevel = myMesh.getCurrentSubDivisionLevel();print("Current Subdivision Level: " + currentSubDLevel);

Does anyone know what I'm doing wrong?

Thanks

Comments

  • I'd suggest breaking those chains of functions down and error checking them, but couldn't you just get the property and check its value?

  • OmnifluxOmniflux Posts: 428

    You've probably already solved this, but it should have been

     

    var myMesh = Scene.getPrimarySelection().getObject().getCurrentShape();
    var currentSubDLevel = myMesh.getSubDDrawLevel();
    print("Current Subdivision Level: " + currentSubDLevel);
  • Richard HaseltineRichard Haseltine Posts: 108,990

    I'd still break those chains of commands so they can be validated.

Sign In or Register to comment.