rekterakathom / DynamicCamoSystem

A lightweight ARMA 3 mod that calculates camouflage levels based on worn gear
https://steamcommunity.com/sharedfiles/filedetails/?id=2800081814
GNU General Public License v3.0
0 stars 4 forks source link

How to get textures of other gear. #2

Open Seb105 opened 2 years ago

Seb105 commented 2 years ago

You say in the mod description it's an engine limitation you can't get the object textures of vests, headgear and backpacks but this isn't strictly true.

99% of gear have hidden selections that list the textures used, although not all do.

private _loadout = getUnitLoadout _unit;

private _vest = _loadout#4;
private _backpack = _loadout#5;
private _headgear = _loadout#6;

// Either an array of texture paths, or [""] if there is no hidden selections defined.
private _vestTextures  = [configfile >> "CfgWeapons" >> _vest >> "hiddenSelectionsTextures", [""]] call BIS_fnc_returnConfigEntry;
private _headgearTextures = [configfile >> "CfgWeapons" >> _headgear >> "hiddenSelectionsTextures", [""]] call BIS_fnc_returnConfigEntry;
private _backpackTextures = [configfile >> "CfgVehicles" >> _backpack >> "hiddenSelectionsTextures", [""]] call BIS_fnc_returnConfigEntry;
rekterakathom commented 2 years ago

Thanks for letting me know. I didn't really look that deep into it, I just noted that getObjectTextures doesn't return any textures apart from the uniform and didn't look into it further. I will definitely look into implementing these textures into the mod as well, now that I know that this is possible. How would you determine which texture to use though if multiple are supplied?

Seb105 commented 2 years ago

Generally speaking, the first texture is the 'main' one, and the others texture if there are any is stuff like straps, radios, headsets. If I were you I'd only bother calculating the first one.

rekterakathom commented 2 years ago

I'll look into the implementation of this after I roll out the first update.

johnb432 commented 1 year ago

You say in the mod description it's an engine limitation you can't get the object textures of vests, headgear and backpacks but this isn't strictly true.

99% of gear have hidden selections that list the textures used, although not all do.

private _loadout = getUnitLoadout _unit;

private _vest = _loadout#4;
private _backpack = _loadout#5;
private _headgear = _loadout#6;

// Either an array of texture paths, or [""] if there is no hidden selections defined.
private _vestTextures  = [configfile >> "CfgWeapons" >> _vest >> "hiddenSelectionsTextures", [""]] call BIS_fnc_returnConfigEntry;
private _headgearTextures = [configfile >> "CfgWeapons" >> _headgear >> "hiddenSelectionsTextures", [""]] call BIS_fnc_returnConfigEntry;
private _backpackTextures = [configfile >> "CfgVehicles" >> _backpack >> "hiddenSelectionsTextures", [""]] call BIS_fnc_returnConfigEntry;

Faster yet would be (and working):

private _vest = vest player;
private _backpack = backpack player;
private _headgear = headgear player;

// Either an array of texture paths, or [""] if there is no hidden selections defined.
private _vestTextures  = [configfile >> "CfgWeapons" >> _vest >> "hiddenSelectionsTextures", "ARRAY", [""]] call CBA_fnc_getConfigEntry;
private _headgearTextures = [configfile >> "CfgWeapons" >> _headgear >> "hiddenSelectionsTextures", "ARRAY", [""]] call CBA_fnc_getConfigEntry;
private _backpackTextures = [configfile >> "CfgVehicles" >> _backpack >> "hiddenSelectionsTextures", "ARRAY", [""]] call CBA_fnc_getConfigEntry;

[_vestTextures, _headgearTextures, _backpackTextures]