ScriptSpot is a diverse online community of artists and developers who come together to find and share scripts that empower their creativity with 3ds Max. Our users come from all parts of the world and work in everything from visual effects to gaming, architecture, students or hobbyists.
How in code bellow convert string A to command M.texmap_diffuse ? I need in strings, because want to manipulate with them :
(
local M = meditMaterials[activeMeditSlot]
if classof M == VrayMtl do A = "M.texmap_diffuse"
A
)
Thanks to all! I solved this with execute command:
(
fn fn_A = (
local M = meditMaterials[activeMeditSlot]
local B = "meditMaterials[activeMeditSlot]."
if classof M == VrayMtl do local A = #("texmap_diffuse")
A[1] = execute (B + A[1])
)
D = fn_A()
)
fn fn_A = (
local M = meditMaterials[activeMeditSlot]--local B = "meditMaterials[activeMeditSlot]."--if classof M == VrayMtl do local A = #("texmap_diffuse")--A[1] = execute (B + A[1]) ///why execute it?if(iskindof M vraymtl)do(A[1]=getProperty M #texmap_diffuse)--I dont know (A[1]) is for, but it could lead to error, because theres no array here...---better to access it in another function,no? )
better like this
fn fn_A =
(
local mat
local M = meditMaterials[activeMeditSlot]if(iskindof M vraymtl)do(mat=getProperty M #texmap_diffuse)
mat
)
--get material prop
obj = vrayMtl()
getProperty obj A --==> equiv : obj.texmap_diffuse--set material prop
setProperty obj A( Bitmaptexture fileName:(xxx)).....
--==> equiv :obj.texmap_diffuse=Bitmaptexture fileName:(xxx)
see getProperty and setProperty in max help
also its not good practice using "execute" command in maxscript.....
here is the sample code
(
local prop
local idx = medit.GetActiveMtlSlot()
local theMat = getMeditMaterial idx
local num = random 110000
local myMat=vrayMtl name:("VRayMtl_" + formattedPrint num format:"04d")
case of
((iskindof theMat standardMaterial) :(prop=#diffuseMap)(iskindof theMat VrayMtl) : (prop=#texmap_diffuse))if prop!=undefined do(if(isKindof ( x = getProperty theMat prop) Bitmaptexture and x.filename!=undefined )do(
setProperty myMat #texmap_diffuse x
))
meditMaterials[idx]=mymat
)
Hello, I saw your post and started playing around in max and got this bit of code (below) to work, I think it should work for your purpose too (hope it does).
Comments
Thanks to all! I solved this
Thanks to all! I solved this with execute command:
(
fn fn_A = (
local M = meditMaterials[activeMeditSlot]
local B = "meditMaterials[activeMeditSlot]."
if classof M == VrayMtl do local A = #("texmap_diffuse")
A[1] = execute (B + A[1])
)
D = fn_A()
)
hmmm....
better like this
then like this =
instead"M.texmap_diffuse"it
instead of
"M.texmap_diffuse"
it would be better
A= #texmap_diffuse or A= "texmap_diffuse"
later you can use it like this
see getProperty and setProperty in max help
also its not good practice using "execute" command in maxscript.....
here is the sample code
I think I found it :D
Hello, I saw your post and started playing around in max and got this bit of code (below) to work, I think it should work for your purpose too (hope it does).
-Maarten