SoLiTuDe
11-03-2008, 06:30 PM
I'm currently dealing with adding custattributes to objects in a scene. I can create / add the cust attribute fine, but the problem I'm having is that I can't figure out how to have the script check to see if the attribute is already declared in the scene, so everytime I run the script it adds another custattribute to the scene.... so custattributes.getscenedefs() will keep getting bigger and bigger and bigger... not what I want.
global scenedef = true
sceneattrib = custattributes.getscenedefs()
for o in sceneattrib do
(
if (matchpattern o.name pattern:"*asset*" ) then
(
Print "Asset Def Found... continuing."
scenedef = true
exit
)
else if ((matchpattern o.name pattern:"*asset*" ) == false) then
(
Print "Asset Def not found."
scenedef = false
)
)
if scenedef == false then
(
global addassetdata = attributes assetdata
(
parameters data
(
Asset type:#string
)
)
print "Adding Scene Def"
)
global scenedef = true
sceneattrib = custattributes.getscenedefs()
for o in sceneattrib do
(
if (matchpattern o.name pattern:"*asset*" ) then
(
Print "Asset Def Found... continuing."
scenedef = true
exit
)
else if ((matchpattern o.name pattern:"*asset*" ) == false) then
(
Print "Asset Def not found."
scenedef = false
)
)
if scenedef == false then
(
global addassetdata = attributes assetdata
(
parameters data
(
Asset type:#string
)
)
print "Adding Scene Def"
)
