Accessing HyperNurbs edge weights



  • THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

    On 08/02/2004 at 11:16, xxxxxxxx wrote:

    User Information:
    Cinema 4D Version:   8.500 
    Platform:   Windows  ;   Mac OSX  ; 
    Language(s) :     C++  ;

    ---------
    How to access the HyperNurbs weighting for edges?

    Samir guessed earlier today in a very helpful post that it should be the same as accesing the weights of the points of the edge in question.

    However, this sound a bit weird as there is a huge difference in Cinema itself between points or edges set to 100% respectively.

    Or could/do I have to use sendmodeling to set that?

    Has anybody of you already manipulated edge HN weights?

    Thanks for any insight!

    Kabe



  • THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

    On 10/02/2004 at 15:26, xxxxxxxx wrote:

    Edge weights are stored in the HNData::polyweight array.



  • THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

    On 10/02/2004 at 23:02, xxxxxxxx wrote:

    Ooookay, naming seems a bit odd here IMO ;-)

    Anyway - thanks a lot, that helped tremendously!

    So let me sum it up for anyone who might
    stumble later over this thread using search:

    Pointweights are stored in HN::pointweight

    Edgeweights are stored in HN::polyweight

    Polyweights are not stored as such, but as the combination of Point- and Edgeweights. This is also easy to proof inside Cinema. So if you would like to set the Hypernurbs weight of a polygon, you have to set the weights of all the attaching edges and points instead.

    Kabe



  • THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

    On 20/04/2011 at 08:17, xxxxxxxx wrote:

    Howdy,

    Can someone show some example code of this?

    Adios,
    Cactus Dan



  • THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

    On 28/04/2011 at 04:07, xxxxxxxx wrote:

    Simple example, printing the weights:

      
    Bool MenuTest::Execute(BaseDocument *doc)  
    {  
      BaseObject *op = doc->GetActiveObject();  
      if (!op) return FALSE;  
      
      HNWeightTag *tag = (HNWeightTag* )op->GetTag(Tsds, 0);  
      if (!tag) return FALSE;  
      
      HNData hd;  
      
      if (tag->GetTagData(&hd))  
      {  
          LONG pcnt = *hd.points;  
          LONG vcnt = *hd.polys;  
      
          LONG i=0;  
      
          for (i=0; i<pcnt; i++)  
          {  
              GePrint(LongToString(i)+" point weight: "+RealToString((*hd.pointweight)[i]));  
          }  
      
          for (i=0; i<vcnt; i++)  
          {  
              GePrint(LongToString(i)+" poly weight a: "+RealToString((*hd.polyweight)[i].a));  
              GePrint(LongToString(i)+" poly weight b: "+RealToString((*hd.polyweight)[i].b));  
              GePrint(LongToString(i)+" poly weight c: "+RealToString((*hd.polyweight)[i].c));  
              GePrint(LongToString(i)+" poly weight d: "+RealToString((*hd.polyweight)[i].d));  
          }  
      }  
      
      return TRUE;  
    }  
    

    cheers,
    Matthias



  • THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

    On 28/04/2011 at 07:55, xxxxxxxx wrote:

    Howdy,

    Thanks Matthias. That fixed the crash. Can you explain the significance of the double "**" in the HNData structure?

    But, now I have another question: How would I assign values to the array?

    Adios,
    Cactus Dan



  • THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

    On 28/04/2011 at 08:07, xxxxxxxx wrote:

    Originally posted by xxxxxxxx

    Can you explain the significance of the double "**" in the HNData structure?

    But, now I have another question: How would I assign values to the array?

    It's a pointer to an array. To access the array you have to dereference its array elements with the * oparator.

    To assign a value do something like this:

    (*hn.pointweight)[i] = myvalue
    

    cheers,
    Matthias



  • THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

    On 28/04/2011 at 08:16, xxxxxxxx wrote:

    Howdy,

    OK, thanks again, Matthias. 😉

    Adios,
    Cactus Dan


Log in to reply