Jump to content
Sign in to follow this  
theVestarr

Configuring an object with switchable textures with setObjectTexture

Recommended Posts

Hi all,

I've recently taken my first steps in arma modding and have successfully created an object in blender, added textures and materials, imported to the game etc etc. Consists of 7 components and 4 different textures. I'm attaching a picture of it below:

20200312195139_1.jpg?width=1227&height=6

It's basically an airport taxiway direction sign, for immersion. These 3 "displays" with letters on them are their own components in the custom LOD (display_L, display_M, display_R) and have an emissive material applied to them (no texture in the material), which works pretty great. However, I would like to be able to switch the textures on those displays with scripting (setObjectTexture command), and I''ve been trying to use hiddenSections for that with no luck so far. 

 

When I run getObjectTextures on the object, it returns the ones that are set in the config.
If I run setObjectTexture and then getObjectTextures, it gets updated, but nothing changes on the model.

 

Model has these 7 components and display_L, display_M and display_R have the same textures assigned to them in the object editor as the ones mentioned in the config.

 

Here's my configs:

model.cfg

class CfgModels
{
    class Default 
    {
        skeletonName = "";
        sectionsInherit = "";
        sections[] = {};
    };

    class VAP_DTD_SIGN : Default 
    {
        skeletonName = "VAP_DTD_SIGN_Skeleton";

        sections[] = {
            "body",
            "display_L",
            "display_M",
            "display_R",
            "Leg1",
            "Leg2",
            "Leg3"
        };
    };
};

class CfgSkeletons {
    class Default 
    {
        isDiscrete = 1;
        skeletonInherit = "";
        skeletonBones[] = {};
    };

    class VAP_DTD_SIGN_Skeleton : Default 
    {
	    skeletonBones[] = {
            "display_L", "",
            "display_M", "",
            "display_R", ""
        };
    };
};


config.cpp

class CfgPatches
{
	class VESTARR_AIRPORT_PROPS
	{
		requiredAddons[] = {"A3_Structures_F"};
        name = "Name";
		author = "Vestarr";
		url = "";
		requiredVersion = 0.1;
		units[] = {"VAP_DTD_SIGN"};
		weapons[] = {};
	};
};

class CfgVehicles {
    class Thing;

    class VAP_DTD_SIGN : Thing {
        displayName = "D-T-D Taxiway Sign";
        author = "Vestarr";
        editorPreview = "\airportshit\data\dtd_sign\icons\dtd_sign_icon.paa";
        scope = 2;

        mapSize = 0.9;
        accuracy = 1;
        destrType = "DestructNo";

        model = "\airportshit\data\dtd_sign\objects\dtd_sign.p3d";
        hiddenSelections[] = {"display_L","display_M","display_R"};
        hiddenSelectionsTextures[] = {"\airportshit\data\common\textures\taxiway_dir_b_9_ca.paa", "\airportshit\data\common\textures\taxiway_mark_a_ca.paa", "\airportshit\data\common\textures\taxiway_dir_b_9_ca.paa"};
    };
};


Also my material, in case it matters:
 

ambient[]={1,1,1,1};
diffuse[]={1,1,1,1};
forcedDiffuse[]={0,0,0,1};
emmisive[]={100, 80, 28,0.2};
specular[]={0,0,0};
specularPower=2;

PixelShaderID="Normal";
VertexShaderID="Basic";

 

Can anyone shed some light how does this thing work and how to use it properly? I'm really confused.

Share this post


Link to post
Share on other sites

Entry in CfgModels needs to match p3d name. Either try to rename in model.cfg

class VAP_DTD_SIGN

to

class dtd_sign

Or change name of p3d to VAP_DTD_SIGN

  • Like 1

Share this post


Link to post
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
Sign in to follow this  

×