Hi @ferdinand ,
Thanks very much for all of your time and tips!!
Facundo
Posts made by facumh
-
RE: How to access PLA data
-
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
-
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 onObj
in state of time 0.0. On later executions, thedoc->getTime()
is no longer 0.0, and I thought this would mean that the baseObjectObj
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 usingObj
with the current time. This way and checking withkey = 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, FacundoEdit: 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
-
RE: How to access PLA data
hey @ferdinand ,
I did suspect usingobj
for both keys could be the issue, but then how would you suggest I extract the animated spline from the baseDoc ? -
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 -
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 -
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 bothFindCTrack
andCTrack::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 returningnullptr
(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 -
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 -
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 ingeDataCurve
a vector similar toAbsPos
orAbsRot
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. -
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