Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to get textures of other gear. #2

Open
Seb105 opened this issue Apr 28, 2022 · 4 comments
Open

How to get textures of other gear. #2

Seb105 opened this issue Apr 28, 2022 · 4 comments
Labels
enhancement New feature or request

Comments

@Seb105
Copy link
Contributor

Seb105 commented Apr 28, 2022

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
Copy link
Owner

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
Copy link
Contributor Author

Seb105 commented Apr 28, 2022

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
Copy link
Owner

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

@johnb432
Copy link
Contributor

johnb432 commented Dec 7, 2022

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]

@rekterakathom rekterakathom added the enhancement New feature or request label Dec 21, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

3 participants