ARCore Sceneform SDK linking materials Error? - kotlin

I just have a simple table model has a 3 segments Top,Brick,Bottom. I applied Normal maps to the bottom part and it was successful but when i tried to apply normal map for the Brick and Top part it says, duplicate field name. I can figure it out what error it says. I was doing what says in this documentation. https://developers.google.com/sceneform/develop/sfa
{
animations: [
{
path: 'sampledata/models/sculpting-table/source/SculptingTable.fbx',
},
],
materials: [
{
name: 'TableTop',
parameters: [
{
baseColor: [
1,
1,
1,
1,
],
},
{
baseColorMap: 'SculptingTable_TableTop_AlbedoTransparency',
},
{
normalMap: null,
},
{
interpolatedColor: null,
},
{
metallic: 0,
},
{
metallicMap: null,
},
{
roughness: 1,
},
{
roughnessMap: null,
},
{
opacity: null,
},
],
source: 'build/sceneform_sdk/default_materials/fbx_material.sfm',
},
{
name: 'TableBottom',
parameters: [
{
baseColor: [
1,
1,
1,
1,
],
},
{
baseColorMap: 'SculptingTable_TableBottom_AlbedoTranspare',
},
{
normalMap: 'bumps',
},
{
interpolatedColor: null,
},
{
metallic: 0,
},
{
metallicMap: null,
},
{
roughness: 1,
},
{
roughnessMap: null,
},
{
opacity: null,
},
],
source: 'build/sceneform_sdk/default_materials/fbx_material.sfm',
},
{
name: 'TableBricks',
parameters: [
{
baseColor: [
1,
1,
1,
1,
],
},
{
baseColorMap: 'SculptingTable_TableBricks_AlbedoTranspare',
},
{
normalMap: null,
},
{
interpolatedColor: null,
},
{
metallic: 0,
},
{
metallicMap: null,
},
{
roughness: 1,
},
{
roughnessMap: null,
},
{
opacity: null,
},
],
source: 'build/sceneform_sdk/default_materials/fbx_material.sfm',
},
],
model: {
attributes: [
'Position',
'TexCoord',
'Orientation',
'BoneIndices',
'BoneWeights',
],
collision: {},
file: 'sampledata/models/sculpting-table/source/SculptingTable.fbx',
name: 'SculptingTable',
recenter: 'root',
},
samplers: [
{
file: '/Users/vishweshwaran/Downloads/sculpting-table/textures/SculptingTable_TableBricks_AlbedoTranspare.png',
name: 'SculptingTable_TableBricks_AlbedoTranspare',
pipeline_name: '/Users/vishweshwaran/Downloads/sculpting-table/textures/SculptingTable_TableBricks_AlbedoTranspare.png',
},
{
file: '/Users/vishweshwaran/Downloads/sculpting-table/textures/SculptingTable_TableBottom_AlbedoTranspare.png',
name: 'SculptingTable_TableBottom_AlbedoTranspare',
pipeline_name: '/Users/vishweshwaran/Downloads/sculpting-table/textures/SculptingTable_TableBottom_AlbedoTranspare.png',
},
{
file: '/Users/vishweshwaran/Downloads/sculpting-table/textures/SculptingTable_TableTop_AlbedoTransparency.png',
name: 'SculptingTable_TableTop_AlbedoTransparency',
pipeline_name: '/Users/vishweshwaran/Downloads/sculpting-table/textures/SculptingTable_TableTop_AlbedoTransparency.png',
},
{
file: '/Users/vishweshwaran/Downloads/sculpting-table/textures/SculptingTable_TableBottom_Normal.png',
name: 'bumps',
injections: [
{usage: "Normal",},
],
},
{
file: '/Users/vishweshwaran/Downloads/sculpting-table/textures/SculptingTable_TableBricks_Normal.png',
name: 'bumpsBrick',
injections: [
{usage: "Normal",},
],
},
],
version: '0.54:2',
}
About is the SFA file of the model.
Validating Materials: Validating material: Jsonnet Error: [1]: RUNTIME ERROR: duplicate field name: "Normal"
This is the log error that appears.

I got the answer we needed to add material_name attribute inside the injection block too. This will get rid of the duplication of "Normal" keyword.
{
file: '/Users/vishweshwaran/Downloads/sculpting-table/textures/SculptingTable_TableBottom_Normal.png',
name: 'bumps',
injections: [
{
material_name:"name_of_your_material",
usage: "Normal",},
],
},

Related

Indexing custom properties with Google Cloud Search API

We are having issues indexing metadata with items added to Google Cloud Search with 3rd-party datasources, using the REST API. We are following this guide: https://developers.google.com/cloud-search/docs/guides/schema-guide.
What we tried: uploaded the schema successfully ✅, indexed some items ✅, made them available in the search UI ✅, but it seems the properties and facets not showing up whether it’s in the green metadata bits in search results or in API results -- we get an empty structuredData object. Search results seem to only query the content.inlineContent and nothing else. We’re not getting any errors from the API when we make the index request (using https://developers.google.com/cloud-search/docs/reference/rest/v1/indexing.datasources.items/index_). It seems like it’s just ignoring everything in structuredData.
Other attempts: In addition to the REST API, we’ve also used the official nodejs SDK, (which has additional validation because it’s in TypeScript), to no avail. We’ve verified that auth params are correct (it returns 401 otherwise) and that there are no other validation issues (it returns 400 otherwise). Requests return 200 and do upload successfully, just not the structuredData. The original schema upload was also successful (200), and the response included the full schema we gave.
What are we missing?
schema JSON:
{
"objectDefinitions": [{
"name": "page",
"options": {
"displayOptions": {
"objectDisplayLabel": "Page",
"metalines": [
{
"properties": [
{
"propertyName": "title"
},
{
"propertyName": "content"
},
{
"propertyName": "author"
},
{
"propertyName": "siteSection"
}
]
}
]
}
},
"propertyDefinitions": [
{
"name": "title",
"isReturnable": true,
"isWildcardSearchable": true,
"isSuggestable": true,
"isRepeatable": false,
"isFacetable": false,
"textPropertyOptions": {
"operatorOptions": {
"operatorName": "title"
}
},
"displayOptions": {
"displayLabel": "Title"
}
},
{
"name": "content",
"isReturnable": true,
"isRepeatable": false,
"isFacetable": false,
"htmlPropertyOptions": {
"retrievalImportance": {
"importance": "DEFAULT"
}
},
"displayOptions": {
"displayLabel": "Content"
}
},
{
"name": "author",
"isReturnable": true,
"isRepeatable": true,
"isFacetable": true,
"textPropertyOptions": {
"operatorOptions": {
"operatorName": "author"
}
},
"displayOptions": {
"displayLabel": "Author(s)"
}
},
{
"name": "siteSection",
"isReturnable": true,
"isWildcardSearchable": false,
"isSuggestable": false,
"isRepeatable": false,
"isFacetable": true,
"textPropertyOptions": {
"operatorOptions": {
"operatorName": "sitesection"
}
},
"displayOptions": {
"displayLabel": "Site Section"
}
}
]
}]
}
indexing code:
const version = '4';
const apiUrl = `https://cloudsearch.googleapis.com/v1/indexing/datasources/${sourceId}/items/exampleItem:index`;
const title = "Example Item";
const url = "https://example.com";
fetch(apiUrl, {
method: "POST",
headers: {
"Content-Type": "application/json",
Authorization: "Bearer " + token,
},
body: JSON.stringify({
item: {
name: `datasource/${sourceId}/items/exampleItem`,
acl: {
readers: [
{
gsuitePrincipal: {
gsuiteDomain: true,
},
},
],
},
metadata: {
title: title,
sourceRepositoryUrl: url,
objectType: "page",
},
structuredData: {
object: {
properties: [
{
name: "title",
textValues: {
values: [title],
},
},
{
name: "author",
textValues: {
values: ["Unknown Author"],
},
},
{
name: "siteSection",
textValues: {
values: ["exampleSection"],
},
},
{
name: "content",
htmlValues: {
values: [exampleContentHTML],
},
},
],
},
},
content: {
inlineContent: b64(exampleContentHTML),
contentFormat: "TEXT",
},
version: b64(version),
itemType: "CONTENT_ITEM",
},
mode: "SYNCHRONOUS",
}),
})
indexing result:
{
"name": "datasources/DATASOURCE_ID/items/exampleItem",
"acl": {
"readers": [{
"gsuitePrincipal": {
"gsuiteDomain": true
}
}]
},
"metadata": {
"title": "Example Item",
"sourceRepositoryUrl": "https://example.com",
"objectType": "page"
},
"structuredData": {
"object": {}
},
"content": {
"inlineContent": "... base 64 encoded content...",
"contentFormat": "TEXT"
},
"version": "NQ==",
"status": {
"code": "ACCEPTED"
},
"queue": "default",
"itemType": "CONTENT_ITEM"
}

How to display list of data in a column in iview table

In iview table, my colums:
export default {
data () {
return {
columns5: [
{
title: 'CNAME',
key: 'name',
sortable: true
},
{
title: 'nodes',
key: 'nodes',
},
{
title: 'domains',
key: 'domains',
},
{
title: 'desc',
key: 'desc'
},
{
title: 'duetime',
key: 'duetime',
sortable: true
},
{
title: 'ctime',
key: 'ctime',
sortable: true
},
{
title: 'uptime',
key: 'uptime',
sortable: true
},
],
the data:
anames:[
{
"id": 1,
"nodes": [
{
"id": 1,
"main_ip": "10.10.10.10",
"ips": "10.10.10.10\r\n10.10.10.11",
"req_secret": null,
"ctime": "2021-05-17T09:41:53.159131+08:00",
"uptime": "2021-05-17T10:31:47.886033+08:00",
"cname": 1
}
],
"domains": [
{
"id": 1,
"domain_name": "baidu.com",
"ctime": "2021-05-17T16:19:18.097807+08:00",
"uptime": "2021-05-17T16:19:18.097955+08:00",
"cname": 1
}
],
"name": "masdcom",
"desc": "",
"desc_en": null,
"is_active": true,
"duetime": "2021-06-17T19:40:00+08:00",
"ctime": "2021-05-17T09:13:57.019125+08:00",
"uptime": "2021-05-17T19:42:23.025122+08:00",
"user": 2
}
]
You see my nodes and domains,in data anames they are list, not just key-value, how can I display domain's domain_name and node's main_ip?
In there can not use domains.domain_name and nodes.main_ip.
I want nodes display all node's main_ip and domains display all domain's domain_name. what should I do in columns?
domains and nodes is array, you forgot about indexes
domains[0].domain_name and nodes[0].main_ip

Weird behavior in vue/vuetify attribute binding with template literals

I tried to feet the v-treeview component in vuetify with an object, wrapped in an array, as an template literal.
<template lang="pug">
v-container.media-lib-container
v-treeview(:items="[media]" dense)
v-btn(#click="test") test
</template>
The page is loading normal but when I try to open the tree view, I get an type error in vuetify.js.
TypeError: Cannot set property 'vnode' of undefined
at VueComponent.register (vuetify.js?ce5b:30786)
Weirdly when I compute the data, and return it as an template literal it works fine.
computed: {
mediaArr() {
return [this.media];
},
},
Does anyone know if this is a bug or if I miss something? and if this is caused by vue or by vuetify?
I think I know at least where my problem hides.
I get my object from npm directory-tree module and than add an id property to every child for the v-treeview. Also it stopped working again(maybe never has).
The original json:
{
"path": "../uploads",
"name": "uploads",
"children": [
{ "path": "../uploads/parsed", "name": "parsed", "children": [], "size": 0, "type": "directory" },
{
"path": "../uploads/test",
"name": "test",
"children": [
{ "path": "../uploads/test/test2", "name": "test2", "children": [], "size": 0, "type": "directory" }
],
"size": 0,
"type": "directory"
},
{
"path": "../uploads/uploads",
"name": "uploads",
"children": [
{
"path": "../uploads/uploads/public",
"name": "public",
"children": [
{
"path": "../uploads/uploads/public/projectA",
"name": "projectA",
"children": [],
"size": 0,
"type": "directory"
},
{
"path": "../uploads/uploads/public/projectB",
"name": "projectB",
"children": [],
"size": 0,
"type": "directory"
}
],
"size": 0,
"type": "directory"
}
],
"size": 0,
"type": "directory"
}
],
"size": 0,
"type": "directory"
}
The parsed object with the added id:
path: "../uploads",
name: "uploads",
children: [
{
path: "../uploads/parsed",
name: "parsed",
children: [],
size: 0,
type: "directory",
id: 1,
},
{
path: "../uploads/test",
name: "test",
children: [
{
path: "../uploads/test/test2",
name: "test2",
children: [],
size: 0,
type: "directory",
id: 3,
},
],
size: 0,
type: "directory",
id: 2,
},
{
path: "../uploads/uploads",
name: "uploads",
children: [
{
path: "../uploads/uploads/public",
name: "public",
children: [
{
path: "../uploads/uploads/public/projectA",
name: "projectA",
children: [],
size: 0,
type: "directory",
id: 6,
},
{
path: "../uploads/uploads/public/projectB",
name: "projectB",
children: [],
size: 0,
type: "directory",
id: 7,
},
],
size: 0,
type: "directory",
id: 5,
},
],
size: 0,
type: "directory",
id: 4,
},
],
size: 0,
type: "directory",
id: 0,
},
The code in mounted to add id:
mounted() {
let id = 0;
function recur(obj) {
obj.id = id;
++id;
obj.children.map((child) => recur(child));
}
recur(this.media);
},
The thing I don't understand is, that when I console.log(JSON.stringify(this.media) and put it directly in vue data it works. Both as a template literal in the attribute binding and as computed.

Ramda - how to merge 2 or more arrays of objects

I am trying to merge arrays of objects into one clean array using Ramda but I need some help. I have sample JSON which is below. In this example, I have 2 groups but the number of groups can be 3, 4, 10. I am interested in tableItems array from each group.
const groups = [
{
id: '',
name: '',
tableItems: [
{
id: 1,
name: 'John'
},
{
id: 2,
name: 'Paul'
},
{
id: 3,
name: 'Mary'
}
]
},
{
id: '',
name: '',
tableItems: [
{
id: 10,
name: 'Brian'
},
{
id: 20,
name: 'Joseph'
},
{
id: 30,
name: 'Luke'
}
]
}
];
I tried something like this:
let mapValues = x => x.tableItems;
const testItems = R.pipe(
R.map(mapValues)
)
And then I got arrays of my tableItems and now I would like to merge them into one array.
[
[
{
"id": 1,
"name": "John"
},
{
"id": 2,
"name": "Paul"
},
{
"id": 3,
"name": "Mary"
}
],
[
{
"id": 10,
"name": "Brian"
},
{
"id": 20,
"name": "Joseph"
},
{
"id": 30,
"name": "Luke"
}
]
]
Any help would be appreciated.
Use R.chain to map and flatten, and get the tableItems using R.prop:
const fn = R.chain(R.prop('tableItems'));
const groups = [{"id":"","name":"","tableItems":[{"id":1,"name":"John"},{"id":2,"name":"Paul"},{"id":3,"name":"Mary"}]},{"id":"","name":"","tableItems":[{"id":10,"name":"Brian"},{"id":20,"name":"Joseph"},{"id":30,"name":"Luke"}]}];
const result = fn(groups);
console.log(result);
<script src="https://cdnjs.cloudflare.com/ajax/libs/ramda/0.27.0/ramda.js"></script>

Complex array at QML

I got in trouble with very simple code:
property var pagesAllModels: {
ru: [
{ title: qsTr("New"), url: "http://bash.im" },
{ title: qsTr("Random"), url: "http://bash.im/random" },
{ title: qsTr("Best"), url: "http://bash.im/best" },
{ title: qsTr("By rating"), url: "http://bash.im/byrating" },
{ title: qsTr("Abyss"), url: "http://bash.im/abyss" },
{ title: qsTr("Abyss top"), url: "http://bash.im/abysstop" },
{ title: qsTr("Abyss best"), url: "http://bash.im/abyssbest" },
],
eng: [
{ title: "Latest", url: "http://bash.org/?latest" },
{ title: "Browse", url: "http://bash.org/?browse" },
{ title: "Random", url: "http://bash.org/?random" },
{ title: "Top", url: "http://bash.org/?top" }
]
}
That code in QML gives me error at line "eng: [" with error "expected lexem ," but in pure javascript everything work fine. What's wrong?
That's because your code is illegal JSON array definition. Web browsers are accepting it because they aren't strict about JS syntax, but QML engine is really strict :
In a key:value pair in associative array, the key must be a string, so it must have quotes around it, else it would be confused with a (non-existing) variable name.
property var pagesAllModels: {
"ru": [
{ "title": qsTr("New"), "url": "http://bash.im" },
{ "title": qsTr("Random"), "url": "http://bash.im/random" },
{ "title": qsTr("Best"), "url": "http://bash.im/best" },
{ "title": qsTr("By rating"), "url": "http://bash.im/byrating" },
{ "title": qsTr("Abyss"), "url": "http://bash.im/abyss" },
{ "title": qsTr("Abyss top"), "url": "http://bash.im/abysstop" },
{ "title": qsTr("Abyss best"), "url": "http://bash.im/abyssbest" }
],
"eng": [
{ "title": "Latest", "url": "http://bash.org/?latest" },
{ "title": "Browse", "url": "http://bash.org/?browse" },
{ "title": "Random", "url": "http://bash.org/?random" },
{ "title": "Top", "url": "http://bash.org/?top" }
]
}
And it works !
Try this
property var pagesAllModels: {
ru: [
{ title: qsTr("New"), url: "http://bash.im" },
{ title: qsTr("Random"), url: "http://bash.im/random" },
{ title: qsTr("Best"), url: "http://bash.im/best" },
{ title: qsTr("By rating"), url: "http://bash.im/byrating" },
{ title: qsTr("Abyss"), url: "http://bash.im/abyss" },
{ title: qsTr("Abyss top"), url: "http://bash.im/abysstop" },
{ title: qsTr("Abyss best"), url: "http://bash.im/abyssbest" }
],
eng: [
{ title: "Latest", url: "http://bash.org/?latest" },
{ title: "Browse", url: "http://bash.org/?browse" },
{ title: "Random", url: "http://bash.org/?random" },
{ title: "Top", url: "http://bash.org/?top" }
]
}
Hope this will resolve your issue
associative arrays separates by semicolon ";"
Try this
property var pagesAllModels: {
ru: [
{ title: qsTr("New"), url: "http://bash.im" },
{ title: qsTr("Random"), url: "http://bash.im/random" },
{ title: qsTr("Best"), url: "http://bash.im/best" },
{ title: qsTr("By rating"), url: "http://bash.im/byrating" },
{ title: qsTr("Abyss"), url: "http://bash.im/abyss" },
{ title: qsTr("Abyss top"), url: "http://bash.im/abysstop" },
{ title: qsTr("Abyss best"), url: "http://bash.im/abyssbest" },
];
eng: [
{ title: "Latest", url: "http://bash.org/?latest" },
{ title: "Browse", url: "http://bash.org/?browse" },
{ title: "Random", url: "http://bash.org/?random" },
{ title: "Top", url: "http://bash.org/?top" }
]
}