Variable = Variable

Hi,

someone could help me with this?

I have the variable that equal a string with the otrher variables...

for exemple:

slot = 1
base = meditMaterials[slot].materialList[a].texmap_diffuse
 
    for a = 1 to 5 do (
           base = Color_Correction map:( base)
		base.rewireR = 0
		base.rewireG = 1
		base.rewireB = 2
		base.rewireA = 3
     )

I want to be like this...

slot = 1
 
    for a = 1 to 5 do (
           meditMaterials[slot].materialList[a].texmap_diffuse = Color_Correction map:( meditMaterials[slot].materialList[a].texmap_diffuse)
		meditMaterials[slot].materialList[a].texmap_diffuse.rewireR = 0
		meditMaterials[slot].materialList[a].texmap_diffuse.rewireG = 1
		meditMaterials[slot].materialList[a].texmap_diffuse.rewireB = 2
		meditMaterials[slot].materialList[a].texmap_diffuse.rewireA = 3
     )

But "base" not print meditMaterials[slot].materialList[a].texmap_diffuse, but yes the result this...

Thanks in advanced...

Comments

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
Garp's picture

This should work:

slot = 1
base = mEditMaterials[slot]
 
for mtl in base do
    mtl.texmap.diffuse = color_correction map:(mtl.texmap_diffuse) \
                           rewireR:0 rewireG:1 rewireB:2 rewireA:4
kimarotta's picture

Yeah man is very good, this

Yeah man is very good, this loop is very much more functionally... but yet have the question...

Is possible define the variable with string with variable ?

for exemple?

base = meditmaterials[slot] != base = meditmaterials[slot]

I would like use a exemple: "base.texmap.diffuse" but " base = #Multi/Sub-Object:01 - Default" and not "base = meditmaterials[slot]"

understand?

Thanks very much...

kimarotta.com.br
3d Artist  

barigazy's picture

I TRY TO UNDERSTAND BUT

I TRY TO UNDERSTAND BUT ...
make a sceenshoot to see your problem

barigazy

kimarotta's picture

Hey ... I tried to summarize

Hey ... I tried to summarize the problem...

I tried define the variable...

base = meditMaterials[slot].materialList[a].texmap_diffuse
-- Type error: array index must be positive number, got: , got: undefined

but "slot" and "a" is a variable... How do ? Understand ?

thanks in advance...

kimarotta.com.br
3d Artist  

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.