Results 1 to 2 of 2

Thread: spec_level

  1. #1
    Junior Member
    Join Date
    Jun 2007
    Posts
    20

    spec_level

    can somebody tell me how to get the "spec_level" from an effect? i've gotten this far (below code, which is not yielding correct results obviously), but can't get the actual float value.

    i'm kind of paraphrasing with the code here...

    daeString typeName = children[j]->getTypeName ();
    daeString elementName = children[j]->getElementName ();
    domAnyRef any = NULL;
    if (!strcmp (typeName, "any"))
    {
    any = *(domAnyRef*)&children[j];
    }

    if (any && !strcmp (elementName, "spec_level"))
    {
    //daeString value = any->getValue ();
    daeMemoryRef memRef = any->getValuePointer ();
    if (memRef)
    {
    effect->spec_level = *memRef;
    }
    }
    Matt

  2. #2
    Senior Member
    Join Date
    Jan 2006
    Location
    Foster City, CA
    Posts
    540
    Once you have the corresponding domAny object you can use getValue to get the element's content. The DOM doesn't know the element is supposed to be a float, so you need to convert it from a string to a float yourself:
    Code :
    #include <sstream>
     
    std::istringstream stream(any->getValue());
    float specLevel;
    stream >> specLevel;

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •