mirror of
https://github.com/exogen/t2-model-skinner.git
synced 2026-01-19 19:24:44 +00:00
Add shrike model and skin
This commit is contained in:
parent
355ec1f2d5
commit
2eb3060afc
|
|
@ -28,6 +28,8 @@ const weaponModels = [
|
|||
"targeting",
|
||||
];
|
||||
|
||||
const vehicleModels = ["vehicle_air_scout"];
|
||||
|
||||
export async function getSkinConfig() {
|
||||
const [defaultSkins, customSkins, customWeaponSkins] = await Promise.all([
|
||||
Promise.all(
|
||||
|
|
@ -101,6 +103,8 @@ export async function getSkinConfig() {
|
|||
shocklance: "weapon_shocklance",
|
||||
sniper: "weapon_sniper",
|
||||
targeting: "weapon_targeting",
|
||||
// Vehicles
|
||||
vehicle_air_scout: "vehicle_air_scout",
|
||||
},
|
||||
animationLabels: {
|
||||
Forward: "Run Forward",
|
||||
|
|
@ -259,6 +263,34 @@ export async function getSkinConfig() {
|
|||
mortar: [{ label: "Weapon", name: "weapon_mortar" }],
|
||||
repair: [{ label: "Weapon", name: "weapon_repair" }],
|
||||
targeting: [{ label: "Weapon", name: "weapon_targeting" }],
|
||||
// Vehicles
|
||||
vehicle_air_scout: [
|
||||
{
|
||||
label: "Vehicle",
|
||||
name: "vehicle_air_scout0",
|
||||
file: "vehicle_air_scout",
|
||||
},
|
||||
{
|
||||
name: "Unassigned",
|
||||
hidden: true,
|
||||
hasDefault: false,
|
||||
},
|
||||
{
|
||||
name: "vehicle_air_scout",
|
||||
hidden: true,
|
||||
hasDefault: false,
|
||||
},
|
||||
{
|
||||
label: "Flare",
|
||||
name: "shrikeflare2",
|
||||
emissiveFactor: [0, 0, 0],
|
||||
alphaMode: "BLEND",
|
||||
emissiveTexture: true,
|
||||
metallicFactor: 0,
|
||||
roughnessFactor: 1,
|
||||
size: [256, 256],
|
||||
},
|
||||
],
|
||||
},
|
||||
animations: {
|
||||
global: [
|
||||
|
|
|
|||
BIN
public/textures/shrikeflare2.png
Normal file
BIN
public/textures/shrikeflare2.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 38 KiB |
BIN
public/textures/vehicle_air_scout.png
Normal file
BIN
public/textures/vehicle_air_scout.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 537 KiB |
BIN
public/vehicle_air_scout.glb
Normal file
BIN
public/vehicle_air_scout.glb
Normal file
Binary file not shown.
|
|
@ -20,7 +20,7 @@ export default function MaterialSelector() {
|
|||
}}
|
||||
>
|
||||
{materialDefs.map((materialDef, i) =>
|
||||
materialDef ? (
|
||||
materialDef && !materialDef.hidden ? (
|
||||
<option key={materialDef.name} value={i}>
|
||||
{materialDef.label ?? materialDef.name}
|
||||
</option>
|
||||
|
|
|
|||
|
|
@ -208,45 +208,59 @@ export default function ToolsProvider({ children }: { children: ReactNode }) {
|
|||
name = name.trim() || "MyCustomSkin";
|
||||
|
||||
const materialExports = await Promise.all(
|
||||
materialDefs.map(async (materialDef: MaterialDefinition) => {
|
||||
const colorCanvas = canvases[`${materialDef.name}:color`]?.canvas;
|
||||
const metallicCanvas =
|
||||
canvases[`${materialDef.name}:metallic`]?.canvas;
|
||||
materialDefs
|
||||
.filter(
|
||||
(materialDef: MaterialDefinition) =>
|
||||
materialDef && !materialDef.hidden
|
||||
)
|
||||
.map(async (materialDef: MaterialDefinition) => {
|
||||
const colorCanvas = canvases[`${materialDef.name}:color`]?.canvas;
|
||||
const metallicCanvas =
|
||||
canvases[`${materialDef.name}:metallic`]?.canvas;
|
||||
|
||||
const textureSize = materialDef.size ?? [512, 512];
|
||||
let outputImageUrl;
|
||||
const textureSize = materialDef.size ?? [512, 512];
|
||||
let outputImageUrl;
|
||||
|
||||
const colorImageUrl = colorCanvas.toDataURL({
|
||||
top: canvasPadding,
|
||||
left: canvasPadding,
|
||||
width: textureSize[0],
|
||||
height: textureSize[1],
|
||||
});
|
||||
|
||||
if (metallicCanvas) {
|
||||
const metallicImageUrl = metallicCanvas.toDataURL({
|
||||
const colorImageUrl = colorCanvas.toDataURL({
|
||||
top: canvasPadding,
|
||||
left: canvasPadding,
|
||||
width: textureSize[0],
|
||||
height: textureSize[1],
|
||||
});
|
||||
outputImageUrl = await combineColorAndAlphaImageUrls({
|
||||
colorImageUrl,
|
||||
metallicImageUrl,
|
||||
});
|
||||
} else {
|
||||
outputImageUrl = colorImageUrl;
|
||||
}
|
||||
|
||||
const filename =
|
||||
selectedModelType === "player"
|
||||
? `${name}.${actualModel}.png`
|
||||
: materialDef
|
||||
? `${materialDef.file ?? materialDef.name}.png`
|
||||
: `weapon_${actualModel}.png`;
|
||||
if (metallicCanvas) {
|
||||
const metallicImageUrl = metallicCanvas.toDataURL({
|
||||
top: canvasPadding,
|
||||
left: canvasPadding,
|
||||
width: textureSize[0],
|
||||
height: textureSize[1],
|
||||
});
|
||||
outputImageUrl = await combineColorAndAlphaImageUrls({
|
||||
colorImageUrl,
|
||||
metallicImageUrl,
|
||||
});
|
||||
} else {
|
||||
outputImageUrl = colorImageUrl;
|
||||
}
|
||||
|
||||
return { imageUrl: outputImageUrl, filename };
|
||||
})
|
||||
let filename;
|
||||
switch (selectedModelType) {
|
||||
case "player":
|
||||
filename = `${name}.${actualModel}.png`;
|
||||
break;
|
||||
case "weapon":
|
||||
case "vehicle":
|
||||
if (materialDef) {
|
||||
filename = `${materialDef.file ?? materialDef.name}.png`;
|
||||
} else if (selectedModelType === "weapon") {
|
||||
filename = `weapon_${actualModel}.png`;
|
||||
} else {
|
||||
filename = `${actualModel}.png`;
|
||||
}
|
||||
}
|
||||
|
||||
return { imageUrl: outputImageUrl, filename };
|
||||
})
|
||||
);
|
||||
|
||||
switch (format) {
|
||||
|
|
|
|||
|
|
@ -34,6 +34,7 @@ export function getSkinImageUrls({
|
|||
}
|
||||
break;
|
||||
case "weapon":
|
||||
case "vehicle":
|
||||
return materialDefs.reduce(
|
||||
(
|
||||
skinImageUrls: Record<string, string>,
|
||||
|
|
|
|||
|
|
@ -84,6 +84,9 @@ export default function WarriorSelector() {
|
|||
<option value="repair">Repair Pack</option>
|
||||
<option value="targeting">Targeting Laser</option>
|
||||
</optgroup>
|
||||
<optgroup label="Vehicles" data-model-type="vehicle">
|
||||
<option value="vehicle_air_scout">Shrike</option>
|
||||
</optgroup>
|
||||
</select>
|
||||
</div>
|
||||
<div className="Field">
|
||||
|
|
@ -125,7 +128,8 @@ export default function WarriorSelector() {
|
|||
</optgroup>
|
||||
</>
|
||||
) : null}
|
||||
{selectedModelType === "weapon" ? (
|
||||
{selectedModelType === "weapon" ||
|
||||
selectedModelType === "vehicle" ? (
|
||||
<>
|
||||
{modelDefaults[actualModel] ? (
|
||||
<optgroup label="Default Skins" data-skin-type="default">
|
||||
|
|
|
|||
Loading…
Reference in a new issue