View Full Version : Suggested filter: Insert
HighInBC
25th June 2004, 20:47
right now to insert a clip in the middle I have to do this:
clip = (trim(clip,0,1001)++middle_clip++trim(clip,1002,-1))
what would be a nice little alias would be if I could do this:
clip = Insert(clip,middle_clip,1001)
It is easy to work around the lack of this command, but it would make the script much easier to read if it was like the latter.
Thank, HighInBC
HighInBC
25th June 2004, 21:23
I suppose I could just make a user defined function for inserting... I thought of that after I posted the first message... still it is so basic it should be part of the core package. hehe
function insert(clip clip1,clip clip2,int index)
{
return Trim(clip1,0,index)++clip2++Trim(clip1,(index+1),Framecount(clip1))
} # this should do it
stickboy
26th June 2004, 05:10
Be careful with Trim (http://forum.doom9.org/showthread.php?s=&threadid=58358). In your case, if index is 0, your function will do the wrong thing.
You could just add Assert(index != 0), since it doesn't make a lot of sense to use your function in that situation. On the other hand, I think it would be better style and better practice to make your function as robust and general as possible.
HighInBC
26th June 2004, 19:31
Originally posted by stickboy
Be careful with Trim (http://forum.doom9.org/showthread.php?s=&threadid=58358). In your case, if index is 0, your function will do the wrong thing.
You could just add Assert(index != 0), since it doesn't make a lot of sense to use your function in that situation. On the other hand, I think it would be better style and better practice to make your function as robust and general as possible.
Not familiar with the assert command... I assume it simply causes a failure if the condition is not true... good idea. thanks
vBulletin® v3.8.11, Copyright ©2000-2026, vBulletin Solutions Inc.