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
    1. Maxon Developers Forum
    2. facumh
    3. Posts
    F
    • Profile
    • Following 0
    • Followers 0
    • Topics 1
    • Posts 10
    • Best 0
    • Controversial 0
    • Groups 0

    Posts made by facumh

    • RE: How to access PLA data

      Hi @ferdinand ,
      Thanks very much for all of your time and tips!!
      Facundo

      posted in Cinema 4D SDK
      F
      facumh
    • RE: How to access PLA data

      Hi @ferdinand ,
      thanks for the tip of using Record Active Element.
      On one hand I couldn't find the command id on the sdk website.
      On the other hand, playing around with the RAE and the spline, I realized that whenever the active element is the spline and I press play, it doesn't move, but when it is not the active element, and I press play, then the animation moves. I'm using a rope expresion tag to animate it and rope belt tag to fixate one end of the spline.
      This behaviour of the spline not moving when it's the active element would explain why I always get the same points on the different keys, even when the animation moves. But could you maybe explain this behaviour ?

      Cheers, Facundo

      posted in Cinema 4D SDK
      F
      facumh
    • RE: How to access PLA data

      hey @ferdinand ,
      sorry I should have explained a little more. So the first time this function is executed, there are no tracks, so I create the track and first key, based on Obj in state of time 0.0. On later executions, the doc->getTime() is no longer 0.0, and I thought this would mean that the baseObject Obj would also have the point of the spline in this new time, and since now there is already a track, I create the new key using Obj with the current time. This way and checking with key = curve->FindKey(time) and checking that it's not null, I make sure to not replicate keys with the same time hence (I thought), not two keys with the same state of `Obj.

      Thanks for your time and patience with all my doubts.
      Cheers, Facundo

      Edit: sorry, not sure if it's clear, but what want is the position of the spline points in different moments of the animation and I thought with the pla tracks and keys this info could be retrieveed

      posted in Cinema 4D SDK
      F
      facumh
    • RE: How to access PLA data

      hey @ferdinand ,
      I did suspect using objfor both keys could be the issue, but then how would you suggest I extract the animated spline from the baseDoc ?

      posted in Cinema 4D SDK
      F
      facumh
    • RE: How to access PLA data

      Hey @ferdinand,
      in my second comment you can see how I create the keys, programmaticallly. I know it's hard without the whole code, but so far this has being very educational for me as well, just wanted to thank you for that as well.
      Cheers, Facundo

      posted in Cinema 4D SDK
      F
      facumh
    • RE: How to access PLA data

      hey @ferdinand,
      thanks for all the help. This code was very helpful, but I still get the same points, from different keys even if I create them with different times. Which makes me wonder if maybe I am creating them with the wrong parameters. I also tried using just one key and moving frame by frame, but still the points from the pointTag remained always the same.
      Cheers, Facundo

      posted in Cinema 4D SDK
      F
      facumh
    • RE: How to access PLA data

      Hey ferdinand,
      unfortunately I can not share the whole code, since it is a large and complex project. But hopefully with these small fractions you can help me identify where is the mistake.
      Firstly, as you correctly guessed the plugin hook is an ObjectData.

      As for the mistake of using CTpla for the second argument of DescLevel, that is shows in the CTrack Manual, maybe a comment could be added whether that for an outdated version of the SDK, or something else.

      Thirdly, I've made the change you suggested to the parameters to getting plaID, but now both FindCTrack and CTrack::Alloc( obj, plaID ); are returning null. The first one is expected since on the first time executing this part of the code there shouldn't be any tracks but I find it odd that the Alloc is also returning nullptr (I've checked that there is plenty of memory on the system, so at least that is not the case).

      Alternatively, if I use CTpla in both parameters (they way it's suggeested on the CTrack Manual), I noticed that when calling CCurve* curve = plaTrack->GetCurve(); I get a non-nullptr back, but the underlying base2Dobject, is nullptr, is this also expected?

      Thanks for your time and response.
      Cheers,
      Facundo

      posted in Cinema 4D SDK
      F
      facumh
    • RE: How to access PLA data

      Hi Ferdinand,
      Thanks for taking the time to reply. I did not expect you to write compilable code, simply to help fill the gaps in my knowledge of the API, which you have done wonderfully. I will take a look at all the reading material you have suggested and take your comments into account when further writing plugin code.
      Cheers, Facundo

      posted in Cinema 4D SDK
      F
      facumh
    • RE: How to access PLA data

      Hello Ferdinand, I was not sure whether to make a new thread or comment on the old one. thanks for taking time to do this and respond.
      SDK 2023 and/or 2024 (I'm not sure how much they differ in this section), plugin hook ::Compute( BaseObject* mod, BaseDocument* doc, BaseObject* op, BaseThread* bt, BaseObject* cacheNode ).

      I basically tried something similar to what was shown in the python code

      auto const time = doc->GetTime();
      const DescID plaID = DescLevel( CTpla, CTpla, 0 );
      CTrack* plaTrack = obj->FindCTrack( plaID );
      if( plaTrack == nullptr )
      {
      	plaTrack = CTrack::Alloc( obj, plaID );
      	if( plaTrack == nullptr )
      		throw maxon::OutOfMemoryError( MAXON_SOURCE_LOCATION );
      	obj->InsertTrackSorted( plaTrack );
      	CCurve* curve1 = plaTrack->GetCurve();
      	if( curve1 == nullptr )
      		throw maxon::UnexpectedError( MAXON_SOURCE_LOCATION );
      	// set first key
      	CKey* const key1 = curve1->AddKey( BaseTime( 0.0 ) );
      	if( key1 == nullptr )
      		throw maxon::OutOfMemoryError( MAXON_SOURCE_LOCATION );
      	plaTrack->FillKey( doc, obj, key1 );
      }
      // set second key
      CCurve* curve = plaTrack->GetCurve();
      auto animatedParams = curve->GetInfo();
      CKey* const key2 = curve->AddKey( time );
      if( key2 == nullptr )
      		throw maxon::OutOfMemoryError( MAXON_SOURCE_LOCATION );
      plaTrack->FillKey( doc, obj, key2 );
      GeData curveParams;
      auto foundParams = curve->GetParameter( plaID, curveParams, DESCFLAGS_GET::NONE );
      auto geDataCurve = key2->GetGeData();
      

      With this I expected to find either in curveParams or in geDataCurve a vector similar to AbsPos or AbsRot from SplineObject, but the former only has zeros in all fields, and the later has values that seem to be unintialized memory, or wrongly typed.

      What I want to obtain, much like in the other thread, is the position/rotation of the spline during the animation.
      Since I'm new in this topic, maybe there is an easiere way of obtaining this information, but if that is the case I did not find it in the SDK doc.

      Thanks for your help and time,
      Cheers, Facundo.

      posted in Cinema 4D SDK
      F
      facumh
    • How to access PLA data

      Hello, I'm not sure if this is the correct place for this question, but what would be the correct way of doing this with the C++ SDK, instead of a python script?
      Thanks, Facundo


      forked from get spline points positions from pla keyframes by @ferdinand

      posted in Cinema 4D SDK c++
      F
      facumh