星E君
模型的json文件中,textures下面的 "0": "#xxx" 是什么?

#xxx 是父类文件的话他的具体位置应该在哪里?或者我应该往什么方向进行寻找?


⊙v⊙
一般有#,意为其他地方定义了路径。
写#的一般有几个地方。
textures,和elements的texture。

后者等同前者指向的路径,前者的路径没#的话从assets/minecraft开始。
前者的路径有#的话,看其parent下定义的textures路径,parent的路径从assets/minecraft/models开始

⊙v⊙
*后者等同前者指向的路径,前者的路径没#的话从assets/minecraft/textures开始...除非这个json给其他json做parent,一般里面已经写有parent的json,其textures后面写的直接就是贴图的物理路径(不带#),当然也有特殊情况...


例子(解释用,我小小改了下)
grass_normal.json(头顶绿的草方块)
  1. {
  2.     "parent": "block/grass",
  3.     "textures": {
  4.         "particle": "blocks/dirt",
  5.         "bottom": "blocks/dirt",
  6.         "top": "blocks/grass_top",
  7.         "side": "blocks/grass_side",
  8.         "overlay": "blocks/grass_side_overlay"
  9.     }
  10. }
复制代码
定义了各贴图的物理路径指向,
parent为assets/minecraft/models/block/grass.json,
贴图都能在assets/minecraft/textures下找到。



grass.json(草方块的基本模型,为grass_normal.json[和其他状态草方块]的parent)
  1. {   "elements": [
  2.         {   "from": [ 0, 0, 0 ],
  3.             "to": [ 16, 16, 16 ],
  4.             "faces": {
  5.                 "down":  { "uv": [ 0, 0, 16, 16 ], "texture": "#bottom", "cullface": "down" },
  6.                 "up":    { "uv": [ 0, 0, 16, 16 ], "texture": "#top",    "cullface": "up", "tintindex": 0 },
  7.                 "north": { "uv": [ 0, 0, 16, 16 ], "texture": "#side",   "cullface": "north" },
  8.                 "south": { "uv": [ 0, 0, 16, 16 ], "texture": "#side",   "cullface": "south" },
  9.                 "west":  { "uv": [ 0, 0, 16, 16 ], "texture": "#side",   "cullface": "west" },
  10.                 "east":  { "uv": [ 0, 0, 16, 16 ], "texture": "#side",   "cullface": "east" }
  11.             }
  12.         },
  13.         {   "from": [ 0, 0, 0 ],
  14.             "to": [ 16, 16, 16 ],
  15.             "faces": {
  16.                 "north": { "uv": [ 0, 0, 16, 16 ], "texture": "#overlay", "tintindex": 0, "cullface": "north" },
  17.                 "south": { "uv": [ 0, 0, 16, 16 ], "texture": "#overlay", "tintindex": 0, "cullface": "south" },
  18.                 "west":  { "uv": [ 0, 0, 16, 16 ], "texture": "#overlay", "tintindex": 0, "cullface": "west" },
  19.                 "east":  { "uv": [ 0, 0, 16, 16 ], "texture": "#overlay", "tintindex": 0, "cullface": "east" }
  20.             }
  21.         }
  22.     ]
  23. }
复制代码
可见贴图路径为#,本身没定义路径的textures。
父类(grass.json)提供形状,各面贴图写#用于引用。
子类(grass_normal.json)填补parent贴图的#位置。


pineapple_
⊙v⊙ 发表于 2018-2-28 05:25
*后者等同前者指向的路径,前者的路径没#的话从assets/minecraft/textures开始...除非这个json给其他json做 ...

简单的说就是…
"textures":{"xxx":"block/abc"}
"texture": "#xxx"引用的就是block\abc.png吧
(虽然说我没看出来"0"是什么)

爱心魔王FHC
textures是材质
比如我规定"a"是"blocks/stone"这个路径下的贴图
然后我下面某个面需要用石头的材质,就写"#a",就表示用"a":"blocks/stone"这个路径下的贴图

⊙v⊙
emmm....好像主要的忘说了。你的问题

textures下面的 "0": "#xxx" 是什么?
0是在element下面标材质时作引用,你也不想在element下每一次texture后面都写一遍完整的物理路径的对吧...
而在texture后面引用时,加上#,也就是#0
这个0只要和#后面的一致就好,写什么(英文数字...)无所谓
模型制作软件出来的json一般就是0,1,2...这样标的

"textures":{"0":"#xxx"}  ←大概这样对吗...
一般应该不会这么写吧...,这么写的意思是
此json模型下的element里填写#0的材质时,此面就使用#xxx的材质。
而#xxx又指向另一个路径,此json下未标明的话可能在先前的parent里标上了。

虽然不知道可不可以指向里加指向,不过转来转去是挺没意义的,尽量不要这么写

星E君
⊙v⊙ 发表于 2018-2-28 00:10
emmm....好像主要的忘说了。你的问题

textures下面的 "0": "#xxx" 是什么?

昨晚我折腾了一晚上,想解决为什么model无法提取材质...

一直以为是
    "textures": {
        "0": "#xxx"
    },

这块地方我没写对,最后发现是我更改贴图名字时把贴图后缀给清了.........