PDA

View Full Version : custom attributes color problem


arcburn
03-03-2009, 09:17 PM
Hey guys,

I have a problem with trying to control the diffuse color of an object with a custom attribute.

This script works correctly until I save the resulting max file. When I reopen the file the custom attribute is no longer connected to the diffuse.

Anyone have any ideas?


sphere()
$sphere01.material = standardmaterial()
ca = attributes colorControls
(
parameters params rollout:LBR
(
LA1 type:#color ui:LA1SP
)

rollout LBR "diffuse controls"
(
colorpicker LA1SP "" fieldwidth:25 height:25 --pos:[5,30]
)
)
select $sphere01
modPanel.addModToSelection (EmptyModifier ()) ui:on
custattributes.add $sphere01.modifiers[1] ca

paramWire.connect2way $sphere01.material[#Shader_Basic_Parameters][#Diffuse_Color] $sphere01.modifiers[#Attribute_Holder].colorControls[#LA1] "LA1" "Diffuse_Color"

ZeBoxx2
03-04-2009, 05:11 AM
seeing as it's a two-way connection, I'm wondering if you're running into this potential generic bug:

http://forums.cgsociety.org/showthread.php?f=98&t=735370 - Garbage Collection Bug?

arcburn
03-04-2009, 07:52 AM
Thanks for the info Zeboxx

To test further I manually used the reaction manager to control the color from my custom attribute.

again saving loses the connection.

Since this is caused in the Paramter wire dialog and the reaction manager, I am now thinking I am doing my custom attribute wrong.

I still dont have a solution.

Zbuffer
03-04-2009, 10:08 AM
Hi,
Any special reason to use wire parameters ?
I'd use the 'on <var> set val do ..." paramblock handler


sphere()
$sphere01.material = standardmaterial()
ca = attributes colorControls
(
parameters params rollout:LBR
(
LA1 type:#color ui:LA1SP
on LA1 set val do ($sphere01.material.diffuse=val)
on LA1 get val do (val = $sphere01.material.diffuse;val)
)
rollout LBR "diffuse controls"
(
colorpicker LA1SP "" fieldwidth:25 height:25 --pos:[5,30]
)
)
select $sphere01
modPanel.addModToSelection (EmptyModifier ()) ui:on
custattributes.add $sphere01.modifiers[1] ca

arcburn
03-04-2009, 04:25 PM
Thanks. But this still gives me the same error. Once I save the file and re-open it. The link is lost. Very strange.

arcburn
03-04-2009, 07:40 PM
Is there a way to reconnect the custom attributes to the material value after reload?

CGTalk Moderation
03-04-2009, 07:40 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.