Change Environment Type

DraagonStormDraagonStorm Posts: 748

How would I get the Environment type (None or Backdrop) and change it?

When I do a Scene.getBackdrop().clear(); it set the Environment Type to None, and I need to set it back to Backdrop.

Post edited by DraagonStorm on

Comments

  • Richard HaseltineRichard Haseltine Posts: 100,886
    edited November 2014

    Using Rob's standard code-crawling, one approach (though there's probably a better) might be:

     var paneMgr = MainWindow.getPaneMgr();
     // if successful, get the Content Library pane
     if ( paneMgr ) {
      var env = paneMgr.findPane( "DzEnvironmentPane" );
      // if successful, get the current container (folder or category)
      if ( env ) {
       // for ( item in env ) {
        env.noneSelected( true );
       // }
      }
     }

    to clear the backdrop and

     var paneMgr = MainWindow.getPaneMgr();
     // if successful, get the Content Library pane
     if ( paneMgr ) {
      var env = paneMgr.findPane( "DzEnvironmentPane" );
      // if successful, get the current container (folder or category)
      if ( env ) {
       // for ( item in env ) {
        env.backDropSelected( true );
       // }
      }
     }

    to set it on.

    Post edited by Richard Haseltine on
  • rbtwhizrbtwhiz Posts: 2,250
    edited November 2014

    The API for the Environment pane will change.

    The Render To Backdrop sample shows how to set the backdrop.

    -Rob

    Post edited by rbtwhiz on
  • DraagonStormDraagonStorm Posts: 748
    edited December 1969

    rbtwhiz said:
    The API for the Environment pane will change.

    The Render To Backdrop sample shows how to set the backdrop.

    -Rob

    I tried the Render to BackDrop, and that's when I discovered that when you clear the backdrop, that sets the Type to None. I you no longer see the backdrop. You have to physically go Windows->Panes-Environment and set the Type back to BackDrop...

    I want to be able to set the type to BackDrop with code, or at least check what the type is.

  • rbtwhizrbtwhiz Posts: 2,250
    edited November 2014

    // Get the backdrop for the scene
    var oBackdrop = Scene.getBackdrop();
    
    // Make the backdrop visible
    oBackdrop.visible = true;

    // Get the backdrop for the scene
    var oBackdrop = Scene.getBackdrop();
    // Get the image manager
    var oImageMgr = App.getImageMgr();
    
    // Get an image
    var sImage = String("%1/../Pictures/Sample Pictures/Desert.jpg").arg( App.getCommonUserDocumentPath() );
    var oImage = oImageMgr.getImage( sImage );
    
    // Set the backdrop image
    oBackdrop.setTexture( oImage );
    // Make the backdrop visible
    oBackdrop.visible = true;

    -Rob

    Post edited by rbtwhiz on
  • DraagonStormDraagonStorm Posts: 748
    edited December 1969

    Thank You! oBackdrop.visible = true; worked!

    rbtwhiz said:
    // Get the backdrop for the scene
    var oBackdrop = Scene.getBackdrop();
    
    // Make the backdrop visible
    oBackdrop.visible = true;

    // Get the backdrop for the scene
    var oBackdrop = Scene.getBackdrop();
    // Get the image manager
    var oImageMgr = App.getImageMgr();
    
    // Get an image
    var sImage = String("%1/../Pictures/Sample Pictures/Desert.jpg").arg( App.getCommonUserDocumentPath() );
    var oImage = oImageMgr.getImage( sImage );
    
    // Set the backdrop image
    oBackdrop.setTexture( oImage );
    // Make the backdrop visible
    oBackdrop.visible = true;

    -Rob

Sign In or Register to comment.