Ideally from python api perspective a single new() function would be enough.
Take a look at the 2.4x py api - NewSeq_internal https://svn.blender.org/svnroot/bf-blender/branches/blender2.4/source/blender/python/api2_2x/sceneSequence.c IMHO having a new function like this would be nice, the problem with RNA is you can't have one argument being multiple types which was handy for the 2.4x api. You could use keyword arguments, (omitting 'start' and 'channel' args)... new(type='COLOR', color=(r, g, b)) new(type='IMAGE', length=100) # fill in values after since RNA cant do lists of strings. new(type='MOVIE', filepath="/a/b/c.avi") But I think this should be done carefully, raising exceptions if unused values are set, eg: new(type='COLOR', filepath="/a/b/c.avi") This could end up getting too confusing both from code and script author POV - the docs for .new() for example would mix in different args with "only for *** type" notes. So probably better to have different functions: new_image() new_movie(), new_sound(), new_effect(), new_color(), new_clip() Alternative is not to use RNA at all, Then use the style of arg checking from 2.4x can be used. This is done for bpy.data.libraries.load() - see bpy_library.c - but I think this is not important enough case to make an exception. - Campbell On Tue, Apr 3, 2012 at 8:03 AM, Dan Eicher <[email protected]> wrote: > I've been working on adding scene.sequence_editor.sequences.new() and > was wondering if it'd be preferable to have just one new() function or > multiple for movie_new, image_new, &etc... > > One new function is quite doable with multiple optional parameters but > figured I'd ask before programming a switch statement and then having > to throw all that code away. > > Also, noticed that the clips that get loaded by the sequencer operator > don't get put into bpy.data.movieclips, if this is a bug I can look > into it since at least the sounds get put into bpy.data.sounds so I'm > guessing movies should too. > > Dan > _______________________________________________ > Bf-committers mailing list > [email protected] > http://lists.blender.org/mailman/listinfo/bf-committers -- - Campbell _______________________________________________ Bf-committers mailing list [email protected] http://lists.blender.org/mailman/listinfo/bf-committers
