Maxon Developers Maxon Developers
    • Documentation
      • Cinema 4D Python API
      • Cinema 4D C++ API
      • Cineware API
      • ZBrush Python API
      • ZBrush GoZ API
      • Code Examples on Github
    • Forum
    • Downloads
    • Support
      • Support Procedures
      • Registered Developer Program
      • Plugin IDs
      • Contact Us
    • Categories
      • Overview
      • News & Information
      • Cinema 4D SDK Support
      • Cineware SDK Support
      • ZBrush 4D SDK Support
      • Bugs
      • General Talk
    • Unread
    • Recent
    • Tags
    • Users
    • Login

    Field Layer Description Names

    Cinema 4D SDK
    c++ r20 macos
    2
    5
    1.2k
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • D
      d_schmidt
      last edited by

      Hello, I'm trying to retrieve the names of the parameters on Field Objects. The following could works when I use it on most other objects, with the ID changed of course. Using it on a Solid Field Layer in the following example it doesn't return a name though. Is there a special way to access descriptions on Field Layers?

      Dan

         AutoAlloc<Description> senderdesc; 
         op->GetDescription(senderdesc, DESCFLAGS_DESC::NONE))
         const BaseContainer *desccontainer = NULL;
         //checking  [c4d.FIELDS,12,1000] the "Value" parameter on a Solid Field Layer 
         desccontainer = senderdesc->GetParameter(parameterID, *testcontainer, descarray);
         String parametername = desccontainer->GetString(DESC_NAME, "" );//trying to get its name, should be returning "Value", bit is instead empty
      1 Reply Last reply Reply Quote 0
      • S
        s_bach
        last edited by

        Hello,

        just to be sure: do you want to access the names of parameters of a Field Object or the names of parameters of a Field Layer in a Field List?

        I presume that op is a pointer to such a Field Layer?

        Using this code it seems to work fine:

        const BaseContainer* parameterSettings = nullptr;
        
        BaseContainer temp;
        AutoAlloc<AtomArray> atomArray;
        
        parameterSettings = layerDescription->GetParameter(FIELDLAYER_SOLID_VALUE, temp, atomArray);
        if (parameterSettings)
        {
        	const String parameterName = parameterSettings->GetString(DESC_NAME, ""_s);
        	ApplicationOutput(parameterName);
        }
        

        Notice that in some cases an object might store different values for DESC_NAME and DESC_SHORT_NAME (see Description Settings Manual).

        If you have issues using GetParameter() you can also use GetParameterI() which might be a bit easier to use. There are also additional functions to iterate over all parameter descriptions stored in a Description object (see Description Manual).

        For posting questions please use the Q&A system.

        best wishes,
        Sebastian

        MAXON SDK Specialist

        Development Blog, MAXON Registered Developer

        D 1 Reply Last reply Reply Quote 2
        • D
          d_schmidt @s_bach
          last edited by

          Hi! Thank you for the response, I'm sorry about the late reply and sorry about posting in the incorrect place.

          I'm trying to get the names of parameters of a Field Layer in a Field List. So Value in a Solid Field Layer, and Shape, Rate, Offset in a Time Field Layer for example.

          Yes, op would be a Field Layer, but I'm actually having a bit of trouble figuring out how to get the Field Layer itself. I'm sure it's something simple but I'm having trouble getting it.

          So if I have a Delay effector, and a Solid Field Layer inside of the Field. How would I get the Field Layer for the Solid Field Layer if I only have the Delay effector and the id [c4d.FIELDS,12] to retrieve it?

          Thanks again,
          Dan

          1 Reply Last reply Reply Quote 0
          • S
            s_bach
            last edited by

            Hello,

            you can obtain the field list from the FIELDS parameter.

            This field list stores a list of layers. You can access the head of that list using GetLayersRoot() (see GeListHead Manual).

            From the head you can obtain the child elements: the Field layer objects.

            Something like this:

            const DescID fieldsID(FIELDS);
            
            GeData effectorData;
            plainEffector->GetParameter(fieldsID, effectorData, DESCFLAGS_GET::NONE);
            
            CustomDataType* const customData = effectorData.GetCustomDataType(CUSTOMDATATYPE_FIELDLIST);
            FieldList* const      fieldList  = static_cast<FieldList*>(customData);
            if (fieldList == nullptr)
              return maxon::UnexpectedError(MAXON_SOURCE_LOCATION);
            
            // get first
            
            GeListHead* const head = fieldList->GetLayersRoot();
            if (head == nullptr)
              return maxon::UnexpectedError(MAXON_SOURCE_LOCATION);
            
            GeListNode* const node = head->GetFirst();
            if (node == nullptr)
              return maxon::UnexpectedError(MAXON_SOURCE_LOCATION);
            
            FieldLayer* const layer = static_cast<FieldLayer*>(node);
            

            See FieldList Manual.

            best wishes,
            Sebastian

            MAXON SDK Specialist

            Development Blog, MAXON Registered Developer

            D 1 Reply Last reply Reply Quote 2
            • D
              d_schmidt @s_bach
              last edited by

              Thank you so much, that's exactly what I needed!

              Dan

              1 Reply Last reply Reply Quote 0
              • First post
                Last post