home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #30 / NN_1992_30.iso / spool / comp / sys / sgi / 18128 < prev    next >
Encoding:
Text File  |  1992-12-16  |  1.9 KB  |  58 lines

  1. Newsgroups: comp.sys.sgi
  2. Path: sparky!uunet!zaphod.mps.ohio-state.edu!saimiri.primate.wisc.edu!sdd.hp.com!think.com!spool.mu.edu!yale.edu!jvnc.net!nj.nec.com!brad
  3. From: brad@research.nj.nec.com (Brad Gianulis)
  4. Subject: Re: Inventor Question
  5. Message-ID: <1992Dec17.025040.2312@research.nj.nec.com>
  6. Originator: brad@eames
  7. Sender: news@research.nj.nec.com
  8. Organization: NEC Research Institute
  9. References: <1992Dec16.162928.16505@erenj.com> <1go6veINN40j@fido.asd.sgi.com>
  10. Date: Thu, 17 Dec 92 02:50:40 GMT
  11. Lines: 45
  12.  
  13. In article <1go6veINN40j@fido.asd.sgi.com> gavin@krypton.asd.sgi.com (Gavin Bell) writes:
  14. >In <1992Dec16.162928.16505@erenj.com> ram@ramsgi.erenj.com (ram rajagopalan) writes:
  15. >> This may be a really stupid question,  but here it is.  I am in the 
  16. >> process of learning inventor, and I am trying to set the value for
  17. >> the fields in the nodes.  I get a compile time error in attempting
  18. >> to do this.  Any pointers would be appreciated.  Code segment follows.
  19. >> I am using the C binding ...
  20. >>  SoCmplx      *sph_cmplx;
  21. >>  sph_cmplx = SoCmplxCreate();
  22. >>  sph_cmplx->value = 0.25;
  23. >
  24. >Ah.  sph_cmplx->values is a field of type SoSFFloat, not a regular
  25. >'float'.  The compiler is complaining because you are trying to assign
  26. >a float to an SoSFFloat.  When you set a field's value, Inventor does
  27. >some extra stuff so that data sensors will notice the change and fire.
  28. >
  29. >So, in C, you have to call a method to set a field's value; your code
  30. >should look like:
  31. >
  32. >SoSFloatSet(&sph_cmplx->value, 0.25);
  33. >
  34. >In C++, Inventor 'overloads' the '=' function to essentially do this
  35. >for you automatically.
  36. >
  37. >
  38. >
  39. >--
  40. >--gavin     (gavin@sgi.com,  (415)390-1024)
  41.  
  42.  
  43. So, Gavin, in C++, wouldn't that be:
  44.  
  45.     sph_cmplx->value.setValue( 0.25 );
  46.  
  47.  
  48. (I'm learning Inventor (and C++), too. and just want to make sure I got
  49. it right).
  50.  
  51.  
  52.  
  53. Brad Gianulis
  54. NEC Research Institute
  55. Princeton, NJ
  56. (609) 951-2776
  57. brad@research.nj.nec.com
  58.