Making a Commit with GraphQL: Commit does not have any children. All meshes in one object

Hi, we have done a meshes commit mechanism in UE5 using the Speckle API. However, there are some things missing.

For some reason our partial objects in a commit do not get an id. I guess it is because we submit everything with ObjectCreate using a wrong json format.

Step 1: Submit meshes (objects)

BaseObject->SetStringField("applicationId", "null");
BaseObject->SetStringField("speckle_type", "Base");
BaseObject->SetArrayField("objects", JSONMeshes);
const TSharedPtr<FJsonObject> JSONVariables = MakeShared<FJsonObject>();
JSONVariables->SetStringField("streamId", StreamId);
JSONVariables->SetObjectField("objects", BaseObject);

const FString GraphQL = R"(
		mutation prismarchCreateObject($streamId: String!, $objects: JSONObject!) {
			objectCreate(objectInput: {
				streamId: $streamId
				objects: [$objects]
			})
		}
	)";

Step 2: Create commit

	const FString GraphQL = R"(
		mutation speckleCreateCommit($stream: String!, $object: String!, $branch: String!, $message: String) {
  			commitCreate(commit: {
				streamId: $stream
				objectId: $object
				branchName: $branch
				message: $message
			})
		}
	)";

Which is the appropriate format for Objects JSON ? There is not enough information in documentation:

This is our commit using our own format. Although Speckle Web viewer visualizes it well, it does not have any children. It is difficult for us to generate ids and closure ids:

Should we make ourselves ids for each object and submit it with the objects as an extra json string field?

How do you estimate the “closure” values ? In what way they are useful ?

By deciphering speckle commit format through Rhino, I see that information is separated into

Children: Chunks of Data
vs
Data: Closure, Layer names with reference id

This is our format

The signature is something I am working on. One of the differences are that the objects are single Json objects whereas in your format are Arrays that include one object and the “speckle_type: reference”.

When I am also expanding your json format I see that are cross-references for the faces. Why faces are not stored inside the mesh and they are referenced to another object ?

1 Like