07-24-2024, 07:22 PM
If you took a look at the game hair script, you must know that they need some additional script for working with the hair color slider.
The first one beeing a AppReplaceImage in the Ac*.bs
Here the TextureName is the Object.Name of a Texture2D object.
The LayerFile is a .bs file placed in the same folder as the texture image and will contain script looking like this.
However, there is some good chance that you were not aware that this AppReplaceImage and Layer bs can be replaced by script writed directly in your scene file.
So let take a look at the object type hierarchy.
Group Layer Node use TransformLayer Node as parameter. (It can also use Image Layer as parameter...)
TransformLayer node use ImageLayer node as parameter.
ImageLayer node use FileObject node as parameter.
Group Layer --> TransformLayer --> ImageLayer --> FileObject
So here what look like the Layer.bs script when beeing writed in a scene file.
As for the AppReplaceImage we will simply write an additional parameter in our Texture2D instead of using it.
The first one beeing a AppReplaceImage in the Ac*.bs
Code:
AppReplaceImage . {[/color]
[color=#c10300].TextureName "hair08_transparent01_texture";[/color]
[color=#c10300].LayerFile "Shared/Hair/hair08";[/color]
[color=#c10300]};
Here the TextureName is the Object.Name of a Texture2D object.
The LayerFile is a .bs file placed in the same folder as the texture image and will contain script looking like this.
Code:
[/color]
[color=#000000]GroupLayer :hair08_Layer;[/color]
[color=#000000]ImageLayer :hair08_blond_ImageLayer . {[/color]
[color=#000000].FileObject FileObject :hair08_blond_FileObject . {[/color]
[color=#000000].FileName "Shared/Hair/hair08_style01_blond";[/color]
[color=#000000]};[/color]
[color=#000000]};[/color]
[color=#000000]ImageLayer :hair08_default_ImageLayer . {[/color]
[color=#000000].FileObject FileObject :hair08_default_FileObject . {[/color]
[color=#000000].FileName "Shared/Hair/hair08_style01_default";[/color]
[color=#000000]};[/color]
[color=#000000]};[/color]
[color=#000000]ImageLayer :hair08_custom_ImageLayer . {[/color]
[color=#000000].FileObject FileObject :hair08_custom_FileObject . {[/color]
[color=#000000].FileName "Shared/Hair/hair08_style01_custom";[/color]
[color=#000000]};[/color]
[color=#000000]};[/color]
[color=#000000]GroupLayer :hair08_Layer . {[/color]
[color=#000000].LayerArray [ TransformLayer :hair_transparent01_blond_TransformLayer . {
.ImageLayer :hair08_blond_ImageLayer;
.CombineMode TransformLayer .CombineModeEnum .Replace;
.Visibility U32(0);
};
TransformLayer :hair_transparent01_default_TransformLayer . {
.ImageLayer :hair08_default_ImageLayer;
.CombineMode TransformLayer .CombineModeEnum .Replace;
.Visibility U32(0);
};
TransformLayer :hair_transparent01_custom_TransformLayer . {
.ImageLayer :hair08_custom_ImageLayer;
.CombineMode TransformLayer .CombineModeEnum .Replace;
.Visibility U32(0);
};
];[/color]
[color=#000000]};
However, there is some good chance that you were not aware that this AppReplaceImage and Layer bs can be replaced by script writed directly in your scene file.
So let take a look at the object type hierarchy.
Group Layer Node use TransformLayer Node as parameter. (It can also use Image Layer as parameter...)
TransformLayer node use ImageLayer node as parameter.
ImageLayer node use FileObject node as parameter.
Group Layer --> TransformLayer --> ImageLayer --> FileObject
So here what look like the Layer.bs script when beeing writed in a scene file.
Code:
[/color]
[color=#000000]FileObject :local_hair08_blond_FileObject FileObject.FileName "Shared/Hair/hair08_style01_blond";[/color]
[color=#000000]FileObject :local_hair08_default_FileObject FileObject.FileName "Shared/Hair/hair08_style01_default";[/color]
[color=#000000]FileObject :local_hair08_custom_FileObject FileObject.FileName "Shared/Hair/hair08_style01_custom";[/color]
[color=#000000]ImageLayer :local_hair08_blond_ImageLayer . {[/color]
[color=#000000]ImageLayer.FileObject FileObject :local_hair08_blond_FileObject ;[/color]
[color=#000000]Object.Name "hair08_blond_ImageLayer";[/color]
[color=#000000]};[/color]
[color=#000000]ImageLayer :local_hair08_default_ImageLayer . {[/color]
[color=#000000]ImageLayer.FileObject FileObject :local_hair08_default_FileObject ;[/color]
[color=#000000]Object.Name "hair08_default_ImageLayer";[/color]
[color=#000000]};[/color]
[color=#000000]ImageLayer :local_hair08_custom_ImageLayer . {[/color]
[color=#000000]ImageLayer.FileObject FileObject :local_hair08_custom_FileObject ;[/color]
[color=#000000]Object.Name "hair08_custom_ImageLayer";[/color]
[color=#000000]};[/color]
[color=#000000]TransformLayer :local_hair_transparent01_blond_TransformLayer . {[/color]
[color=#000000]TransformLayer.ImageLayer ImageLayer :local_hair08_blond_ImageLayer;[/color]
[color=#000000]TransformLayer.CombineMode TransformLayer.CombineModeEnum.Replace;[/color]
[color=#000000]TransformLayer.Visibility U32(0);[/color]
[color=#000000]Object.Name "hair_transparent01_blond_TransformLayer";[/color]
[color=#000000]};[/color]
[color=#000000]TransformLayer :local_hair_transparent01_default_TransformLayer . {[/color]
[color=#000000]TransformLayer.ImageLayer ImageLayer :local_hair08_default_ImageLayer;[/color]
[color=#000000]TransformLayer.CombineMode TransformLayer.CombineModeEnum.Replace;[/color]
[color=#000000]TransformLayer.Visibility U32(0);[/color]
[color=#000000]Object.Name "hair_transparent01_default_TransformLayer";[/color]
[color=#000000]};[/color]
[color=#000000]TransformLayer :local_hair_transparent01_custom_TransformLayer . {[/color]
[color=#000000]TransformLayer.ImageLayer ImageLayer :local_hair08_custom_ImageLayer;[/color]
[color=#000000]TransformLayer.CombineMode TransformLayer.CombineModeEnum.Replace;[/color]
[color=#000000]TransformLayer.Visibility U32(0);[/color]
[color=#000000]Object.Name "hair_transparent01_custom_TransformLayer";[/color]
[color=#000000]};[/color]
[color=#000000]GroupLayer :local_hair08_Layer . {[/color]
[color=#000000]GroupLayer.LayerArray [ TransformLayer :local_hair_transparent01_blond_TransformLayer , TransformLayer :local_hair_transparent01_default_TransformLayer , TransformLayer :local_hair_transparent01_custom_TransformLayer ];[/color]
[color=#000000]Object.Name "hair08_Layer";[/color]
[color=#000000]};
As for the AppReplaceImage we will simply write an additional parameter in our Texture2D instead of using it.
Code:
Texture2D :local_19 . {[/color]
[color=#000000]// Texture.FileObject FileObject :local_20;[/color]
[color=#000000] Texture.ImageLayer GroupLayer :local_hair08_Layer;[/color]
[color=#000000]Object.Name "hair08_transparent01_texture"; [/color]
[color=#000000]};
[To see links please log-in or register here]