Jump to content

The sample code in the Simple tutorial need updating.


Recommended Posts

The compile message made it easy enough to figure this out, but just to make it easier on the next person:

 

Tutorial Part I - Simple has this example after you remove the default script code and modify it.

 

Line 4:

Rectangle selection = EnvironmentParameters.GetSelection(src.Bounds).GetBoundsInt();

 

When you build you get a warning this is obsolete and no longer needed, use GetSelectionAsPdnRegion

So it should be changed to this I think:

Rectangle selection = EnvironmentParameters.GetSelectionAsPdnRegion().GetBoundsInt();

 

In case the next person reading is new to C# / programming it might confuse them.

 

Edited by DataJuggler
Link to post
Share on other sites
30 minutes ago, toe_head2001 said:

 

If you just want the bounding Rectangle, and don't need the PdnRegion:

This is why as soon as I go back to work I may donate and request the old docs be updated. Even thought its a pain, otherwise new people learn it wrong, and if they don't come find someone to inform them, it stays wrong.

 

Thank you, 

30 minutes ago, toe_head2001 said:

Rectangle selection = EnvironmentParameters.SelectionBounds;

 

Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...