Skip navigation
squirrelundo
Currently Being Moderated

Sequence Data with Copy/Paste

Dec 13, 2011 11:14 AM

My effect plugin is implementing sequence data to save and retrieve a string just like the PathMaster example. In fact, the code is pretty much cut and paste from that example. Everything works fine for saving and opening a file but when copying and pasting the effect it seems that I am getting corrupt data for the flattened sequence data. I see that AE is making the following calls in order:

 

PF_Cmd_SEQUENCE_FLATTEN

PF_Cmd_SEQUENCE_RESETUP

PF_Cmd_SEQUENCE_RESETUP

PF_Cmd_SEQUENCE_RESETUP

 

It is on the third PF_Cmd_SEQUENCE_RESETUP that the sequence_data is not correct. I have seen similar posts to this issue however it has never been answered.

 

Any help would be appreciated.

  • Currently Being Moderated
    Community Member
    Dec 13, 2011 11:34 AM

    i don't know what you're doing wrong, so let's just make sure we know what's happening in each step.

     

    when you hit copy AE asks you to flatten your data, so it can be moved.

    after the flattening is done, it asks you to unflatten your data for the existing instance so it can be used.

    it asks for you to unflatten again, but this time for the copy held in the clipboard.

    for that copy, you're requested to allocate a new handle for your sequence data, as the two instances (the one on the layer and the one on the clipboard) don't share the same sequence_data handle.

     

    i think that you get the third resetup call after you paste the instance in the clipboard, but i'm not sure about that.

    in any case, if you didn't create a new sequence_data handle for the new instance, then you'll either get an invalid handle, or a handle that this new instance doesn't own.

    crash, burn, screams, horror.

     

    is that the case? or are you allocating new handles during PF_Cmd_SEQUENCE_RESETUP?

    |
    Mark as:
  • Currently Being Moderated
    Community Member
    Dec 13, 2011 12:29 PM

    hmmm. it seems you're allocating new data on each round.

     

    i'm not sure about that, but shouldn't you release/dispose of the flat handle after successfully unflattening it?

     

    anyways:

    1. can you tell which instance gets the last call? (the original or the copy)

    2. keep track of the memory address of the sequence_data you provide at the end of the flatten call.

    i want to see if the corrupt handle is a random address or the original address corrupted.

    |
    Mark as:
  • Currently Being Moderated
    Community Member
    Dec 13, 2011 2:02 PM

    Hey,

        if(in_data->sequence_data)

        {

            Flat_Seq_Data*    flatP = static_cast<Flat_Seq_Data*>(suites.HandleSuite1()->host_lock_handle(i n_data->sequence_data));

     

            if(flatP)

            {

                PF_Handle unflat_seq_dataH = suites.HandleSuite1()->host_new_handle(sizeof(Unflat_Seq_Data));

     

     

    are you sure that it is always flat? sequence_data may also be unflat during resetup. The sdk guide recommends to use a flag at the same offset.

    see "FLATTENED AND UNFLATTENED SEQUENCE DATA" section!

     

    also a tip: create a class to lock handles using smart pointers with a custom deleter

     

    greets

    |
    Mark as:
  • Currently Being Moderated
    Community Member
    Dec 13, 2011 3:58 PM

    i don't see why this whole problem should occur...

    i need to run a test and see what calls i'm getting.

    hopefully tomorrow i get around to it.

    let me know if you reach new conclusions in the mean time!

    |
    Mark as:
  • Currently Being Moderated
    Community Member
    Dec 14, 2011 10:36 AM

    phew...

    i was about to check my plug-ins to see if i'm getting the same problem.

    you posted the solution just in time!

     

    i'm glad you sorted that out.

    and thanks to mike basil for pointing in the right direction!

    |
    Mark as:
  • Currently Being Moderated
    Community Member
    Dec 14, 2011 1:40 PM

    @sharchar

    hey, well happy to tag along

     

    @squirrel

    in the case of resetup with unflat data - i just delete an old handle and create a new one, saving/restoring the necessary data accordingly.

    Cannot recall now if necessary though - try it if you have problems when sequence data is not changed.

     

    greets

    |
    Mark as:

More Like This

  • Retrieving data ...

Bookmarked By (0)

Legend

  • Correct Answers - 10 points
  • Helpful Answers - 5 points