magneto Posted September 13, 2012 Share Posted September 13, 2012 Hi, I noticed the AttribCreate SOP doesn't allow using expressions in the Default parameter. Is it really like this? Because the error message says "bad data type", and the help doesn't mention this. I assume this is done for optimization where Houdini assigns a single value to everything else at once that will get the default attribute value? Is there a way to accomplish this? Thanks 1 2 Quote Link to comment Share on other sites More sharing options...
Annon Posted September 13, 2012 Share Posted September 13, 2012 But if you want to write a dynamic attribute, which is what you want to do, why don't you just put it in the "write values" fields. I don't see what benefit you're going to get by putting the same expression in the default fields. Basically I only ever use the default fields when I turn "write values" off, which is sometimes needed to stop warnings that the attribute doesn't exist in SopSolver stuff or attribute transfer. C Quote Link to comment Share on other sites More sharing options...
magneto Posted September 13, 2012 Author Share Posted September 13, 2012 Thanks, but I am not using the same expression in both. I want to use an expression for the actual attribute value for my Group, and use another expression for everything else. I can do it using 2 AttribCreate nodes but I thought I could do it with one using the Default parameter. Quote Link to comment Share on other sites More sharing options...
Annon Posted September 13, 2012 Share Posted September 13, 2012 I would have thought that it would do everything it does on the group specified. So even if it did work, the default attribute would be on the group and everything else zero. I've been through that mindset before with having to use two promotes to get max value and wrote it in Python as one node, which ended up being slower Best to just use two nodes and not let it bother you. Quote Link to comment Share on other sites More sharing options...
magneto Posted September 13, 2012 Author Share Posted September 13, 2012 No the Default actually applies everything else except the group if the attribute doesn't exist I think. It cannot apply to what's inside the group, a Value does that. So group half of a Grid and then apply an AttribCreate with Cd. Set Value to either rand($PT) for red, or just red for instance. Then set the Default to Blue. You will see the other half outside the group will be Blue. I just thought since I can dictate what to use for entities that doesn't have an attribute and outside the group, I could use expressions. It's ok though, mine was just curiosity. Quote Link to comment Share on other sites More sharing options...
graham Posted September 13, 2012 Share Posted September 13, 2012 (edited) You can have an expression in the Default field, but it cannot make reference to a currently iterating element since the default is a constant value across the history of the attribute. An attribute's default value is defined once for the attribute on creation. You can think of it like creating an attribute and setting all elements to that Default value. When you then have something in the Value parameter and possibly in the group parameter, you basically then tell Houdini to set those elements to your new value. The default really comes into play when you add additional elements to your geometry. In your example above, if you then take another grid with no Cd attribute and merge it into your colored grid, you will see the grid turn blue. This is because the default value of the attribute is applied to the new geometry because it needs to have an attribute value now that it is part of the same detail. Edited September 13, 2012 by graham 1 Quote Link to comment Share on other sites More sharing options...
magneto Posted September 13, 2012 Author Share Posted September 13, 2012 Thanks Graham, that was my impression as well. Didn't know I could use plain expressions without referring to the currently iterating element though Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.