2010-07-03 09:24 PM
n=REQUEST ("Name_of_material", index, name)I tried this, and can see that variable n is 0 when there is no material with that index, while it is 1 when a material exists.
2010-07-09 12:21 AM
parameters pict[1]= file_namethe value is not picked up.
print "pict value= ", pict[1], ", ", file_namewhich results in this message:
pict value= abc, Terracotta roof tileWhen I take off the "parameters" option:
pict[1]= file_namethen the script generates an error (like it did earlier):
String type expression required at line 11 in the 2D script of file AMT Material Matrix.gsm.As a last resort, I tried using both lines (the two variations of the pict[1]= statement, one with "parameters" and the other without), and still couldn't get it to work.
2010-07-09 08:12 AM
!--master script n=REQUEST{2} ("Material_info", "Testing Material", "gs_mat_texture", file_name, w, h, mask, alpha) parameters pict[1]= file_name DEFINE IMAGE_FILL "Testing" pict[1], 255, 255, 255, 255, 255, 255, 255, 255, w, h, 0, 0
!--master or 2D script set IMAGE_FILL "Testing" poly2_ 4, 1+2+4+8, 0, 0, 0, a, 0, 0, a, b, 0, 0, b, 0I tested again and works nicely here.
2010-07-09 10:46 AM
n=REQUEST{2} ("Material_info", materialtype, "gs_mat_texture", file_name, w, h, mask, alpha) parameters pict[1]= file_name print "materialtype=",materialtype," file_name=",file_name,", pict[1]=",pict[1] DEFINE IMAGE_FILL "newimagefill" pict[1], 255, 255, 255, 255, 255, 255, 255, 255, w, h, 0, 0When I ran a small loop with my matrix object, which called the simple object once for each material, I got the following report:
materialtype= 73 file_name=Brick Common Flemmish alpha, pict[1]=Brick Running alphaYou can see that each time the object was called, it received a different materialtype as a parameter from the matrix object. The file_name variable successfully picks up the proper texture file name, however the pict[1] string array variable is somehow not being set even though I am using the parameters statement as you did in the Master Script.
materialtype= 72 file_name=Brick English alpha, pict[1]=Brick Running alpha
materialtype= 70 file_name=Brick Surface alpha, pict[1]=Brick Running alpha
materialtype= 71 file_name=Stucco alpha, pict[1]=Brick Running alpha
materialtype= 74 file_name=Tiles Wall alpha, pict[1]=Brick Running alpha
2010-07-09 05:13 PM
2010-07-09 10:42 PM
!--stretching the table for xx=1 to 255 parameters pict[xx][1]="", pict[xx][2]="" next xx !--looping thru materials for xx=1 to 255 test= REQUEST{2}("Material_info", xx, "gs_mat_surface_rgb", r, g, b) if test then!<--we have a material with index xx dummy= REQUEST("Name_of_material", xx, name) file_name= "" n=REQUEST{2} ("Material_info", name, "gs_mat_texture", file_name, w, h, mask, alpha) nr= nr+1 if file_name#"" then!<--we have a material with a texture --- store the fill name and the texture name, define image fill fill_name= name parameters pict[nr][1]= fill_name, pict[nr][2]= file_name DEFINE IMAGE_FILL pict[nr][1] pict[nr][2], 255, 255, 255, 255, 255, 255, 255, 255, w, h, 0, 0 else!<--we have a material but no texture --- store just the fill name parameters pict[nr][1]= name, pict[nr][2]= "" endif endif next xx !--just limiting a stretching hotspot values values "A" range[1,nr] step 1, 1
hotspot2 0, 0 hotspot2 a, 0 !--looping thru stored materials for xx= 1 to vardim1(pict) if pict[xx][2]#"" then!<--we have an image fill set IMAGE_FILL pict[xx][1]!<--get the mage fill name poly2_ 4, 1+2+4+8, 0, 0, 1, 1, 0, 1, 1, -1, 1, 0, -1, 1 !--texture matrix transformation if dx<a-1 then add2 1, 0 dx= dx+1 else add2 -a+1, -1 dx= 0 endif nt=nt+1 endif next xx del nt
2010-07-10 09:38 AM