`SpeckleReciever` and intents moving forward

Hi guys,

This is a followup from an earlier post. Having been directed to SpeckleReciever, I am a bit confused. I hope you can help!

I tried to mimic the flow of the original obsolete example, however I’ve been having some issues:

  • I am unable to set the client/stream/branch/commit of the receiver.
  • if one is to try the have the same experience of selecting different streams/branches/etc then they would have to set it one by one as it gets and lists into the UI. Currently I am unable to see a way to do that with SpeckleReciever (as they are all private set)
  • Is this the intent? Are we not going with this flow? Are we supposed to use SpeckleReciever in some way I do not grasp yet? Or perhaps we are supposed to look at SpeckleReceiver as an example implementation?

Basically I’m asking this because perhaps I am not understanding something fundamental. Thanks for your help!

The properties you are referring to; Account, Stream, Branch, Commit are not settable because they are they are actually of type AccountSelection, StreamSelection, BranchSelection, CommitSelection etc…

These types have both a list Options list, and a Selected property which can be get & set.

E.g.

  var receiver = GetComponent<SpeckleReceiver>();


  //GETTING THE SELECTION DATA
  IReadOnlyList<Account> allAccounts = receiver.Account.Options; //Get all the accounts loaded
  Account? selectedAccount = receiver.Account.Selected; //Get the current selected Account
 
  IReadOnlyList<Stream> allStreams = receiver.Stream.Options; //Get all the streams available to selected Account
  Stream? selectedStream = receiver.Stream.Selected; //Get the current selected stream
  
  IReadOnlyList<Branch> allBranches = receiver.Branch.Options;
  Branch? selectedBranch = receiver.Branch.Selected;

  IReadOnlyList<Commit> allCommits = receiver.Commit.Options;
  Commit? selectedCommit = receiver.Commit.Selected;

  //SETTING THE SELECTION
  receiver.Stream.Selected = allStreams[0]; //e.g. Select a specific stream by index
  receiver.Stream.Selected = selectedStream; //e.g. Set it back to the original selected stream....

  receiver.Account.Selected = AccountManager.GetDefaultAccount();
  // REFRESHING OPTIONS
  receiver.Stream.RefreshOptions(); //Will fetch the latest streams, branches, and commits for the selected account.


As a bit of a more general overview.
We are expecting users to create their own runtime UI to display a view of the Options list, and respond to user selection via setting the Selected property.

Since AccountSelection, StreamSelection, BranchSelection, CommitSelection all inherit from a generic OptionSelection, it makes it possible to share the same UI for all types of selection.

And since these components handle all of the fetching of options + refreshing + selection, we hope you don’t need to write any of this from scratch yourself…


You can see an example of the kind of UI we’re thinking about https://youtu.be/Y-RGPZJIHf4?feature=shared&t=31

And here its implemented using an loose MVC structure


If you’d prefer not to use these selection components, there is also a static ReceiveAsync function where you can pass in selection manually.

1 Like