Revision: 28727 http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=28727 Author: campbellbarton Date: 2010-05-11 21:57:20 +0200 (Tue, 11 May 2010)
Log Message: ----------- Render Branch: svn merge https://svn.blender.org/svnroot/bf-blender/trunk/blender -r28713:28726 Modified Paths: -------------- branches/render25/release/scripts/modules/bpy/utils.py branches/render25/release/scripts/op/presets.py branches/render25/release/scripts/ui/space_userpref.py branches/render25/release/scripts/ui/space_view3d.py branches/render25/source/blender/blenkernel/intern/pointcache.c branches/render25/source/blender/blenlib/BLI_bpath.h branches/render25/source/blender/editors/curve/curve_intern.h branches/render25/source/blender/editors/curve/curve_ops.c branches/render25/source/blender/editors/curve/editcurve.c branches/render25/source/blender/editors/include/ED_curve.h branches/render25/source/blender/editors/space_logic/logic_window.c branches/render25/source/blender/editors/space_view3d/space_view3d.c branches/render25/source/blender/makesdna/DNA_sensor_types.h branches/render25/source/blender/makesrna/intern/rna_actuator.c branches/render25/source/blender/makesrna/intern/rna_object_force.c branches/render25/source/blender/makesrna/intern/rna_sensor.c branches/render25/source/blender/python/intern/bpy.c branches/render25/source/blender/python/intern/bpy_rna.c Modified: branches/render25/release/scripts/modules/bpy/utils.py =================================================================== --- branches/render25/release/scripts/modules/bpy/utils.py 2010-05-11 19:37:17 UTC (rev 28726) +++ branches/render25/release/scripts/modules/bpy/utils.py 2010-05-11 19:57:20 UTC (rev 28727) @@ -27,7 +27,7 @@ import os as _os import sys as _sys -from _bpy import home_paths +from _bpy import home_paths, blend_paths def _test_import(module_name, loaded_modules): @@ -332,3 +332,52 @@ ''' return (_os.path.join(_presets, subdir), ) + + +def smpte_from_seconds(time, fps=None): + ''' + Returns an SMPTE formatted string from the time in seconds: "HH:MM:SS:FF". + + If the fps is not given the current scene is used. + ''' + import math + + if fps is None: + fps = _bpy.context.scene.render.fps + + hours = minutes = seconds = frames = 0 + + if time < 0: + time = -time + neg = "-" + else: + neg = "" + + if time >= 3600.0: # hours + hours = int(time / 3600.0) + time = time % 3600.0 + if time >= 60.0: # mins + minutes = int(time / 60.0) + time = time % 60.0 + + seconds = int(time) + frames= int(round(math.floor( ((time - seconds) * fps)))) + + return "%s%02d:%02d:%02d:%02d" % (neg, hours, minutes, seconds, frames) + + +def smpte_from_frame(frame, fps=None, fps_base=None): + ''' + Returns an SMPTE formatted string from the frame: "HH:MM:SS:FF". + + If the fps and fps_base are not given the current scene is used. + ''' + + if fps is None: + fps = _bpy.context.scene.render.fps + + if fps_base is None: + fps_base = _bpy.context.scene.render.fps_base + + return smpte_from_seconds((frame * fps_base) / fps, fps) + \ No newline at end of file Modified: branches/render25/release/scripts/op/presets.py =================================================================== --- branches/render25/release/scripts/op/presets.py 2010-05-11 19:37:17 UTC (rev 28726) +++ branches/render25/release/scripts/op/presets.py 2010-05-11 19:57:20 UTC (rev 28727) @@ -27,8 +27,8 @@ subclasses must define - preset_values - preset_subdir ''' - bl_idname = "render.preset_add" - bl_label = "Add Render Preset" + bl_idname = "script.add_preset_base" + bl_label = "Add a Python Preset" name = bpy.props.StringProperty(name="Name", description="Name of the preset, used to make the path name", maxlen=64, default="") Modified: branches/render25/release/scripts/ui/space_userpref.py =================================================================== --- branches/render25/release/scripts/ui/space_userpref.py 2010-05-11 19:37:17 UTC (rev 28726) +++ branches/render25/release/scripts/ui/space_userpref.py 2010-05-11 19:57:20 UTC (rev 28727) @@ -624,9 +624,10 @@ col.prop(v3d, "bone_solid") col.prop(v3d, "bone_pose") col.prop(v3d, "edge_seam") + col.prop(v3d, "edge_select") + col.prop(v3d, "edge_facesel") col.prop(v3d, "edge_sharp") col.prop(v3d, "edge_crease") - #col.prop(v3d, "edge") Doesn't seem to work elif theme.theme_area == 'GRAPH_EDITOR': graph = theme.graph_editor @@ -927,18 +928,18 @@ col.prop(prefs, "header_text") elif theme.theme_area == 'CONSOLE': - prefs = theme.console + console = theme.console col = split.column() - col.prop(prefs, "back") - col.prop(prefs, "header") + col.prop(console, "back") + col.prop(console, "header") col = split.column() - col.prop(prefs, "line_output") - col.prop(prefs, "line_input") - col.prop(prefs, "line_info") - col.prop(prefs, "line_error") - col.prop(prefs, "cursor") + col.prop(console, "line_output") + col.prop(console, "line_input") + col.prop(console, "line_info") + col.prop(console, "line_error") + col.prop(console, "cursor") class USERPREF_PT_file(bpy.types.Panel): Modified: branches/render25/release/scripts/ui/space_view3d.py =================================================================== --- branches/render25/release/scripts/ui/space_view3d.py 2010-05-11 19:37:17 UTC (rev 28726) +++ branches/render25/release/scripts/ui/space_view3d.py 2010-05-11 19:57:20 UTC (rev 28727) @@ -523,7 +523,7 @@ layout.operator("curve.select_all", text="Select/Deselect All") layout.operator("curve.select_inverse") layout.operator("curve.select_random") - layout.operator("curve.select_every_nth") + layout.operator("curve.select_nth", text="Every Nth Number of Points") layout.separator() @@ -552,7 +552,7 @@ layout.operator("curve.select_all", text="Select/Deselect All") layout.operator("curve.select_inverse") layout.operator("curve.select_random") - layout.operator("curve.select_every_nth") + layout.operator("curve.select_nth", text="Every Nth Number of Points") layout.separator() Modified: branches/render25/source/blender/blenkernel/intern/pointcache.c =================================================================== --- branches/render25/source/blender/blenkernel/intern/pointcache.c 2010-05-11 19:37:17 UTC (rev 28726) +++ branches/render25/source/blender/blenkernel/intern/pointcache.c 2010-05-11 19:57:20 UTC (rev 28727) @@ -812,23 +812,27 @@ ptcache_file_read(pf, &compressed, 1, sizeof(unsigned char)); if(compressed) { ptcache_file_read(pf, &in_len, 1, sizeof(unsigned int)); - in = (unsigned char *)MEM_callocN(sizeof(unsigned char)*in_len, "pointcache_compressed_buffer"); - ptcache_file_read(pf, in, in_len, sizeof(unsigned char)); - + if(in_len==0) { + /* do nothing */ + } + else { + in = (unsigned char *)MEM_callocN(sizeof(unsigned char)*in_len, "pointcache_compressed_buffer"); + ptcache_file_read(pf, in, in_len, sizeof(unsigned char)); #ifdef WITH_LZO - if(compressed == 1) - r = lzo1x_decompress(in, (lzo_uint)in_len, result, (lzo_uint *)&out_len, NULL); + if(compressed == 1) + r = lzo1x_decompress_safe(in, (lzo_uint)in_len, result, (lzo_uint *)&out_len, NULL); #endif #ifdef WITH_LZMA - if(compressed == 2) - { - size_t leni = in_len, leno = out_len; - ptcache_file_read(pf, &sizeOfIt, 1, sizeof(unsigned int)); - ptcache_file_read(pf, props, sizeOfIt, sizeof(unsigned char)); - r = LzmaUncompress(result, &leno, in, &leni, props, sizeOfIt); + if(compressed == 2) + { + size_t leni = in_len, leno = out_len; + ptcache_file_read(pf, &sizeOfIt, 1, sizeof(unsigned int)); + ptcache_file_read(pf, props, sizeOfIt, sizeof(unsigned char)); + r = LzmaUncompress(result, &leno, in, &leni, props, sizeOfIt); + } +#endif + MEM_freeN(in); } -#endif - MEM_freeN(in); } else { ptcache_file_read(pf, result, len, sizeof(unsigned char)); Modified: branches/render25/source/blender/blenlib/BLI_bpath.h =================================================================== --- branches/render25/source/blender/blenlib/BLI_bpath.h 2010-05-11 19:37:17 UTC (rev 28726) +++ branches/render25/source/blender/blenlib/BLI_bpath.h 2010-05-11 19:57:20 UTC (rev 28727) @@ -29,6 +29,9 @@ /* Based on ghash, difference is ghash is not a fixed size, * so for BPath we dont need to malloc */ +#ifndef BLI_BPATH_H +#define BLI_BPATH_H + struct BPathIteratorSeqData { int totseq; int seq; @@ -72,3 +75,5 @@ void makeFilesRelative(char *basepath, ReportList *reports); void makeFilesAbsolute(char *basepath, ReportList *reports); void findMissingFiles(char *basepath, char *str); + +#endif // BLI_BPATH_H Modified: branches/render25/source/blender/editors/curve/curve_intern.h =================================================================== --- branches/render25/source/blender/editors/curve/curve_intern.h 2010-05-11 19:37:17 UTC (rev 28726) +++ branches/render25/source/blender/editors/curve/curve_intern.h 2010-05-11 19:57:20 UTC (rev 28727) @@ -96,7 +96,7 @@ void CURVE_OT_select_more(struct wmOperatorType *ot); void CURVE_OT_select_less(struct wmOperatorType *ot); void CURVE_OT_select_random(struct wmOperatorType *ot); -void CURVE_OT_select_every_nth(struct wmOperatorType *ot); +void CURVE_OT_select_nth(struct wmOperatorType *ot); void CURVE_OT_switch_direction(struct wmOperatorType *ot); void CURVE_OT_subdivide(struct wmOperatorType *ot); Modified: branches/render25/source/blender/editors/curve/curve_ops.c =================================================================== --- branches/render25/source/blender/editors/curve/curve_ops.c 2010-05-11 19:37:17 UTC (rev 28726) +++ branches/render25/source/blender/editors/curve/curve_ops.c 2010-05-11 19:57:20 UTC (rev 28727) @@ -111,7 +111,7 @@ WM_operatortype_append(CURVE_OT_select_more); WM_operatortype_append(CURVE_OT_select_less); WM_operatortype_append(CURVE_OT_select_random); - WM_operatortype_append(CURVE_OT_select_every_nth); + WM_operatortype_append(CURVE_OT_select_nth); WM_operatortype_append(CURVE_OT_switch_direction); WM_operatortype_append(CURVE_OT_subdivide); Modified: branches/render25/source/blender/editors/curve/editcurve.c =================================================================== --- branches/render25/source/blender/editors/curve/editcurve.c 2010-05-11 19:37:17 UTC (rev 28726) +++ branches/render25/source/blender/editors/curve/editcurve.c 2010-05-11 19:57:20 UTC (rev 28727) @@ -4272,37 +4272,128 @@ RNA_def_boolean(ot->srna, "extend", FALSE, "Extend Selection", "Extend selection instead of deselecting everything first."); } -/********************** select every nth *********************/ +/********************* every nth number of point *******************/ -static int select_every_nth_exec(bContext *C, wmOperator *op) +static int point_on_nurb(Nurb *nu, void *point) { + if (nu->bezt) { + BezTriple *bezt= (BezTriple*)point; + return bezt >= nu->bezt && bezt < nu->bezt + nu->pntsu; + } else { + BPoint *bp= (BPoint*)point; + return bp >= nu->bp && bp < nu->bp + nu->pntsu * nu->pntsv; + } +} + +static void select_nth_bezt(Nurb *nu, BezTriple *bezt, int nth) +{ + int a, start; + + start= bezt - nu->bezt; + a= nu->pntsu; + bezt= nu->bezt + a - 1; + + while (a--) { + if (abs(start - a) % nth) { + select_beztriple(bezt, DESELECT, 1, HIDDEN); @@ Diff output truncated at 10240 characters. @@ _______________________________________________ Bf-blender-cvs mailing list Bf-blender-cvs@blender.org http://lists.blender.org/mailman/listinfo/bf-blender-cvs