Texture Error!...

2168
2
12-13-2013 12:19 AM
denizsenturk
New Contributor
Hi,
I have a problem with my cga rule.I changed the location of the file,then i imported the file to CE again.But textures are lost.Only 2 of  texture image are shown as facade image.In fact,there are about 150 texture image.What can be the reason?...
Additionally,assume that i changed something in cga file,but i did not save it.Although i did not save it ,the cga file is keeping all of the changes.The other problem is that when i use a cga file in 2 different projects and make some changes in cga file in of one of these projects,the cga file which was used in other project  also changes.This is so absurd:) Do you have an idea about that?...

Thanks :)


#####################################################################

My rule is:

@Hidden
attr binayukseklikhesabi=MEAN_Z



attr MEAN_Z = rand (0,200)
 

@Hidden
attr Roof_Ht = 1.5

@Group("Cephe Giydirme",2) @Order(1) @Description("If true, random textures are shown for facades")
attr Doku_Goster = true

@Group("Cephe Giydirme") @Order(2) @Range(2.9,5.2) @Description("in Meters")
attr Kat_Yuks = 3

@Group("Cephe Giydirme") @Order(3)
attr Facade_Image = fileRandom("asset/Cepheler/Cep_*_Kat"+texFloors+"_*.jpeg") # potential texture which is high enough (see below)



const texFloors =
case nFloors == 1  : 1
case nFloors == 2  : 2
case nFloors == 3  : 3
case nFloors == 4 : 4
case nFloors == 5  : 5
case nFloors == 6 : 6
case nFloors == 7 : 7
case nFloors == 8 : 8
case nFloors == 9 : 9
else      : 10
# after a texture with a compatible floor number has been randomly selected, the
# filename is parsed to get information how many tiles are in this image:
const texTiles = float(getRange(Facade_Image,"Pen",".jpeg"))    # truncate the file name to get actual number of tiles

# for facade texturing (operating on the *current* geometry)
nFloors = rint(scope.sy/Kat_Yuks)
nTiles  = ceil(scope.sx/Kat_Yuks*0.75)
# needed to setup the texture projection to the current facade so that the texture fits
getFacadeTexProjectionHeight  = scope.sy/nFloors*texFloors
getFacadeTexProjectionWidth  = scope.sx/nTiles*texTiles


Lot--> 
alignScopeToAxes(y) s('1,0,'1)  # make it horizontal i.e. scale it flat
extrude(binayukseklikhesabi)
comp(f){side : Facade | top : Roof }



# Facade Generation
#
attr OBJECTID = 2
Facade -->
set(seedian,OBJECTID*30)
Facade(getFacadeTexProjectionWidth,getFacadeTexProjectionHeight,0,0)
Facade(w,h,offsetW, offsetH)--> 
  case Doku_Goster == true :
   setupProjection(0,scope.xy,w,h,offsetW,offsetH) projectUV(0)
   texture(Facade_Image)
  else:
   Facade
  
 
# Roof#########################################
#



const myRoofTexture = fileRandom("assets/Cati/*.jpg")
@Group ("Roof") @Range ("Tip1","Tip2","Tip3","Tip4","Tip5")
attr CatiTipi = "Tip1"
Roof --> 
case CatiTipi == "Tip1" :
  roofHip (30,0.5)
  comp(f) { all: CatiDuzlemleri }
case CatiTipi == "Tip2" :
  roofShed(15)
  comp(f) { all: CatiDuzlemleri }
case CatiTipi == "Tip3" :
  roofGable(45,0,0,false,0)
  comp(f) { all: CatiDuzlemleri }
case CatiTipi == "Tip4" :
  roofPyramid(45)
  comp(f) { all: CatiDuzlemleri }
else: CatiDuzlemleri

CatiDuzlemleri -->
setupProjection(0, scope.xy, 8,8) projectUV(0)
scaleUV(0,2,2)
texture("asset/Cepheler/kiremit.jpg")
0 Kudos
2 Replies
denizsenturk
New Contributor
There are lots of Turkish words in this rule file,i don't know how much it can be useful for your help :confused:
0 Kudos
MatthiasBuehler1
Frequent Contributor II
Hi,

if textures cannot be found, then either the CGA code to define the texture path is wrong or the textures are not in the right place.

make sure your texture path is correct. maybe use print() to debug the issue. comment out all the code that you don't need.

just work with the very basics you need.

the other issue with 2 CGA files with the same in different projects: that would be a bug. are you absolutely sure you dont' edit the same file just because it remains open when you open a different scene ?

can you provide a very simple reproduction ? that would be very helpful.

lemme know ..

m.
0 Kudos