Assign time track to PLA track



  • On 13/10/2013 at 04:16, xxxxxxxx wrote:

    Hello, could some one please help me with assigning a time track to a PLA track?

    import c4d
      
    def main() :
        obj =        op.GetObject()
        tTrack =     c4d.CTrack(obj, c4d.DescID(c4d.DescLevel(c4d.CTtime)))
        findTrack =  obj.FindCTrack(c4d.DescID(c4d.DescLevel(c4d.CTtime)))
        
        if not findTrack:
            obj.InsertTrackSorted(tTrack)
            findTrack = tTrack
        
        plaTrack = obj.FindCTrack(c4d.DescID(c4d.DescLevel(c4d.CTpla, c4d.CTpla, 0)))
        
        #Trying to assign the time track to the PLA track
        plaTrack[c4d.ID_CTRACK_TIME] = tTrack
        
    if __name__=='__main__':
        main() 
    


  • On 13/10/2013 at 06:30, xxxxxxxx wrote:

    The code is correct. You might want to write more than one line for future questions.



  • On 13/10/2013 at 06:39, xxxxxxxx wrote:

    Thanks littledevil, but the code doesn't seem to be working for me though. The time track field on the PLA track doesn't get filled with the time track. Trying to drag the time track into the time track field while this code is in place does not allow you do to it, so somethings working but just not assigning it correctly? Is it a bug or something I'm doing wrong? Thank you for taking a look.



  • On 13/10/2013 at 07:38, xxxxxxxx wrote:

    Hey,

    I tried it in r14 and it did work for me (the BaseLink was established correctly). Are you sure
    that you have somehow forced a gui update, as your code is missing an EventAdd() ? If it is
    not an update problem, what is the console output for your code?



  • On 13/10/2013 at 08:11, xxxxxxxx wrote:

    Thats really strange it's working fine for you and mine just stays blank. I added the EventAdd and its still not working as I would have hoped. I've tried it in a new scene with new objects but still getting nothing. Frustrating.

    http://i.imgur.com/oHN3eN6.png



  • On 13/10/2013 at 08:30, xxxxxxxx wrote:

    ah ok, it is meant to be an expression, as a tag it is not working either for me.  having the
    entry point statement on the bottom and the obj = op.GetObject() statement on the top
    was a 50/50 chance for script or tag. edit : that also explains the missing EventAdd(), so
    actually it were more things pointing to a tag than a script, however the entry statement is 
    quite misleading ;)

    have you tried to play with the tag priority settings, as this seems to be some sort of priority
    problem ?



  • On 13/10/2013 at 08:57, xxxxxxxx wrote:

    Ah alright so it does work as a script, its a shame the same can't be said with a tag. I have tried playing with the priority of the tag too but to no luck yet. Hopefully someone else has more luck with this? Thanks for helping out littledevil.



  • On 13/10/2013 at 13:12, xxxxxxxx wrote:

    You could run a Command in a:

    def Message(self, myexpressionplugin, type, data) :
    

    block before your def Execute()



  • On 14/10/2013 at 01:56, xxxxxxxx wrote:

    Thanks for your reply tcastudios. Please excuse my novice  talk, but I think you're saying to turn the tag into a plugin and then run the Command (setting the time track into the PLA track) before def Execute() right?



  • On 14/10/2013 at 13:41, xxxxxxxx wrote:

    Ops, yes, as a plugin. I'm not sure if it's valid for an expression.
    I missed you were running an expression.


Log in to reply