I am attempting to create a rule package that contains a variety of textures that will be selectable in a dropdown list under the inspector tab using an ESRI texture package for signs. I am able to add the texture names under the Enum function, however, I am unsure where I would insert the texture link within the code that the Enum would draw from. The code I have is attached in the screenshots below. I am relatively new to CityEngine and CGA so any help would be appreciated.
Hi @Kayleigh_T ,
See the snippet below for a minimal solution. Instead of storing the list of textures as const array you could also read from a CSV file with the same structure. In the RPK creation dialog you then need to make sure everything is included under "Additional Files".
@Enum (valuesAttr = textureNames)
attr selectedTexture = textureNames[0]
@Hidden
attr textureNames = textureArray[[0:2:size(textureArray)-1]]
const texturePath = "/ESRI.lib/assets/Fences/Textures/"
// for many texture consider reading from a CSV
const textureArray = [
"brick", "brick_01.jpg";
"brick2", "brick_03.jpg";
"stone", "stone_01.jpg"
]
@StartRule
Lot -->
primitiveCube()
texture(texturePath+textureArray[findFirst(textureArray, selectedTexture)+1])
Hope this helps,
Cheers
Jonas