Skip to content

Commit 25a7f83

Browse files
authored
fix alphaTexture for unlit Material (#1151)
1 parent 8c6802f commit 25a7f83

2 files changed

Lines changed: 9 additions & 15 deletions

File tree

packages/@dcl/inspector/src/components/EntityInspector/MaterialInspector/MaterialInspector.tsx

Lines changed: 5 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,7 @@ export default withSdk<Props>(({ sdk, entity }) => {
5353
<Block>
5454
<RangeField label="Alpha test" max={1} step={0.1} {...getInputProps('alphaTest')} />
5555
</Block>
56+
<Texture label="Texture" texture={TextureType.TT_TEXTURE} files={files} getInputProps={getTextureProps} />
5657
<Texture
5758
label="Alpha texture"
5859
texture={TextureType.TT_ALPHA_TEXTURE}
@@ -78,28 +79,20 @@ export default withSdk<Props>(({ sdk, entity }) => {
7879
<Block>
7980
<ColorField label="Reflectivity color" {...getInputProps('reflectivityColor')} />
8081
</Block>
81-
</>
82-
)}
83-
84-
<Texture label="Texture" texture={TextureType.TT_TEXTURE} files={files} getInputProps={getTextureProps} />
85-
86-
{materialType.value === MaterialType.MT_PBR && (
87-
<>
88-
<Container label="Intensity" border>
82+
<Texture label="Texture" texture={TextureType.TT_TEXTURE} files={files} getInputProps={getTextureProps} />
83+
<Container label="Intensity" border initialOpen={false}>
8984
<RangeField label="Specular" max={1} step={0.1} {...getInputProps('specularIntensity')} />
9085
<RangeField label="Direct" max={1} step={0.1} {...getInputProps('directIntensity')} />
9186
</Container>
92-
93-
<Container label="Transparency" border>
87+
<Container label="Transparency" border initialOpen={false}>
9488
<Block>
9589
<Dropdown label="Transparency Mode" options={TRANSPARENCY_MODES} {...getInputProps('transparencyMode')} />
9690
</Block>
9791
<Block>
9892
<RangeField label="Alpha test" max={1} step={0.1} {...getInputProps('alphaTest')} />
9993
</Block>
10094
</Container>
101-
102-
<Container label="Emissive" border>
95+
<Container label="Emissive" border initialOpen={false}>
10396
<Block>
10497
<RangeField label="Emissive Intensity" max={1} step={0.1} {...getInputProps('emissiveIntensity')} />
10598
</Block>
@@ -113,7 +106,6 @@ export default withSdk<Props>(({ sdk, entity }) => {
113106
getInputProps={getTextureProps}
114107
/>
115108
</Container>
116-
117109
<Texture
118110
label="Bump texture"
119111
texture={TextureType.TT_BUMP_TEXTURE}

packages/@dcl/inspector/src/components/EntityInspector/MaterialInspector/utils.ts

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,8 @@ export const fromMaterial =
1616
alphaTest: String(value.material.unlit.alphaTest ?? 0.5),
1717
castShadows: !!(value.material.unlit.castShadows ?? true),
1818
diffuseColor: toHex(value.material.unlit.diffuseColor),
19-
texture: fromTexture(base, value.material.unlit.texture ?? {})
19+
texture: fromTexture(base, value.material.unlit.texture ?? {}),
20+
alphaTexture: fromTexture(base, value.material.unlit.alphaTexture ?? {})
2021
}
2122
case 'pbr':
2223
default:
@@ -53,7 +54,8 @@ export const toMaterial =
5354
alphaTest: Number(value.alphaTest ?? 0.5),
5455
castShadows: !!(value.castShadows ?? true),
5556
diffuseColor: toColor4(value.diffuseColor),
56-
texture: toTexture(base, value.texture)
57+
texture: toTexture(base, value.texture),
58+
alphaTexture: toTexture(base, value.alphaTexture)
5759
}
5860
}
5961
}

0 commit comments

Comments
 (0)