PriorityData [SOLVED]

On 18/04/2015 at 00:14, xxxxxxxx wrote:

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

In converting a plugin to C++ I'm looking to set data. I found that I could use SetParameter to do so in C++, but one type of data doesn't seem to work like this, when I do this code:

AutoAlloc<PriorityData> priority;  
              priority->SetPriorityValue(PRIORITYVALUE_MODE, CYCLE_EXPRESSION);  
              priority->SetPriorityValue(PRIORITYVALUE_PRIORITY, 1);  
              conCnstTag->SetParameter(DescID(EXPRESSION_PRIORITY), GeData(priority), DESCFLAGS_SET_0);  

it fails to compile. Apparently GeData can't handle setting ProrityData?

On 20/04/2015 at 07:10, xxxxxxxx wrote:


could you please share the compile errors with us?

PriorityData does not provide access to it's constructor and doesn't have static Alloc() and Free() functions. So it is not possible to use AutoAlloc with that class.

So you have to edit the existing data. If you want to change a parameter on an object simply access that parameter with GetParameter() and get the custom datatype with GetCustomDataType(). Then you can edit the PriorityData and use SetParameter() to set the new value.

You find an example on how to do this in the "Look at Camera" plugin in the SDK.

Best wishes,

On 20/04/2015 at 20:29, xxxxxxxx wrote:

Thanks, that worked out. I spend days looking up this stuff sometimes. Even with the search functions in the C++ docs the relations between things just don't really come together sometimes. I guess it also doesn't help that on occasion the way something is done in Python in C4D is totally different from the C++ version in name and function. Thanks again for the answers.