ScriptSpot

Forum topic · General Scripting

Element length problem

By johncrawshaw · 2014-10-09

Description

Hi All,

I'm trying to write a maximum element filename. I'm really struggling with the greater than. I'm sure its something simple I'm missing. Anyone got any ideas?


r = maxOps.GetCurRenderElementMgr()
r.GetRenderElement 1
elementlength = r.GetRenderElementFilename 1
print elementlength.count

if elementlength as integer > 256 then (
	print "fred"
)
else
(
	print "geon"
)
Comments (4)

barigazy · 2014-10-09

With this code you can print name and filename of all render elenents


re = maxOps.getCurRenderElementMgr()
reCount = re.numRenderElements()
getElement = re.getRenderElement
getFilename = re.getRenderElementFilename
reData = for e = 0 to reCount-1 do
(
	format "RE_NAME: %  -> RE_PATH: %\n" ((getElement e).elementName) (getFilename e)
)

Now to collect all elements where filename length is greater then 256 chars then use this.

re = maxOps.getCurRenderElementMgr()
reCount = re.numRenderElements()
getElement = re.getRenderElement
getFilename = re.getRenderElementFilename
reData = for e = 0 to reCount-1 where (path = getFilename e).count > 256 collect
(
#( (getElement e), (getElement e).elementName, path)

)

johncrawshaw · 2014-10-10

Perfect!! That's not exactly how I was thinking of fixing that problem but it works really well. Thank-you for your help. It for deadline rendering. We are having a problem with file paths over 256 characters.

Thanks, Again!

barigazy · 2014-10-09

Can you explain a bit more or show some screehots.
I not understand what do tou mean by "maximum element filename"?

Attachement

johncrawshaw · 2014-10-09

Not a problem. I've attached an image with the filepath I'm looking at counting and seeing if it is over 256 characters.

renderelements