Maxon Developers Maxon Developers
    • Documentation
      • Cinema 4D Python API
      • Cinema 4D C++ API
      • Cineware 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

    "maxon::GenericData &extraData" is not documented

    Cinema 4D SDK
    2024
    2
    2
    464
    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.
    • kbarK
      kbar
      last edited by kbar

      7b099451-5480-4920-9fe1-d2cb659d150c-image.png

      https://developers.maxon.net/docs/cpp/2024_0_0/class_field_list.html#a5eda84538a58ce0073a3022cb52cfeef

      Is it supposed to be the data returned from calling DirectInitSampling?

      https://www.gamelogicdesign.com
      https://www.plugins4d.com

      ferdinandF 1 Reply Last reply Reply Quote 0
      • ferdinandF
        ferdinand @kbar
        last edited by ferdinand

        Hey @kbar,

        Thank you for reaching out to us and pointing out the missing documentation. I will fix that. In the mean time I would recommend having a look at the Gradient and Field Sampling example in the migration guide, as I did explain the principal changes there.

        In short, extraData is the means with which sampling has been made const. Before, sampling did change the field instance, now the to be mutated data has been separated out into that 'extra data', and you get your extraData when initializing the sampling. In the example I covered Sample, but things translate directly to DirectSample.

        Cheers,
        Ferdinand

        Code from the migration guide:

          iferr_scope;
         
          // #field is a #FieldObject sampled by the #BaseObject #effector. See the full example for details.
         
          // The input location we want to sample and the output data. We are only interested in sampling
          // FIELDSAMPLE_FLAG::VALUE, i.e., the field influence value of the field at point x.
          FieldInput inputs(Vector(0, 50, 0));
          FieldOutput outputs;
          outputs.Resize(inputs.GetCount(), FIELDSAMPLE_FLAG::VALUE) iferr_return;
          FieldOutputBlock outputBlock = outputs.GetBlock();
         
          // Create the field info for sampling the sample data #inputs for the caller #effector.
          const FieldInfo info = FieldInfo::Create(effector, inputs, FIELDSAMPLE_FLAG::VALUE) iferr_return;
         
          // Sample the field. In 2024.0 we now must pass on the extra data generated by the sampling 
          // initialization so that #field can remain const for this operation.
          maxon::GenericData extraData = field->InitSampling(info) iferr_return;
          field->Sample(inputs, outputBlock, info, extraData, FIELDOBJECTSAMPLE_FLAG::NONE) iferr_return;
         
          // Iterate over the output values.
          for (const maxon::Float value : outputBlock._value)
            ApplicationOutput("Sampled value: @", value);
         
          field->FreeSampling(info, extraData);
        

        MAXON SDK Specialist
        developers.maxon.net

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