access texturemap from VRayDirt

Hi I have a problem for getting texturmap from vraydirt that already inside some object.if i using $.material.diffusemap.vraydirt.texmap_occluded_color.bitmaptexture.filename
it result error Unknown property: "texmap_occluded_color" in .
I would be realy greatfull if someone could help me to solve this problem since i have so many material i have to change.

Comments

Comment viewing options

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

oh, it's Ok Branko... I hope

oh, it's Ok Branko...
I hope to see you to optimize this method. If you don't mind :)

I just think it could use a INI file or xml to handle Memory allocation.

barigazy's picture

...

Ok. I have a suggestion.
Open new thread and then we can start a discussion about universal solution (fn) which can be related to any map or material type.
First we have to setup basic concept (what we need to do in order to solve the problem) without snippets.
This fn must found all fileNames in (Bitmap, VRayHDRI, VRayBmpFilter etc.) of specified map class (VRayDirt, Noise, Composite, ColorCorrection etc.) assigned to the any material (Standard, VRayMtl, Arch&Design, Blend, Multimaterial etc.)
Also are we need to consider only selected objects or whole scene
Uh... :)
Are you agree?

bga

Budi G's picture

agreed :)

ok, I open new thread Here

btw sorry if I long to comment because there is something I have to do.

Budi G's picture

Hi.. try this one You don't

Hi..
try this one
You don't need to write 'vraydirt' and 'bitmaptexture', such as:

$.material.diffusemap.texmap_occluded_color.filename
barigazy's picture

...

If you have many objects and you want to collect all maps in VrayDirt map then
u can try this. Also this works only if dirt map is in diffuse slot of VRayMtl

fn findDirtMaps obj = if obj.material != undefined do
(
	local props = #(#texmap_radius, #texmap_occluded_color, #texmap_unoccluded_color, #texmap_reflection_glossiness)
	if isKindOf (mtl = obj.material) VRayMtl do
		if isKindOf (dirt = mtl.texmap_diffuse) VRayDirt do
			for p in props where (map = getProperty dirt p) != undefined collect map
)
findDirtMaps $

bga

barigazy's picture

...

Function will be more complex if you need to support different material types and any map slot.

bga

Budi G's picture

If you can understand the

If you can understand the script from barigazy, it is good to be applied.

barigazy's picture

...

Hey Budi
how about more complex solution ei. "collect all DIRT maps from selection". :)
Post if you have something and we can talk about

bga

Budi G's picture

I have this one

This is Collect v dirt of diffuse map only

( -- start script
 
local VdirtMapsCollection =#() -- Init
 
fn getVdirtMapFilename diff =
(
	local map_filename=#(), propname, prop, map
    if classof diff == VRayDirt then 
    (
      propname = getPropNames diff
      for prop in propname do
      (
	    map = getProperty diff prop
        if classof map == Bitmaptexture then
        ( if map !=undefined then if map.filename !="" then append map_filename map.filename )
      )
    )
	map_filename
) -- fn
 
fn GrabVdirtMaps mat =
(
  if classof mat == Standardmaterial  then
  (
    if classof mat.diffusemap == VRayDirt then ( VdirtMapsCollection += getVdirtMapFilename mat.diffusemap )
  ) else
  (
	if classof mat == VRayMtl  then
	(
		if classof mat.texmap_diffuse == VRayDirt then ( VdirtMapsCollection += getVdirtMapFilename mat.texmap_diffuse )
	) else
	(
		if classof mat == MultiMaterial  then 
		(
		  if mat.numsubs != 0 then for index=1 to mat.numsubs do (GrabVdirtMaps mat[index])
		)
	)
  )
) -- fn
 
   ----------------------------------------------execute
   GrabVdirtMaps $.material
   --clearlistener()
   VdirtMapsCollection -- this is All Collection of Vray dirt
) --end script

do you want optimize it ? :)

barigazy's picture

...

fn findDirtOccludedMap obj =
(
	if isKindOf (mtl = obj.material) VRayMtl do
		if isKindOf (dirt = mtl.texmap_diffuse) VRayDirt do
			if isKindOf (tex = dirt.texmap_occluded_color) Bitmaptexture do
				format "bitmap = %\nfilename = %\n" tex.bitmap tex.filename
)
findDirtOccludedMap $

bga

Comment viewing options

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