Skip to content

Commit 28299fd

Browse files
committed
feat: add support of "alwaysSelectAsActiveMesh" and auto invert textures on Y when importing scenes
1 parent f189884 commit 28299fd

File tree

2 files changed

+13
-0
lines changed

2 files changed

+13
-0
lines changed

editor/src/editor/layout/inspector/mesh/mesh.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -197,6 +197,7 @@ export class EditorMeshInspector extends Component<IEditorInspectorImplementatio
197197
{this.props.object.geometry && (
198198
<EditorInspectorSectionField title="Misc">
199199
<EditorInspectorSwitchField label="Infinite Distance" object={this.props.object} property="infiniteDistance" />
200+
<EditorInspectorSwitchField label="Always Select As Active Mesh" object={this.props.object} property="alwaysSelectAsActiveMesh" />
200201
</EditorInspectorSectionField>
201202
)}
202203
</>

editor/src/editor/layout/preview/import/import.ts

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -188,6 +188,12 @@ export function configureImportedMaterial(material: Material): void {
188188

189189
export function configureImportedTexture<T extends Texture | CubeTexture | ColorGradingTexture>(texture: T): T {
190190
if (isAbsolute(texture.name)) {
191+
if (isTexture(texture) && !texture.invertY && !texture._buffer) {
192+
texture._invertY = true;
193+
texture.vScale *= -1;
194+
texture.updateURL(texture.name);
195+
}
196+
191197
texture.name = texture.name.replace(join(dirname(projectConfiguration.path!), "/"), "");
192198
texture.url = texture.name;
193199
}
@@ -247,6 +253,12 @@ export async function configureEmbeddedTexture(texture: Texture, absolutePath: s
247253
if (!(await pathExists(filename))) {
248254
await writeFile(filename, buffer);
249255
}
256+
257+
if (!texture.invertY) {
258+
texture._invertY = true;
259+
texture.vScale *= -1;
260+
texture.updateURL(filename);
261+
}
250262
}
251263

252264
if (!filename) {

0 commit comments

Comments
 (0)