Random Texture with Inspector Override

410
3
09-04-2020 04:37 PM
BenHammer1
New Contributor

Hello CE Community,

I'm looking for a way to override randomized textures. It would be nice to have the ability to change the textures with a drop-down menu in the inspector.

Thanks.

0 Kudos
3 Replies
DevinLavigne
Occasional Contributor III

Just use a stochastic rule in your attribute. This will randomize on seed generation and then give you the ability to change it.  Something like the code below should work. 

@Enum("texA.jpg","texA.jpg","texC.jpg","texD.jpg")

attr Texture =  25%: "texA.jpg"
25%: "texB.jpg"
                25%: "texC.jpg"
               else: "texD.jpg"‍‍‍‍‍‍‍‍‍
BrianWamsley
Occasional Contributor III

I think you are trying to activate browse tool.

I use the texture folder wildcard method:

attr wall_tex = getWallTexture
getWallTexture = listRandom(_getWallTexture)
_getWallTexture = fileSearch("/FolderDestination*" + "*.*")
‍‍‍

Then over in the inspector you should be able to access the "browse" to override your texture:

I also think you can activate the browse by simply adding the "@File" before your attribute rule (?).

CherylLau
Esri Regular Contributor

Yes, that is correct.  The @File annotation allows you to open a file chooser.

Annotations—ArcGIS CityEngine Resources | Documentation