Restlength not effected by attribute ?

   824   3   1
User Avatar
Member
766 posts
Joined: 4月 2014
Offline
I have a painted attribute with a distance along edges constraint there is a primitive wrangler for the constraint with this code;

if(@Frame > 10){
float inward = @depression;
inward *= fit(@P.y,0,2,1,1.2);
@restlength = inward;
};

Although when the Frame is greater then 10, the painted attribute does not get effected rather the whole object as if the attribute has no effect ?
【T】【C】【S】
User Avatar
Member
2038 posts
Joined: 9月 2015
Offline
Unless you intended your self-created attributes to be other than a float (you haven't specified for example what @depression is so it will be a float by default),

I can't see an issue with the code alone. Perhaps upload a simplified version of your file.
Edited by BabaJ - 2022年11月27日 15:13:04
User Avatar
Member
766 posts
Joined: 4月 2014
Offline
Unless you intended your self-created attributes to be other than a float (you haven't specified for example what @depression is so it will be a float by default),

The @depression attribute is a painted attribute to which I want the @restlength attribute to only have a more stronger effect, rather then only the whole object. The painted areas which have a @depression attribute all have values above 0.

The wangler3 node is where the previous code is placed.
Edited by _Christopher_ - 2022年11月27日 15:49:26

Attachments:
constraint_wrangler3.jpg (28.8 KB)

【T】【C】【S】
User Avatar
Member
131 posts
Joined: 8月 2012
Offline
The way your code is set up, it affects all primitives on the geometry. You should include a filter for "depression" values above a threshold to affect "restlength". For example:

if(@Frame > 10){
if (@depression > chf("threshold")){
float inward = @depression;
inward *= fit(@P.y,0,2,1,1.2);
@restlength = inward;
}}

This way, the areas that are unpainted (which have depression value initialized as 0) will not have their restlength modified by the wrangle.
  • Quick Links