4 Replies Latest reply: Jun 30, 2010 3:46 AM by dheeraj_c RSS

    Confusion with PF_Cmd_SEQUENCE_FLATTEN command.

    dheeraj_c Community Member

      Hi,

                I'm very confused with PF_Cmd_SEQUENCE_FLATTEN command. In the documentation it's mentioned that this is sent when saving and duplicating a sequence. When I duplicate my custom effect FLATTEN is sent. But my confusion here is this command is sent for the old effect which is being duplicated or for new duplicated effect?

       

      Please consider what I'm doing. Please let me know in case the explanation is not enough:

       

      I store an int in the sequence data. And for each effect i keep  incrementing it.

       

      1. I add a layer. Then I add 2 custom effects with sequence data 1 & 2 respectively.

      2. Now I duplicate the layer. PF_Cmd_SEQUENCE_FLATTEN command is sent. I increment the sequence data. It's called two times for 2 custom effects. Data is 3 & 4 respectively for 2 new duplicated effects.

       

      But the problem is that now the effects in the first layer and the second layer, both have same sequence data. i.e. 3 & 4 respectively and not 1, 2, 3 & 4.

       

      This can happen if the FLATTEN command is sent to the old effect before duplicating. This is my guess as both the layer effects have updated IDs.

       

      Any ideas?

       

      Thanks,

      Dheeraj.

        • 1. Re: Confusion with PF_Cmd_SEQUENCE_FLATTEN command.
          shachar carmi Community Member

          yes, the FLATTEN command is sent to the old effect.

          that's how it should be.

          it tells the effect to collect all it's data and prepare it for storing. (something the new effect doesn't need to do)

           

          both the old and the new effects get the UNFLATTEN command,

          but only the pre-exsiting one gets the FLATTEN call.

           

          if you need to tell the old effect from the new, you have to store some identification of the old effect in the way we've discussed before.

          during unflatening you should check if it's the old effect or the new one, and act accordingly.

          • 2. Re: Confusion with PF_Cmd_SEQUENCE_FLATTEN command.
            dheeraj_c Community Member

            Thanks for the reply Shachar.

             

            shachar carmi wrote:

             


            if you need to tell the old effect from the new, you have to store some identification of the old effect..

             

            But when the effect is duplicated all the data related to it is also duplicated. So even the sequence_data is duplicated. Now how do I know which effect is old and which is new when it comes to SEQUENCE_RESETUP? I'm asking this because for both old and the new duplicated effect, all data will be same.

             

            Thanks for sharing your ideas Shachar.

            • 3. Re: Confusion with PF_Cmd_SEQUENCE_FLATTEN command.
              shachar carmi Community Member

              sooo...

              during the FALTTEN event the effect stores some data about itself:

              i am effect #3 on layerID 1024 in comp itemID 17.

               

              during the UNFLATTEN commnad the effect checks who he is.

              if he is effect #3 on layerID 1024 on comp itemID 17,

              then it must mean it's the old effect.

              if any of the data is different, it means it's the new effect.

               

              there is the possibility that the UNFLATTEN commnad happenes before the effect has it's own new effectRefH,

              so you might want to wait with that check until the first updateParamsUI call.

              • 4. Re: Confusion with PF_Cmd_SEQUENCE_FLATTEN command.
                dheeraj_c Community Member

                Many thanks for explaining clearly Shachar. I will try it out.