PDA

View Full Version : Custom Attributes on XRef Scenes


Gravey
10-21-2008, 05:06 AM
i'm trying to assign custom attributes to xref scenes which I can do BUT each def is not unique... I tried searched the forum and found this thread (http://forums.cgsociety.org/showthread.php?f=98&t=669801&highlight=custom+attribute) but it doesn't seem to work for xrefs.
Here's my example code: (
for i = 1 to (xrefs.getXRefFileCount()) do
(
caExe = "attributes controls\n"
caExe += "(\n"
caExe += " parameters xrefParams\n"
caExe += " (\n"
caExe += " param1 type:#float\n"
caExe += " param2 type:#float\n"
caExe += " )\n"
caExe +=")\n"

ca = execute caExe

x = xrefs.getXRefFile i

custAttributes.add x ca
custAttributes.makeUnique x ca
)
-- i have 2 xrefs in my test scene
for i = 1 to (xrefs.getXRefFileCount()) do (xrefs.getXRefFile i).param1 = random 1 100
for i = 1 to (xrefs.getXRefFileCount()) do print (xrefs.getXRefFile i).finger_bend
) I'm using 2009 design x64 with service pack 1

Gravey
10-22-2008, 02:40 AM
can someone at least confirm this please.

Also assigning a custom attribute to the rootNode appears to assign it to any xrefs as well.

Kramsurfer
10-22-2008, 06:06 PM
Yup... they react different....

(
caExe = "attributes controls
(
parameters xrefParams
(
param1 type:#float
param2 type:#float
)
)\n"
ca = (execute caExe)

for i = 1 to (xrefs.getXRefFileCount()) do
(
x = xrefs.getXRefFile i
x.parent = Box()
custAttributes.add x ca
custAttributes.add x.parent ca
custAttributes.makeUnique x ca baseObject:true
custAttributes.makeUnique x.parent ca baseObject:true
)
-- i have 2 xrefs in my test scene
for i = 1 to (xrefs.getXRefFileCount()) do
(
(xrefs.getXRefFile i).param1 = i*10
(xrefs.getXRefFile i).parent.param1 = i*10
)
for i = 1 to (xrefs.getXRefFileCount()) do
(
print ("Xref:"+(xrefs.getXRefFile i).param1 as string)
print ("Parent:"+(xrefs.getXRefFile i).parent.param1 as string)
)
)

result:

"Xref:20.0"
"Parent:10.0"
"Xref:20.0"
"Parent:20.0"

Gravey
10-23-2008, 11:22 AM
thanks for confirming. It's a PITA but i guess I'll have to store my data on a hidden dummy object unless anyone has any suggestions?

Kramsurfer
10-23-2008, 04:52 PM
yeah, it's where I've got mine... a dummy on the Xref .parent, which is the "binding" item in the Xref scene dialog.

CGTalk Moderation
10-23-2008, 04:52 PM
This thread has been automatically closed as it remained inactive for 12 months. If you wish to continue the discussion, please create a new thread in the appropriate forum.