[英]Is it possible to access/downlad glb or gltf models from Decentraland?
I have created a dummy scene using dcl init
& dcl start
and imported a few models from one of their github repositories .我使用dcl init
& dcl start
创建了一个虚拟场景,并从他们的一个github 存储库中导入了一些模型。
I created a small script which creates a scene, imports those models into the scene and console logs the list of models I imported into the scene:我创建了一个创建场景的小脚本,将这些模型导入场景,控制台记录我导入场景的模型列表:
...
const trashCan = addToScene("trashCan", "models/Trash_Can.glb", new Transform({
position: new Vector3(0.2, 0.2, 0.2),
rotation: new Quaternion(0, 0, 0, 1),
scale: new Vector3(1, 1, 1)
}));
trashCan.addComponent(
new OnPointerDown((): void => {
console.log("Downloadable entities:");
// console.log(engine.entities);
for (let k in engine.entities) {
// console.log(engine.entities[k])
// console.log(engine.entities[k].components)
const shape = engine.entities[k].components["engine.shape"]
const transform = engine.entities[k].components["engine.transform"]
if (shape) {
// console.log(engine.entities[k].components["engine.shape"].data)
console.log(" name: " + shape.src)
}
if (transform) {
console.log(" position: " + transform.position)
}
}
})
)
...
The script gives me access to some model metadata ie modes' path in the project and their transform matrices in the scene:该脚本使我可以访问一些模型元数据,即项目中的模式路径及其在场景中的变换矩阵:
I was wondering whether it is possible to access/download the 3D models.我想知道是否可以访问/下载 3D 模型。
Could it be possible to have access to those 3D models, maybe GET
them?是否有可能访问那些 3D 模型,也许GET
它们? Does anybody know if Decentraland prohibits such practices?有人知道 Decentraland 是否禁止这种做法吗? AFAIK they're using the Unity engine. AFAIK 他们正在使用 Unity 引擎。
Just doing a GET
on one of the models in the scene doesn't seem to be successful:只是在场景中的一个模型上做一个GET
似乎并不成功:
Could this be possible to achieve?这有可能实现吗?
After the answer from @cachius, following his suggestion, I was able to find the following:在@cachius 的回答之后,按照他的建议,我能够找到以下内容:
unity.data
( #1 ) file is a UnityWebData1.0
file which can be decompressed using UnityPack as described here : unity.data
( #1 ) 文件是一个UnityWebData1.0
文件,可以使用UnityPack解压缩,如下所述:
from unitypack.utils import BinaryReader
SIGNATURE = 'UnityWebData1.0'
class DataFile:
def load(self, file):
buf = BinaryReader(file, endian="<")
self.path = file.name
self.signature = buf.read_string()
header_length = buf.read_int()
if self.signature != SIGNATURE:
raise NotImplementedError('Invalid signature {}'.format(repr(self.signature)))
self.blobs = []
while buf.tell() < header_length:
offset = buf.read_int()
size = buf.read_int()
namez = buf.read_int()
name = buf.read_string(namez)
self.blobs.append({ 'name': name, 'offset': offset, 'size': size })
if buf.tell() > header_length:
raise NotImplementedError('Read past header length, invalid header')
for blob in self.blobs:
buf.seek(blob['offset'])
blob['data'] = buf.read(blob['size'])
if len(blob['data']) < blob['size']:
raise NotImplementedError('Invalid size or offset, reading past file')
import os
f = open('unity.data', 'rb')
df = DataFile()
df.load(f)
EXTRACTION_DIR = 'extracted'
for blob in df.blobs:
print('extracting @ {}:\t{} ({})'.format(blob['offset'], blob['name'], blob['size']))
dest = os.path.join(EXTRACTION_DIR, blob['name'])
os.makedirs(os.path.dirname(dest), exist_ok=True)
with open(dest, 'wb') as f:
f.write(blob['data'])
The extracted data folder contains one or more .unity3d files which can be further unpacked using AssetStudio , however the tool looked a bit buggy/unstable to me, not sure how reliable it is.提取的数据文件夹包含一个或多个 .unity3d 文件,可以使用AssetStudio进一步解压缩,但是该工具对我来说看起来有点错误/不稳定,不确定它有多可靠。
From what I've discovered this contains much of the scene helper entities, but not the models.根据我的发现,它包含很多场景辅助实体,但不包含模型。 The models are downloaded separately in gltf
format( #2 ).模型以gltf
格式( #2 )单独下载。 One can just download the file and import it using Blender.只需下载文件并使用 Blender 导入即可。
So it seems that the gltf models are located in http://127.0.0.1:8001/content/contents/
and the files are renamed.因此,gltf 模型似乎位于http://127.0.0.1:8001/content/contents/
并且文件已重命名。 I was unable to retrieve the metadata regarding the exact contents of http://127.0.0.1:8001/content/contents
yet, so I'll keep digging.我还无法检索有关http://127.0.0.1:8001/content/contents
确切内容的元数据,所以我会继续挖掘。
Have a look if the models appear as requests in the Network tab.查看模型是否在“网络”选项卡中显示为请求。 If so you can right click and 'Copy as curl' to download them in the command line by adding > model.glb
.如果是这样,您可以右键单击并“复制为 curl”,通过添加> model.glb
在命令行中下载它们。 This way you apply the same headers and parameters as the client.这样您就可以应用与客户端相同的标头和参数。
There seems to be an important distinction between content provided by them vs content provided by users .他们提供的内容与用户提供的内容之间似乎存在重要区别。 Relevant sections from their Terms , legalese edited for clarity:条款中的相关部分,为清楚起见编辑了法律术语:
The Decentraland Foundation holds the rights over the DCL Client, the Desktop Client, the SDK 5.0, the Marketplace, the Builder, the Command Line Interface, DAO, and the Developers' Hub which are referred to herein as the "Tools". Decentraland 基金会拥有对 DCL 客户端、桌面客户端、SDK 5.0、市场、构建器、命令行界面、DAO 和开发者中心(本文称为“工具”)的权利。
12.1 All rights of the Tools are owned by the Foundation. 12.1 工具的一切权利归基金会所有。 Except as authorized in Section 13, you agree not to copy, modify, distribute, perform, display or create derivations based on the Tools.除非第 13 条授权,否则您同意不复制、修改、分发、执行、显示或创建基于工具的衍生产品。 The visual interfaces, graphics including all art and drawings associated with and the the code and data of the Tools, excluding the Content submitted by Users , are owned by the Foundation.视觉界面、图形包括所有相关的艺术和绘图以及工具的代码和数据,不包括用户提交的内容,均归基金会所有。 ... You agree that any "purchase" of LAND does not give you rights to the art and drawings associated with the Tools and content therein other than those expressly contained in these Terms. ...您同意,除非这些条款中明确包含,否则您对 LAND 的任何“购买”并不授予您对与工具及其内容相关的艺术和图纸的权利。 And that you do not have the right to reproduce the Foundation Materials without the Foundation's written consent.并且未经基金会书面同意,您无权复制基金会资料。
Each Contributor grants to you a copyright license to reproduce, prepare Derivative Works of, publicly display, publicly perform, sublicense, and distribute the Work and such Derivative Works in Source or Object form.每个贡献者都授予您版权许可,以复制、准备衍生作品、公开展示、公开表演、再许可和分发源或对象形式的作品和此类衍生作品。
You may reproduce and distribute copies or derivations in any medium, with or without modifications, and in Source or Object form, provided that you meet the following conditions:只要您满足以下条件,您就可以在任何媒体中复制和分发副本或衍生品,无论是否经过修改,并以源或对象形式存在:
You should reach out to them or their community directly on Discord Twitter Reddit Telegram or GitHub and add results here.您应该直接在Discord Twitter Reddit Telegram或GitHub 上与他们或他们的社区联系,并在此处添加结果。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.