Adding objects to Layers

Hey,

Having some trouble getting objects to appear in Rhino / GH after uploading them from Blender… The object data is identical, so it seems to be something to do with assigning objects to layers, because I’m not doing that yet from Blender - and so the Receiver component in GH doesn’t spit anything out.

I can’t access the layer data online (‘Cannot GET /api/v1/streams/B1CYZsKpf/layers’) and the API quoth me 404.

Has layer access changed? How can I get the GH Receiver to ‘see’ all the objects in the stream?

Yo tommers! Yep, that’s a 1.0.0 api change - no more of that :poop:. You have much more flexible control via query fields, ie: https://hestia.speckle.works/api/v1/streams/B1CYZsKpf?fields=layers link. I’m using your stream id btw.

What should happen if there are no defined layers on a stream, to stop grasshopper/rhino from crapping out, you get a default “Speckle Generic Layer” that contains all stream objects, ie:

 "layers": [
      {
        "name": "Default Generated Speckle Layer",
        "guid": "7aee6289-5f7d-4ad8-a75c-b26700fbd958",
        "orderIndex": 0,
        "startIndex": 0,
        "objectCount": CountOfAllTheObjectInDaStream,
,
// ...

So if you’re having errors, it might be you’re using an old version of the server or the plugins? Otherwise, can you please send a me streamId with no layers? The one above has one…

Hey Dimitrie, I was referencing the SpeckleApiClient in the SpeckleCore repo, and I’m pretty sure it’s more-or-less up-to-date, but I will take a look, perhaps it didn’t update all dependencies or something.

EDIT: Also, the GH Receiver uses the old URL when viewing layers, which is how I got that link in the first place.

With the generic layer, then, is it possible to get that from a GH Receiver?

How do you add objects to a layer? How you refer to a layer? By name or by GUID?

There are no apparent errors, just objects not showing up in GH. I can upload objects fine, and stream them back to Blender, but I think the GH Receiver is a bit more picky…

That’s a bug or outdated component. It should be taken out, wherever it is.

The generic layer comes along if you have no layers in the stream. What happened is that you’ve updated that stream from two places, blender and gh i guess. Gh basically made a layer for the objects it sent through it. The magic generic layer appears only if there are no layers present, but i’m willing to consider this as a feature request for the server, where you would say if object count > what’s specified in the layers, make a generic layer to get those extra objects out.

That might fuck things up and increase messiness generally though :thinking:

Solution for you is to not update the same stream from two different places, but create a new one and send whatever data you need through it…

That’s what I was hoping to avoid :stuck_out_tongue:
I basically want to get object editing working from both sides.

With regard to layers, it could also be an option to see what layers exist on the stream already and put the object in one of them. But the question still is how is an object linked to a layer? It doesn’t seem to be an object property, and the layers don’t have a ‘objects’ list with IDs…

Regardless of the previous, it would be good to be able to create layers from Blender. The new Blender 2.8 has some great stuff in the works for object collections instead of layers, which could be super handy for Speckle.

Well if you look at a layer, you’ll notice this startIndex and objectCount properties :wink:

A layer’s startIndex and objectCount determine, against the stream’s object list, which object is on what layer. This is mostly outdated, but the part about how layers work still stands.

I would recommend against simultaneous object editing as you’re opening up a huge can of worms re conflict resolution, timings, lag and user expectations, etc., but i’m curious what you’ll come up with so go for it!

There’s nothing stopping you from doing it, but the ideal way would be that sender clients are unique per stream (one source of truth), and modified/edited data can be looped but through a new stream.

What if edits from clients other than original client created a child stream? Could get messy, but would avoid conflicts?

Well if you look at a layer, you’ll notice this startIndex and objectCount properties

A layer’s startIndex and objectCount determine, against the stream’s object list, which object is on what layer. This is mostly outdated, but the part about how layers work still stands.`

Yes, this is good to know, because it works differently than other things, such as streams + Placeholders. This means that the object list needs to be ordered by layer before being uploaded, and prevents objects from being on multiple layers. :+1:

Just to follow up on this, incrementing the layer object count when adding an object to a stream seems to work OK. :ok_hand:

Way it works now, is that when an object is uploaded to a stream from Blender, it adds it to the last layer / increments the last layer it finds. I know updating a stream from two different places might be anti-Speckle, but perhaps we could chat about the strategic stuff sometime… I find it very helpful to update the same object from two different places, or aggregate stream objects from multiple sources.


The cube is made in Rhino, exploded and smoothed in Blender, added back to the same stream, and both are received in Rhino / GH.