Notifications
Clear all

[Closed] SDK-C# Set transform controller value

“&” in &pckt means we should send the pointer not variable, right?

yes in you are passing the memory address of the object… you could also do it like this

SetXFormPacket*  pckt = new SetXFormPacket(destTM);
tmControl->SetValue(ip->GetTime(), pckt);
delete pckt;
 MZ1

So, We can’t do it in C#?

what about…

object setXFormPacket = globalInterface.SetXFormPacket.Create(matrix,globalInterface.Matrix3.Create());
object* ptr = &setXFormPacket ;
node.TMController.SetValue(coreInterface.Time, ptr, true, GetSetMethod.Absolute);
 MZ1

I got several errors for this:
Compiler Error CS0214: Pointers and fixed size buffers may only be used in an unsafe context
Compiler Error CS0208: Cannot take the address of, get the size of, or declare a pointer to a managed type ('object')

 MZ1

“object” type can not be declared as pointer.

could try something like…

  unsafe
    {
        object setXFormPacket = globalInterface.SetXFormPacket.Create(matrix,globalInterface.Matrix3.Create());
        void* ptr = &setXFormPacket ;
        node.TMController.SetValue(coreInterface.Time, ptr, true, GetSetMethod.Absolute);
    }
 MZ1

Not working…

|Error|CS0208|Cannot take the address of, get the size of, or declare a pointer to a managed type 
|Error|CS1503|Argument 2: cannot convert from 'void*' to 'object

which dotnet version do you use? mine is 4.7.2 and “Allow unsafe code” option is enabled.

I’m not using dotnet , just making guesses as I know nothing about c# and max. The only I can think of trying is to create your own c# callable c++ function wrapper to handle it.

 MZ1

it should work, but actually got some errors.

Page 2 / 4