зеркало из https://github.com/mozilla/Spoke.git
Merge pull request #1177 from mozilla/fix-noderefs
Add support for __mhc_link_type node refferences in components
This commit is contained in:
Коммит
c09744b854
|
@ -14,7 +14,7 @@ HUBS_SERVER="dev.reticulum.io"
|
|||
RETICULUM_SERVER="dev.reticulum.io"
|
||||
THUMBNAIL_SERVER="nearspark-dev.reticulum.io"
|
||||
NON_CORS_PROXY_DOMAINS="hubs.local,localhost"
|
||||
CORS_PROXY_SERVER="cors-proxy-dev.reticulum.io"
|
||||
CORS_PROXY_SERVER="hubs-proxy.com"
|
||||
GITHUB_ORG="mozilla"
|
||||
GITHUB_REPO="spoke"
|
||||
GITHUB_PUBLIC_TOKEN="de8cbfb4cc0281c7b731c891df431016c29b0ace"
|
||||
|
|
|
@ -2,6 +2,6 @@ HUBS_SERVER="dev.reticulum.io"
|
|||
RETICULUM_SERVER="dev.reticulum.io"
|
||||
FARSPARK_SERVER="farspark-dev.reticulum.io"
|
||||
NON_CORS_PROXY_DOMAINS="hubs.local,localhost"
|
||||
CORS_PROXY_SERVER="cors-proxy-dev.reticulum.io"
|
||||
CORS_PROXY_SERVER="hubs-proxy.com"
|
||||
HOST_PORT="9090"
|
||||
IS_MOZ="false"
|
||||
|
|
|
@ -473,7 +473,10 @@ export default class Editor extends EventEmitter {
|
|||
typeof property === "object" &&
|
||||
Object.prototype.hasOwnProperty.call(property, "__gltfIndexForUUID")
|
||||
) {
|
||||
component[propertyName] = uuidToIndexMap[property.__gltfIndexForUUID];
|
||||
component[propertyName] = {
|
||||
__mhc_link_type: "node",
|
||||
index: uuidToIndexMap[property.__gltfIndexForUUID]
|
||||
};
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1995,7 +1995,20 @@ class GLTFLoader {
|
|||
const components = getComponents(object);
|
||||
for (const [componentName, componentProps] of Object.entries(components)) {
|
||||
for (const [propName, propValue] of Object.entries(componentProps)) {
|
||||
if (
|
||||
const type = propValue && propValue.__mhc_link_type;
|
||||
if (type && propValue.index !== undefined) {
|
||||
// TODO support other types
|
||||
if (type === "node") {
|
||||
this.getDependency(type, propValue.index).then(node => {
|
||||
node.userData.MOZ_spoke_uuid = node.uuid;
|
||||
componentProps[propName] = { __gltfIndexForUUID: node.uuid };
|
||||
});
|
||||
} else {
|
||||
console.warn(
|
||||
`Spoke currently only supports "node" component references. This component ${componentName} is using a ${type} ref for ${propName}`
|
||||
);
|
||||
}
|
||||
} else if (
|
||||
HUBS_NODEREF_COMPONENTS[componentName] &&
|
||||
HUBS_NODEREF_COMPONENTS[componentName].indexOf(propName) !== -1
|
||||
) {
|
||||
|
|
Загрузка…
Ссылка в новой задаче