Merging r47581 through r47603 from trunk into soc-2011-tomato
authorSergey Sharybin <sergey.vfx@gmail.com>
Fri, 8 Jun 2012 09:36:17 +0000 (09:36 +0000)
committerSergey Sharybin <sergey.vfx@gmail.com>
Fri, 8 Jun 2012 09:36:17 +0000 (09:36 +0000)
95 files changed:
intern/guardedalloc/intern/mallocn.c
intern/raskter/raskter.c
release/datafiles/clkernelstoh.py [new file with mode: 0755]
release/scripts/startup/bl_ui/space_clip.py
release/scripts/startup/bl_ui/space_sequencer.py
source/blender/blenkernel/BKE_mask.h
source/blender/blenkernel/intern/image.c
source/blender/blenkernel/intern/mask.c
source/blender/blenkernel/intern/seqeffects.c
source/blender/blenkernel/intern/sequencer.c
source/blender/blenloader/intern/readfile.c
source/blender/compositor/COM_defines.h
source/blender/compositor/intern/COM_ExecutionGroup.cpp
source/blender/compositor/intern/COM_ExecutionGroup.h
source/blender/compositor/intern/COM_ExecutionSystem.cpp
source/blender/compositor/intern/COM_ExecutionSystem.h
source/blender/compositor/intern/COM_Node.cpp
source/blender/compositor/intern/COM_Node.h
source/blender/compositor/intern/COM_NodeOperation.cpp
source/blender/compositor/intern/COM_NodeOperation.h
source/blender/compositor/intern/COM_OpenCLDevice.cpp
source/blender/compositor/intern/COM_WorkScheduler.cpp
source/blender/compositor/nodes/COM_BlurNode.cpp
source/blender/compositor/nodes/COM_BokehBlurNode.cpp
source/blender/compositor/nodes/COM_BokehImageNode.cpp
source/blender/compositor/nodes/COM_ChannelMatteNode.cpp
source/blender/compositor/nodes/COM_ChromaMatteNode.cpp
source/blender/compositor/nodes/COM_ColorCurveNode.cpp
source/blender/compositor/nodes/COM_ColorMatteNode.cpp
source/blender/compositor/nodes/COM_CompositorNode.cpp
source/blender/compositor/nodes/COM_DifferenceMatteNode.cpp
source/blender/compositor/nodes/COM_DistanceMatteNode.cpp
source/blender/compositor/nodes/COM_FilterNode.cpp
source/blender/compositor/nodes/COM_ImageNode.cpp
source/blender/compositor/nodes/COM_LuminanceMatteNode.cpp
source/blender/compositor/nodes/COM_MixNode.cpp
source/blender/compositor/nodes/COM_MovieClipNode.cpp
source/blender/compositor/nodes/COM_OutputFileNode.cpp
source/blender/compositor/nodes/COM_RenderLayersNode.cpp
source/blender/compositor/nodes/COM_SplitViewerNode.cpp
source/blender/compositor/nodes/COM_TextureNode.cpp
source/blender/compositor/nodes/COM_ViewerNode.cpp
source/blender/compositor/operations/COM_BokehBlurOperation.cpp
source/blender/compositor/operations/COM_BokehBlurOperation.h
source/blender/compositor/operations/COM_ColorCurveOperation.cpp
source/blender/compositor/operations/COM_ColorCurveOperation.h
source/blender/compositor/operations/COM_CompositorOperation.h
source/blender/compositor/operations/COM_MaskOperation.cpp
source/blender/compositor/operations/COM_OpenCLKernels.cl
source/blender/compositor/operations/COM_OpenCLKernels.cl.cpp [deleted file]
source/blender/compositor/operations/COM_OpenCLKernels.cl.h [new file with mode: 0644]
source/blender/compositor/operations/COM_OutputFileOperation.h
source/blender/compositor/operations/COM_PreviewOperation.cpp
source/blender/compositor/operations/COM_PreviewOperation.h
source/blender/compositor/operations/COM_ViewerBaseOperation.cpp
source/blender/compositor/operations/COM_ViewerBaseOperation.h
source/blender/compositor/operations/COM_WriteBufferOperation.cpp
source/blender/compositor/operations/COM_WriteBufferOperation.h
source/blender/editors/include/ED_anim_api.h
source/blender/editors/include/UI_resources.h
source/blender/editors/interface/resources.c
source/blender/editors/mask/mask_add.c
source/blender/editors/mask/mask_draw.c
source/blender/editors/mask/mask_edit.c
source/blender/editors/mask/mask_relationships.c
source/blender/editors/mesh/editmesh_knife.c
source/blender/editors/object/object_modifier.c
source/blender/editors/sculpt_paint/paint_hide.c
source/blender/editors/sculpt_paint/sculpt.c
source/blender/editors/space_clip/tracking_ops.c
source/blender/editors/space_node/drawnode.c
source/blender/editors/space_outliner/outliner_tools.c
source/blender/editors/space_sequencer/sequencer_add.c
source/blender/editors/space_sequencer/sequencer_draw.c
source/blender/editors/space_sequencer/sequencer_intern.h
source/blender/editors/space_sequencer/sequencer_ops.c
source/blender/editors/space_sequencer/sequencer_select.c
source/blender/editors/space_sequencer/space_sequencer.c
source/blender/makesdna/DNA_action_types.h
source/blender/makesdna/DNA_mask_types.h
source/blender/makesdna/DNA_node_types.h
source/blender/makesdna/DNA_sequence_types.h
source/blender/makesdna/DNA_userdef_types.h
source/blender/makesrna/RNA_access.h
source/blender/makesrna/RNA_enum_types.h
source/blender/makesrna/intern/rna_cloth.c
source/blender/makesrna/intern/rna_mask.c
source/blender/makesrna/intern/rna_nodetree.c
source/blender/makesrna/intern/rna_nodetree_types.h
source/blender/makesrna/intern/rna_sequencer.c
source/blender/makesrna/intern/rna_sequencer_api.c
source/blender/modifiers/intern/MOD_smooth.c
source/blender/nodes/composite/nodes/node_composite_bokehblur.c
source/blender/nodes/composite/nodes/node_composite_mask.c
source/blender/windowmanager/intern/wm_operators.c

index cad0e549060e4665076f248fcbaaff91971df6e7..f1a83583715ea0b4c31ca6fa7db36e00ce50d7dd 100644 (file)
@@ -290,7 +290,9 @@ static void make_memhead_header(MemHead *memh, size_t len, const char *str)
        memt->tag3 = MEMTAG3;
        
        addtail(membase, &memh->next);
-       if (memh->next) memh->nextname = MEMNEXT(memh->next)->name;
+       if (memh->next) {
+               memh->nextname = MEMNEXT(memh->next)->name;
+       }
        
        totblock++;
        mem_in_use += len;
@@ -681,8 +683,12 @@ static void addtail(volatile localListBase *listbase, void *vlink)
 {
        struct localLink *link = vlink;
 
+       /* for a generic API error checks here is fine but
+        * the limited use here they will never be NULL */
+#if 0
        if (link == NULL) return;
        if (listbase == NULL) return;
+#endif
 
        link->next = NULL;
        link->prev = listbase->last;
@@ -696,8 +702,12 @@ static void remlink(volatile localListBase *listbase, void *vlink)
 {
        struct localLink *link = vlink;
 
+       /* for a generic API error checks here is fine but
+        * the limited use here they will never be NULL */
+#if 0
        if (link == NULL) return;
        if (listbase == NULL) return;
+#endif
 
        if (link->next) link->next->prev = link->prev;
        if (link->prev) link->prev->next = link->next;
index 26fec52dc808aba4045b2f6d756e211c5e5a8a16..081a7c6bdbd825bf57cd269d25cb466d2e6009ea 100644 (file)
@@ -170,7 +170,7 @@ static void preprocess_all_edges(struct r_fill_context *ctx, struct poly_vert *v
  * for speed, but waiting on final design choices for curve-data before eliminating data the DEM code will need
  * if it ends up being coupled with this function.
  */
-int rast_scan_fill(struct r_fill_context *ctx, struct poly_vert *verts, int num_verts)
+static int rast_scan_fill(struct r_fill_context *ctx, struct poly_vert *verts, int num_verts)
 {
        int x_curr;                 /* current pixel position in X */
        int y_curr;                 /* current scan line being drawn */
@@ -189,7 +189,8 @@ int rast_scan_fill(struct r_fill_context *ctx, struct poly_vert *verts, int num_
         * If the number of verts specified to render as a polygon is less than 3,
         * return immediately. Obviously we cant render a poly with sides < 3. The
         * return for this we set to 1, simply so it can be distinguished from the
-        * next place we could return, /home/guest/blender-svn/soc-2011-tomato/intern/raskter/raskter.cwhich is a failure to allocate memory.
+        * next place we could return, /home/guest/blender-svn/soc-2011-tomato/intern/raskter/raskter.
+        * which is a failure to allocate memory.
         */
        if (num_verts < 3) {
                return(1);
@@ -384,8 +385,8 @@ int rast_scan_fill(struct r_fill_context *ctx, struct poly_vert *verts, int num_
 int PLX_raskterize(float (*base_verts)[2], int num_base_verts,
                    float *buf, int buf_x, int buf_y)
 {
-       int i;                                       /* i: Loop counter. */
-       struct poly_vert *ply;                       /* ply: Pointer to a list of integer buffer-space vertex coordinates. */
+       int i;                                   /* i: Loop counter. */
+       struct poly_vert *ply;                   /* ply: Pointer to a list of integer buffer-space vertex coordinates. */
        struct r_fill_context ctx = {0};
 
        /*
@@ -426,9 +427,9 @@ int PLX_raskterize(float (*base_verts)[2], int num_base_verts,
  * for speed, but waiting on final design choices for curve-data before eliminating data the DEM code will need
  * if it ends up being coupled with this function.
  */
-int rast_scan_feather(struct r_fill_context *ctx,
-                      float (*base_verts_f)[2], int num_base_verts,
-                      struct poly_vert *feather_verts, float (*feather_verts_f)[2], int num_feather_verts)
+static int rast_scan_feather(struct r_fill_context *ctx,
+                             float (*base_verts_f)[2], int num_base_verts,
+                             struct poly_vert *feather_verts, float (*feather_verts_f)[2], int num_feather_verts)
 {
        int x_curr;                 /* current pixel position in X */
        int y_curr;                 /* current scan line being drawn */
diff --git a/release/datafiles/clkernelstoh.py b/release/datafiles/clkernelstoh.py
new file mode 100755 (executable)
index 0000000..8fb5d4e
--- /dev/null
@@ -0,0 +1,70 @@
+#!/usr/bin/python
+# -*- coding: utf-8 -*-
+
+# ***** BEGIN GPL LICENSE BLOCK *****
+#
+# This program is free software; you can redistribute it and/or
+# modify it under the terms of the GNU General Public License
+# as published by the Free Software Foundation; either version 2
+# of the License, or (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software Foundation,
+# Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+#
+# The Original Code is Copyright (C) 2012 Blender Foundation.
+# All rights reserved.
+#
+# Contributor(s): Jeroen Bakker
+#
+# ***** END GPL LICENCE BLOCK *****
+
+# <pep8 compliant>
+
+import sys
+import os
+
+if len(sys.argv) < 2:
+    sys.stdout.write("Usage: clkernelstoh <cl_file>\n")
+    sys.exit(1)
+
+filename = sys.argv[1]
+
+try:
+    fpin = open(filename, "r")
+except:
+    sys.stdout.write("Unable to open input %s\n" % sys.argv[1])
+    sys.exit(1)
+
+if filename[0:2] == "." + os.sep:
+    filename = filename[2:]
+
+cname = filename + ".h"
+sys.stdout.write("Making H file <%s>\n" % cname)
+
+filename = filename.split("/")[-1].split("\\")[-1]
+filename = filename.replace(".", "_")
+
+try:
+    fpout = open(cname, "w")
+except:
+    sys.stdout.write("Unable to open output %s\n" % cname)
+    sys.exit(1)
+
+fpout.write("/* clkernelstoh output of file <%s> */\n\n" % filename)
+fpout.write("const char * clkernelstoh_%s = " % filename)
+
+lines = fpin.readlines()
+for line in lines:
+       fpout.write("\"")
+       fpout.write(line.rstrip())
+       fpout.write("\\n\" \\\n")
+fpout.write("\"\\0\";\n")
+
+fpin.close()
+fpout.close()
index 8f615814f1fa48c6bcf8ec63ee3463face56f964..1cef4624a04b1568ec76a404610a6511daec9588 100644 (file)
@@ -25,7 +25,7 @@ from bpy.types import Panel, Header, Menu
 class CLIP_HT_header(Header):
     bl_space_type = 'CLIP_EDITOR'
 
-    def draw(self, context):
+    def _draw_tracking(self, context):
         layout = self.layout
 
         sc = context.space_data
@@ -41,39 +41,37 @@ class CLIP_HT_header(Header):
             if sc.view == 'CLIP':
                 if clip:
                     sub.menu("CLIP_MT_select")
+                    sub.menu("CLIP_MT_clip")
+                    sub.menu("CLIP_MT_track")
+                    sub.menu("CLIP_MT_reconstruction")
+                else:
+                    sub.menu("CLIP_MT_clip")
 
-                sub.menu("CLIP_MT_clip")
-
-                if clip:
-                    if sc.mode == 'MASKEDIT':
-                        sub.menu("CLIP_MT_mask")
-                    else:
-                        sub.menu("CLIP_MT_track")
-                        sub.menu("CLIP_MT_reconstruction")
-
-        if sc.mode != 'MASKEDIT':
-            layout.prop(sc, "view", text="", expand=True)
+        row = layout.row()
+        row.template_ID(sc, "clip", open='clip.open')
 
         if clip:
+            tracking = clip.tracking
+            active_object = tracking.objects.active
+
             if sc.view == 'CLIP':
                 layout.prop(sc, "mode", text="")
+                layout.prop(sc, "view", text="", expand=True)
                 layout.prop(sc, "pivot_point", text="", icon_only=True)
 
-                if sc.mode == 'MASKEDIT':
-                    toolsettings = context.tool_settings
+                r = active_object.reconstruction
 
-                    row = layout.row(align=True)
-                    row.prop(toolsettings, "use_proportional_edit_mask",
-                             text="", icon_only=True)
-                    if toolsettings.use_proportional_edit_objects:
-                        row.prop(toolsettings, "proportional_edit_falloff",
-                                 text="", icon_only=True)
+                if r.is_valid and sc.view == 'CLIP':
+                    layout.label(text="Average solve error: %.4f" %
+                                 (r.average_error))
             elif sc.view == 'GRAPH':
+                layout.prop(sc, "view", text="", expand=True)
+
                 row = layout.row(align=True)
 
                 if sc.show_filters:
                     row.prop(sc, "show_filters", icon='DISCLOSURE_TRI_DOWN',
-                        text="Filters")
+                             text="Filters")
 
                     sub = row.column()
                     sub.active = clip.tracking.reconstruction.is_valid
@@ -82,32 +80,63 @@ class CLIP_HT_header(Header):
                     row.prop(sc, "show_graph_tracks", icon='ANIM', text="")
                 else:
                     row.prop(sc, "show_filters", icon='DISCLOSURE_TRI_RIGHT',
-                        text="Filters")
+                             text="Filters")
+            elif sc.view == 'DOPESHEET':
+                layout.prop(sc, "view", text="", expand=True)
+
+                layout.label(text="Sort by:")
+                layout.prop(sc, "dopesheet_sort_method", text="")
+                layout.prop(sc, "invert_dopesheet_sort", text="Invert")
+        else:
+            layout.prop(sc, "view", text="", expand=True)
+
+    def _draw_masking(self, context):
+        layout = self.layout
+
+        toolsettings = context.tool_settings
+        sc = context.space_data
+        clip = sc.clip
+
+        row = layout.row(align=True)
+        row.template_header()
+
+        if context.area.show_menus:
+            sub = row.row(align=True)
+            sub.menu("CLIP_MT_view")
+
+            if clip:
+                sub.menu("CLIP_MT_select")
+                sub.menu("CLIP_MT_clip")
+                sub.menu("CLIP_MT_mask")
+            else:
+                sub.menu("CLIP_MT_clip")
 
         row = layout.row()
         row.template_ID(sc, "clip", open='clip.open')
 
-        if sc.mode == 'MASKEDIT':
-            row = layout.row()
-            row.template_ID(sc, "mask", new="mask.new")
+        layout.prop(sc, "mode", text="")
 
-        if clip:
-            tracking = clip.tracking
-            active = tracking.objects.active
+        row = layout.row()
+        row.template_ID(sc, "mask", new="mask.new")
 
-            if active and not active.is_camera:
-                r = active.reconstruction
-            else:
-                r = tracking.reconstruction
+        layout.prop(sc, "pivot_point", text="", icon_only=True)
 
-            if r.is_valid and sc.view == 'CLIP':
-                layout.label(text="Average solve error: %.4f" %
-                    (r.average_error))
+        row = layout.row(align=True)
+        row.prop(toolsettings, "use_proportional_edit_mask",
+                 text="", icon_only=True)
+        if toolsettings.use_proportional_edit_mask:
+            row.prop(toolsettings, "proportional_edit_falloff",
+                     text="", icon_only=True)
 
-            if sc.view == 'DOPESHEET':
-                layout.label(text="Sort by:")
-                layout.prop(sc, "dopesheet_sort_method", text="")
-                layout.prop(sc, "invert_dopesheet_sort", text="Invert")
+    def draw(self, context):
+        layout = self.layout
+
+        sc = context.space_data
+
+        if sc.mode in {'TRACKING', 'RECONSTRUCTION', 'DISTORTION'}:
+            self._draw_tracking(context)
+        else:
+            self._draw_masking(context)
 
         layout.template_running_jobs()
 
@@ -704,28 +733,27 @@ class CLIP_PT_active_mask_point(Panel):
         col.prop(point, "handle_type")
 
         col = layout.column()
-        col.prop(parent, "use_parent", text="Parent")
-        if parent.use_parent:
-            # Currently only parenting yo movie clip is allowed, so do not
-            # ver-oplicate things for now and use single template_ID
-            #col.template_any_ID(parent, "id", "id_type", text="")
+        # Currently only parenting yo movie clip is allowed, so do not
+        # ver-oplicate things for now and use single template_ID
+        #col.template_any_ID(parent, "id", "id_type", text="")
 
-            col.template_ID(parent, "id")
+        col.label("Parent:")
+        col.prop(parent, "id", text="")
 
-            if parent.id_type == 'MOVIECLIP' and parent.id:
-                clip = parent.id
-                tracking = clip.tracking
+        if parent.id_type == 'MOVIECLIP' and parent.id:
+            clip = parent.id
+            tracking = clip.tracking
 
-                col.prop_search(parent, "parent", tracking,
-                                "objects", icon='OBJECT_DATA', text="Object:")
+            col.prop_search(parent, "parent", tracking,
+                            "objects", icon='OBJECT_DATA', text="Object:")
 
-                if parent.parent and parent.parent in tracking.objects:
-                    object = tracking.objects[parent.parent]
-                    col.prop_search(parent, "sub_parent", object,
-                                    "tracks", icon='ANIM_DATA', text="Track:")
-                else:
-                    col.prop_search(parent, "sub_parent", tracking,
-                                    "tracks", icon='ANIM_DATA', text="Track:")
+            if parent.parent in tracking.objects:
+                object = tracking.objects[parent.parent]
+                col.prop_search(parent, "sub_parent", object,
+                                "tracks", icon='ANIM_DATA', text="Track:")
+            else:
+                col.prop_search(parent, "sub_parent", tracking,
+                                "tracks", icon='ANIM_DATA', text="Track:")
 
 
 class CLIP_PT_display(CLIP_PT_clip_view_panel, Panel):
@@ -778,6 +806,24 @@ class CLIP_PT_display(CLIP_PT_clip_view_panel, Panel):
             col.prop(sc, "show_mask_smooth")
 
 
+# TODO, move into its own file
+class CLIP_PT_mask(CLIP_PT_mask_view_panel, Panel):
+    bl_space_type = 'CLIP_EDITOR'
+    bl_region_type = 'UI'
+    bl_label = "Mask Settings"
+    bl_options = {'DEFAULT_CLOSED'}
+
+    def draw(self, context):
+        layout = self.layout
+
+        sc = context.space_data
+        mask = sc.mask
+
+        col = layout.column(align=True)
+        col.prop(mask, "frame_start")
+        col.prop(mask, "frame_end")
+
+
 class CLIP_PT_marker_display(CLIP_PT_clip_view_panel, Panel):
     bl_space_type = 'CLIP_EDITOR'
     bl_region_type = 'UI'
index 732f675c2086222b0d15910b07c70adc160ca0ea..276e8e5ae1d35f75b8d28ddadb7d8aad9c0af569 100644 (file)
@@ -198,6 +198,12 @@ class SEQUENCER_MT_add(Menu):
         else:
             layout.operator_menu_enum("sequencer.movieclip_strip_add", "clip", text="Clip...")
 
+        if len(bpy.data.masks) > 10:
+            layout.operator_context = 'INVOKE_DEFAULT'
+            layout.operator("sequencer.mask_strip_add", text="Masks...")
+        else:
+            layout.operator_menu_enum("sequencer.mask_strip_add", "mask", text="Mask...")
+
         layout.operator("sequencer.movie_strip_add", text="Movie")
         layout.operator("sequencer.image_strip_add", text="Image")
         layout.operator("sequencer.sound_strip_add", text="Sound")
@@ -670,6 +676,35 @@ class SEQUENCER_PT_scene(SequencerButtonsPanel, Panel):
             layout.label(text="Original frame range" + ": %d-%d (%d)" % (sta, end, end - sta + 1))
 
 
+class SEQUENCER_PT_mask(SequencerButtonsPanel, Panel):
+    bl_label = "Mask"
+
+    @classmethod
+    def poll(cls, context):
+        if not cls.has_sequencer(context):
+            return False
+
+        strip = act_strip(context)
+        if not strip:
+            return False
+
+        return (strip.type == 'MASK')
+
+    def draw(self, context):
+        layout = self.layout
+
+        strip = act_strip(context)
+
+        layout.template_ID(strip, "mask")
+
+        mask = strip.mask
+
+        if mask:
+            sta = mask.frame_start
+            end = mask.frame_end
+            layout.label(text="Original frame range" + ": %d-%d (%d)" % (sta, end, end - sta + 1))
+
+
 class SEQUENCER_PT_filter(SequencerButtonsPanel, Panel):
     bl_label = "Filter"
 
@@ -682,10 +717,10 @@ class SEQUENCER_PT_filter(SequencerButtonsPanel, Panel):
         if not strip:
             return False
 
-        return strip.type in {'MOVIE', 'IMAGE', 'SCENE', 'MOVIECLIP', 'META',
-                              'ADD', 'SUBTRACT', 'ALPHA_OVER', 'ALPHA_UNDER',
-                              'CROSS', 'GAMMA_CROSS', 'MULTIPLY', 'OVER_DROP',
-                              'WIPE', 'GLOW', 'TRANSFORM', 'COLOR',
+        return strip.type in {'MOVIE', 'IMAGE', 'SCENE', 'MOVIECLIP', 'MASK',
+                              'META', 'ADD', 'SUBTRACT', 'ALPHA_OVER',
+                              'ALPHA_UNDER', 'CROSS', 'GAMMA_CROSS', 'MULTIPLY',
+                              'OVER_DROP', 'WIPE', 'GLOW', 'TRANSFORM', 'COLOR',
                               'MULTICAM', 'SPEED', 'ADJUSTMENT'}
 
     def draw(self, context):
index a93e811557a72629c6fa6780177984b29940cc89..32f86bd3ebec6daf527a1f81e2346c257aa14a33 100644 (file)
@@ -99,7 +99,7 @@ void BKE_mask_point_segment_co(struct MaskSpline *spline, struct MaskSplinePoint
 void BKE_mask_point_normal(struct MaskSpline *spline, struct MaskSplinePoint *point,
                            float u, float n[2]);
 float BKE_mask_point_weight_scalar(struct MaskSpline *spline, struct MaskSplinePoint *point, const float u);
-float BKE_mask_point_weight(struct MaskSpline *spline, struct MaskSplinePoint *point, float u);
+float BKE_mask_point_weight(struct MaskSpline *spline, struct MaskSplinePoint *point, const float u);
 struct MaskSplinePointUW *BKE_mask_point_sort_uw(struct MaskSplinePoint *point, struct MaskSplinePointUW *uw);
 void BKE_mask_point_add_uw(struct MaskSplinePoint *point, float u, float w);
 
@@ -120,6 +120,7 @@ void BKE_mask_coord_to_movieclip(struct MovieClip *clip, struct MovieClipUser *u
 void BKE_mask_update_display(struct Mask *mask, float ctime);
 
 void BKE_mask_evaluate_all_masks(struct Main *bmain, float ctime, const int do_newframe);
+void BKE_mask_evaluate(struct Mask *mask, float ctime, const int do_newframe);
 void BKE_mask_update_scene(struct Main *bmain, struct Scene *scene, const int do_newframe);
 void BKE_mask_parent_init(struct MaskParent *parent);
 void BKE_mask_calc_handle_adjacent_interp(struct MaskSpline *spline, struct MaskSplinePoint *point, const float u);
@@ -165,7 +166,9 @@ void BKE_mask_layer_shape_changed_add(struct MaskLayer *masklay, int index,
 void BKE_mask_layer_shape_changed_remove(struct MaskLayer *masklay, int index, int count);
 
 /* rasterization */
-void BKE_mask_rasterize(struct Mask *mask, int width, int height, float *buffer);
+int BKE_mask_get_duration(struct Mask *mask);
+void BKE_mask_rasterize(struct Mask *mask, int width, int height, float *buffer,
+                        const short do_aspect_correct, const short do_linear);
 
 #define MASKPOINT_ISSEL_ANY(p)          ( ((p)->bezt.f1 | (p)->bezt.f2 | (p)->bezt.f2) & SELECT)
 #define MASKPOINT_ISSEL_KNOT(p)         ( (p)->bezt.f2 & SELECT)
index 9dc5463edab1ff92730846817b81b58c6b11ea8c..d733092e79266592bbc4efcc705bcd3ffdbe0f04 100644 (file)
@@ -119,8 +119,8 @@ static void de_interlace_ng(struct ImBuf *ibuf) /* neogeo fields */
        
        if (ibuf->rect) {
                /* make copies */
-               tbuf1 = IMB_allocImBuf(ibuf->x, (short)(ibuf->y >> 1), (unsigned char)32, (int)IB_rect);
-               tbuf2 = IMB_allocImBuf(ibuf->x, (short)(ibuf->y >> 1), (unsigned char)32, (int)IB_rect);
+               tbuf1 = IMB_allocImBuf(ibuf->x, (ibuf->y >> 1), (unsigned char)32, (int)IB_rect);
+               tbuf2 = IMB_allocImBuf(ibuf->x, (ibuf->y >> 1), (unsigned char)32, (int)IB_rect);
                
                ibuf->x *= 2;
                
@@ -147,8 +147,8 @@ static void de_interlace_st(struct ImBuf *ibuf) /* standard fields */
        
        if (ibuf->rect) {
                /* make copies */
-               tbuf1 = IMB_allocImBuf(ibuf->x, (short)(ibuf->y >> 1), (unsigned char)32, IB_rect);
-               tbuf2 = IMB_allocImBuf(ibuf->x, (short)(ibuf->y >> 1), (unsigned char)32, IB_rect);
+               tbuf1 = IMB_allocImBuf(ibuf->x, (ibuf->y >> 1), (unsigned char)32, IB_rect);
+               tbuf2 = IMB_allocImBuf(ibuf->x, (ibuf->y >> 1), (unsigned char)32, IB_rect);
                
                ibuf->x *= 2;
                
index 0a6063a6b21fdd73a903adbbe1f5b6dbbe4b6f97..1f1dc6a0cc83c8f0c97a1385376642ab34c70026 100644 (file)
@@ -816,7 +816,7 @@ float BKE_mask_point_weight(MaskSpline *spline, MaskSplinePoint *point, const fl
                return bezt_next->weight;
        }
        else {
-               float cur_u, cur_w, next_u, next_w, fac;
+               float cur_u = 0.0f, cur_w = 0.0f, next_u = 0.0f, next_w = 0.0f, fac; /* Quite warnings */
                int i;
 
                for (i = 0; i < point->tot_uw + 1; i++) {
@@ -951,6 +951,10 @@ Mask *BKE_mask_new(const char *name)
 
        mask = mask_alloc(mask_name);
 
+       /* arbitrary defaults */
+       mask->sfra = 1;
+       mask->efra = 100;
+
        return mask;
 }
 
@@ -1139,9 +1143,6 @@ static int BKE_mask_evaluate_parent(MaskParent *parent, float ctime, float r_co[
        if (!parent)
                return FALSE;
 
-       if ((parent->flag & MASK_PARENT_ACTIVE) == 0)
-               return FALSE;
-
        if (parent->id_type == ID_MC) {
                if (parent->id) {
                        MovieClip *clip = (MovieClip *) parent->id;
@@ -1778,10 +1779,17 @@ int BKE_mask_layer_shape_find_frame_range(MaskLayer *masklay, const int frame,
                }
        }
 
-       *r_masklay_shape_a = NULL;
-       *r_masklay_shape_b = NULL;
+       if ((masklay_shape = masklay->splines_shapes.last)) {
+               *r_masklay_shape_a = masklay_shape;
+               *r_masklay_shape_b = NULL;
+               return 1;
+       }
+       else {
+               *r_masklay_shape_a = NULL;
+               *r_masklay_shape_b = NULL;
 
-       return 0;
+               return 0;
+       }
 }
 
 MaskLayerShape *BKE_mask_layer_shape_varify_frame(MaskLayer *masklay, const int frame)
@@ -2040,7 +2048,7 @@ static void m_invert_vn_vn(float *array, const float f, const int size)
        }
 }
 
-static void linear_clamp_vn_vn(float *array, const int size)
+static void clamp_vn_vn_linear(float *array, const int size)
 {
        float *arr = array + (size - 1);
 
@@ -2053,8 +2061,26 @@ static void linear_clamp_vn_vn(float *array, const int size)
        }
 }
 
+static void clamp_vn_vn(float *array, const int size)
+{
+       float *arr = array + (size - 1);
+
+       int i = size;
+       while (i--) {
+               if      (*arr < 0.0f) *arr = 0.0f;
+               else if (*arr > 1.0f) *arr = 1.0f;
+               arr--;
+       }
+}
+
+int BKE_mask_get_duration(Mask *mask)
+{
+       return MAX2(1, mask->efra - mask->sfra);
+}
+
 /* rasterization */
-void BKE_mask_rasterize(Mask *mask, int width, int height, float *buffer)
+void BKE_mask_rasterize(Mask *mask, int width, int height, float *buffer,
+                        const short do_aspect_correct, const short do_linear)
 {
        MaskLayer *masklay;
 
@@ -2087,31 +2113,32 @@ void BKE_mask_rasterize(Mask *mask, int width, int height, float *buffer)
                                        BKE_mask_spline_feather_differentiated_points_with_resolution(spline, width, height,
                                                                                                      &tot_diff_feather_points);
 
-                               /* TODO, make this optional! */
-                               if (width != height) {
-                                       float *fp;
-                                       float *ffp;
-                                       int i;
-                                       float asp;
-
-                                       if (width < height) {
-                                               fp = &diff_points[0][0];
-                                               ffp = tot_diff_feather_points ? &diff_feather_points[0][0] : NULL;
-                                               asp = (float)width / (float)height;
-                                       }
-                                       else {
-                                               fp = &diff_points[0][1];
-                                               ffp = tot_diff_feather_points ? &diff_feather_points[0][1] : NULL;
-                                               asp = (float)height / (float)width;
-                                       }
+                               if (do_aspect_correct) {
+                                       if (width != height) {
+                                               float *fp;
+                                               float *ffp;
+                                               int i;
+                                               float asp;
+
+                                               if (width < height) {
+                                                       fp = &diff_points[0][0];
+                                                       ffp = tot_diff_feather_points ? &diff_feather_points[0][0] : NULL;
+                                                       asp = (float)width / (float)height;
+                                               }
+                                               else {
+                                                       fp = &diff_points[0][1];
+                                                       ffp = tot_diff_feather_points ? &diff_feather_points[0][1] : NULL;
+                                                       asp = (float)height / (float)width;
+                                               }
 
-                                       for (i = 0; i < tot_diff_point; i++, fp += 2) {
-                                               (*fp) = (((*fp) - 0.5f) / asp) + 0.5f;
-                                       }
+                                               for (i = 0; i < tot_diff_point; i++, fp += 2) {
+                                                       (*fp) = (((*fp) - 0.5f) / asp) + 0.5f;
+                                               }
 
-                                       if (tot_diff_feather_points) {
-                                               for (i = 0; i < tot_diff_feather_points; i++, ffp += 2) {
-                                                       (*ffp) = (((*ffp) - 0.5f) / asp) + 0.5f;
+                                               if (tot_diff_feather_points) {
+                                                       for (i = 0; i < tot_diff_feather_points; i++, ffp += 2) {
+                                                               (*ffp) = (((*ffp) - 0.5f) / asp) + 0.5f;
+                                                       }
                                                }
                                        }
                                }
@@ -2173,7 +2200,12 @@ void BKE_mask_rasterize(Mask *mask, int width, int height, float *buffer)
                }
 
                /* clamp at the end */
-               linear_clamp_vn_vn(buffer, buffer_size);
+               if (do_linear) {
+                       clamp_vn_vn_linear(buffer, buffer_size);
+               }
+               else {
+                       clamp_vn_vn(buffer, buffer_size);
+               }
        }
 
        MEM_freeN(buffer_tmp);
index 5e41c009fd3bd9086ecdcdca9116f00c6f8cce35..6e5149d792434a1ffd8c9f18025c24537ffd7c00 100644 (file)
@@ -77,7 +77,7 @@ static ImBuf *prepare_effect_imbufs(
 
        if (!ibuf1 && !ibuf2 && !ibuf3) {
                /* hmmm, global float option ? */
-               out = IMB_allocImBuf((short)x, (short)y, 32, IB_rect);
+               out = IMB_allocImBuf(x, y, 32, IB_rect);
        }
        else if ((ibuf1 && ibuf1->rect_float) ||
                 (ibuf2 && ibuf2->rect_float) ||
@@ -85,10 +85,10 @@ static ImBuf *prepare_effect_imbufs(
        {
                /* if any inputs are rectfloat, output is float too */
 
-               out = IMB_allocImBuf((short)x, (short)y, 32, IB_rectfloat);
+               out = IMB_allocImBuf(x, y, 32, IB_rectfloat);
        }
        else {
-               out = IMB_allocImBuf((short)x, (short)y, 32, IB_rect);
+               out = IMB_allocImBuf(x, y, 32, IB_rect);
        }
        
        if (ibuf1 && !ibuf1->rect_float && out->rect_float) {
index 699e0b1cd97f8fe346f35d8591229a96a3cf17a8..4f47a7f6f443abde6a596a96fc3964ecbd783c2b 100644 (file)
@@ -29,7 +29,6 @@
  *  \ingroup bke
  */
 
-
 #include <stddef.h>
 #include <stdlib.h>
 #include <string.h>
@@ -40,6 +39,7 @@
 
 #include "DNA_sequence_types.h"
 #include "DNA_movieclip_types.h"
+#include "DNA_mask_types.h"
 #include "DNA_scene_types.h"
 #include "DNA_anim_types.h"
 #include "DNA_object_types.h"
@@ -61,6 +61,7 @@
 #include "BKE_movieclip.h"
 #include "BKE_fcurve.h"
 #include "BKE_scene.h"
+#include "BKE_mask.h"
 #include "BKE_utildefines.h"
 
 #include "RNA_access.h"
@@ -669,9 +670,9 @@ void reload_sequence_new_file(Scene *scene, Sequence *seq, int lock_range)
        int prev_startdisp = 0, prev_enddisp = 0;
        /* note: don't rename the strip, will break animation curves */
 
-       if (ELEM6(seq->type,
+       if (ELEM7(seq->type,
                  SEQ_TYPE_MOVIE, SEQ_TYPE_IMAGE, SEQ_TYPE_SOUND_RAM,
-                 SEQ_TYPE_SCENE, SEQ_TYPE_META, SEQ_TYPE_MOVIECLIP) == 0)
+                 SEQ_TYPE_SCENE, SEQ_TYPE_META, SEQ_TYPE_MOVIECLIP, SEQ_TYPE_MASK) == 0)
        {
                return;
        }
@@ -725,6 +726,15 @@ void reload_sequence_new_file(Scene *scene, Sequence *seq, int lock_range)
                case SEQ_TYPE_MOVIECLIP:
                        seq->len = BKE_movieclip_get_duration(seq->clip);
 
+                       seq->len -= seq->anim_startofs;
+                       seq->len -= seq->anim_endofs;
+                       if (seq->len < 0) {
+                               seq->len = 0;
+                       }
+                       break;
+               case SEQ_TYPE_MASK:
+                       seq->len = BKE_mask_get_duration(seq->mask);
+
                        seq->len -= seq->anim_startofs;
                        seq->len -= seq->anim_endofs;
                        if (seq->len < 0) {
@@ -903,7 +913,8 @@ static const char *give_seqname_by_type(int type)
                case SEQ_TYPE_SCENE:      return "Scene";
                case SEQ_TYPE_MOVIE:      return "Movie";
                case SEQ_TYPE_MOVIECLIP:  return "Clip";
-               case SEQ_TYPE_SOUND_RAM:      return "Audio";
+               case SEQ_TYPE_MASK:       return "Mask";
+               case SEQ_TYPE_SOUND_RAM:  return "Audio";
                case SEQ_TYPE_CROSS:      return "Cross";
                case SEQ_TYPE_GAMCROSS:   return "Gamma Cross";
                case SEQ_TYPE_ADD:        return "Add";
@@ -1908,8 +1919,7 @@ static ImBuf *seq_render_effect_strip_impl(
        input[0] = seq->seq1; input[1] = seq->seq2; input[2] = seq->seq3;
 
        if (!sh.execute) { /* effect not supported in this version... */
-               out = IMB_allocImBuf((short)context.rectx, 
-                                    (short)context.recty, 32, IB_rect);
+               out = IMB_allocImBuf(context.rectx, context.recty, 32, IB_rect);
                return out;
        }
 
@@ -1986,7 +1996,7 @@ static ImBuf *seq_render_effect_strip_impl(
        }
 
        if (out == NULL) {
-               out = IMB_allocImBuf((short)context.rectx, (short)context.recty, 32, IB_rect);
+               out = IMB_allocImBuf(context.rectx, context.recty, 32, IB_rect);
        }
 
        return out;
@@ -2044,6 +2054,75 @@ static ImBuf *seq_render_movieclip_strip(
        return ibuf;
 }
 
+
+static ImBuf *seq_render_mask_strip(
+        SeqRenderData context, Sequence *seq, float nr)
+{
+       /* TODO - add option to rasterize to alpha imbuf? */
+       ImBuf *ibuf = NULL;
+       float *maskbuf;
+       int i;
+
+       if (!seq->mask) {
+               return NULL;
+       }
+
+       BKE_mask_evaluate(seq->mask, (int)(seq->mask->sfra + nr), TRUE);
+
+       maskbuf = MEM_callocN(sizeof(float) * context.rectx * context.recty, __func__);
+
+       if (seq->flag & SEQ_MAKE_FLOAT) {
+               /* pixels */
+               float *fp_src;
+               float *fp_dst;
+
+               ibuf = IMB_allocImBuf(context.rectx, context.recty, 32, IB_rectfloat);
+
+               BKE_mask_rasterize(seq->mask,
+                                  context.rectx, context.recty,
+                                  maskbuf,
+                                  TRUE, FALSE);
+
+               fp_src = maskbuf;
+               fp_dst = ibuf->rect_float;
+               i = context.rectx * context.recty;
+               while(--i) {
+                       fp_dst[0] = fp_dst[1] = fp_dst[2] = *fp_src;
+                       fp_dst[3] = 1.0f;
+
+                       fp_src += 1;
+                       fp_dst += 4;
+               }
+       }
+       else {
+               /* pixels */
+               float *fp_src;
+               unsigned char *ub_dst;
+
+               ibuf = IMB_allocImBuf(context.rectx, context.recty, 32, IB_rect);
+
+               BKE_mask_rasterize(seq->mask,
+                                  context.rectx, context.recty,
+                                  maskbuf,
+                                  TRUE, FALSE);
+
+               fp_src = maskbuf;
+               ub_dst = (unsigned char *)ibuf->rect;
+               i = context.rectx * context.recty;
+               while(--i) {
+                       ub_dst[0] = ub_dst[1] = ub_dst[2] = (unsigned char)(*fp_src * 255.0f); /* already clamped */
+                       ub_dst[3] = 255;
+
+                       fp_src += 1;
+                       ub_dst += 4;
+               }
+       }
+
+       MEM_freeN(maskbuf);
+
+       return ibuf;
+}
+
 static ImBuf *seq_render_scene_strip(
         SeqRenderData context, Sequence *seq, float nr)
 {
@@ -2359,10 +2438,18 @@ static ImBuf *seq_render_strip(SeqRenderData context, Sequence *seq, float cfra)
                                copy_to_ibuf_still(context, seq, nr, ibuf);
                                break;
                        }
+               case SEQ_TYPE_MASK:
+               {
+                       /* ibuf is alwats new */
+                       ibuf = seq_render_mask_strip(context, seq, nr);
+
+                       copy_to_ibuf_still(context, seq, nr, ibuf);
+                       break;
+               }
                }
 
        if (ibuf == NULL)
-               ibuf = IMB_allocImBuf((short)context.rectx, (short)context.recty, 32, IB_rect);
+               ibuf = IMB_allocImBuf(context.rectx, context.recty, 32, IB_rect);
 
        if (ibuf->x != context.rectx || ibuf->y != context.recty)
                use_preprocess = TRUE;
@@ -2477,7 +2564,7 @@ static ImBuf *seq_render_strip_stack(
                                break;
                        case EARLY_USE_INPUT_1:
                                if (i == 0) {
-                                       out = IMB_allocImBuf((short)context.rectx, (short)context.recty, 32, IB_rect);
+                                       out = IMB_allocImBuf(context.rectx, context.recty, 32, IB_rect);
                                }
                                break;
                        case EARLY_DO_EFFECT:
index b1a3150ff249d1da564e54c3b62080abf8e02059..a36645510c3d6540d4cb60c5f6036053293cdbd3 100644 (file)
@@ -4828,6 +4828,10 @@ static void lib_link_scene(FileData *fd, Main *main)
                                        seq->clip = newlibadr(fd, sce->id.lib, seq->clip);
                                        seq->clip->id.us++;
                                }
+                               if (seq->mask) {
+                                       seq->mask = newlibadr(fd, sce->id.lib, seq->mask);
+                                       seq->mask->id.us++;
+                               }
                                if (seq->scene_camera) seq->scene_camera = newlibadr(fd, sce->id.lib, seq->scene_camera);
                                if (seq->sound) {
                                        seq->scene_sound = NULL;
index df807091cb85463ecd6374e9c1c595747dc1fa9a..f87265c50f5ab202e4f5b83ff68e3bcce38f77c2 100644 (file)
@@ -52,12 +52,25 @@ typedef enum CompositorQuality {
        COM_QUALITY_LOW    = 2
 } CompositorQuality;
 
+/**
+  * @brief Possible priority settings
+  * @ingroup Execution
+  */
+typedef enum CompositorPriority {
+       /** @brief High quality setting */
+       COM_PRIORITY_HIGH   = 2 ,
+       /** @brief Medium quality setting */
+       COM_PRIORITY_MEDIUM = 1,
+       /** @brief Low quality setting */
+       COM_PRIORITY_LOW    = 0
+} CompositorPriority;
+
 // configurable items
 
 // chunk size determination
 #define COM_PREVIEW_SIZE 140.0f
-#define COM_OPENCL_ENABLED
-#define COM_PREVIEW_ENABLED
+//#define COM_OPENCL_ENABLED
+
 // workscheduler threading models
 /**
   * COM_TM_QUEUE is a multithreaded model, which uses the BLI_thread_queue pattern. This is the default option.
index 0ebf9af207ba3b09892d48d34999248b3d414f2f..44b3c8dafbb368681fec916294da957cc6a3d3ec 100644 (file)
@@ -57,7 +57,7 @@ ExecutionGroup::ExecutionGroup()
        this->chunksFinished = 0;
 }
 
-int ExecutionGroup::getRenderPriotrity()
+CompositorPriority ExecutionGroup::getRenderPriotrity()
 {
        return this->getOutputNodeOperation()->getRenderPriority();
 }
@@ -401,47 +401,11 @@ MemoryBuffer** ExecutionGroup::getInputBuffersOpenCL(int chunkNumber)
        return memoryBuffers;
 }
 
-// @todo: for opencl the memory buffers size needs to be same as the needed size
-// currently this method is not called, but will be when opencl nodes are created
 MemoryBuffer *ExecutionGroup::constructConsolidatedMemoryBuffer(MemoryProxy *memoryProxy, rcti *rect)
 {
-       // find all chunks inside the rect
-       // determine minxchunk, minychunk, maxxchunk, maxychunk where x and y are chunknumbers
-       float chunkSizef = this->chunkSize;
-
-       int indexx, indexy;
-
-       const int minxchunk = floor(rect->xmin/chunkSizef);
-       const int maxxchunk = ceil((rect->xmax-1)/chunkSizef);
-       const int minychunk = floor(rect->ymin/chunkSizef);
-       const int maxychunk = ceil((rect->ymax-1)/chunkSizef);
-
-       if (maxxchunk== minxchunk+1 && maxychunk == minychunk+1) {
-               MemoryBuffer *result =memoryProxy->getBuffer();
-               return result;
-       }
-
-       rcti chunkRect;
-       chunkRect.xmin = minxchunk*this->chunkSize;
-       chunkRect.xmax = maxxchunk*this->chunkSize;
-       chunkRect.ymin = minychunk*this->chunkSize;
-       chunkRect.ymax = maxychunk*this->chunkSize;
-
-       CLAMP(chunkRect.xmin, 0, (int)this->width);
-       CLAMP(chunkRect.xmax, 0, (int)this->width);
-       CLAMP(chunkRect.ymin, 0, (int)this->height);
-       CLAMP(chunkRect.ymax, 0, (int)this->height);
-
-       MemoryBuffer *result = new MemoryBuffer(memoryProxy, &chunkRect);
-
-       for (indexx = max(minxchunk, 0); indexx<min((int)this->numberOfXChunks, maxxchunk) ; indexx++) {
-               for (indexy = max(minychunk, 0); indexy<min((int)this->numberOfYChunks, maxychunk) ; indexy++) {
-                       /* int chunkNumber = indexx+indexy*this->numberOfXChunks; */ /* UNUSED */
-                       MemoryBuffer *chunkBuffer = memoryProxy->getBuffer();
-                       result->copyContentFrom(chunkBuffer);
-               }
-       }
-
+       MemoryBuffer* imageBuffer = memoryProxy->getBuffer();
+       MemoryBuffer* result = new MemoryBuffer(memoryProxy, rect);
+       result->copyContentFrom(imageBuffer);
        return result;
 }
 
@@ -487,14 +451,14 @@ void ExecutionGroup::determineChunkRect(rcti *rect, const unsigned int chunkNumb
 
 MemoryBuffer *ExecutionGroup::allocateOutputBuffer(int chunkNumber, rcti *rect)
 {
-       MemoryBuffer *outputBuffer = NULL;
-       // output allocation is only valid when our outputoperation is a memorywriter
+       // we asume that this method is only called from complex execution groups.
        NodeOperation * operation = this->getOutputNodeOperation();
        if (operation->isWriteBufferOperation()) {
-/*             WriteBufferOperation *writeOperation = (WriteBufferOperation*)operation; */ /* UNUSED */
-// @todo               outputBuffer = MemoryManager::allocateMemoryBuffer(writeOperation->getMemoryProxy(), chunkNumber, rect);
+               WriteBufferOperation *writeOperation = (WriteBufferOperation*)operation;
+               MemoryBuffer *buffer = new MemoryBuffer(writeOperation->getMemoryProxy(), rect);
+               return buffer;
        }
-       return outputBuffer;
+       return NULL;
 }
 
 
@@ -600,11 +564,6 @@ void ExecutionGroup::determineDependingMemoryProxies(vector<MemoryProxy*> *memor
        }
 }
 
-bool ExecutionGroup::operator ==(const ExecutionGroup & executionGroup) const
-{
-       return this->getOutputNodeOperation() == executionGroup.getOutputNodeOperation();
-}
-
 bool ExecutionGroup::isOpenCL()
 {
        return this->openCL;
index cbdc9bb1787a3b38191a589db69e66186e349274..416a78eb8b872bb2b52da220e13feb21c18478d6 100644 (file)
@@ -167,13 +167,7 @@ private:
          * @param operation the operation to be added
          */
        bool canContainOperation(NodeOperation *operation);
-       
-       /**
-         * @brief get the Render priority of this ExecutionGroup
-         * @see ExecutionSystem.execute
-         */
-       int getRenderPriotrity();
-       
+               
        /**
          * @brief calculate the actual chunk size of this execution group.
          * @note A chunk size is an unsigned int that is both the height and width of a chunk.
@@ -396,17 +390,21 @@ public:
          * @see determineChunkSize()
          */
        void determineChunkRect(rcti *rect, const unsigned int chunkNumber) const;
-       
-       
-               bool operator ==(const ExecutionGroup &executionGroup) const;
-       
-               /**
+
+       /**
          * @brief can this ExecutionGroup be scheduled on an OpenCLDevice
          * @see WorkScheduler.schedule
          */
        bool isOpenCL();
-       
+
        void setChunksize(int chunksize) {this->chunkSize = chunksize;}
+
+       /**
+         * @brief get the Render priority of this ExecutionGroup
+         * @see ExecutionSystem.execute
+         */
+       CompositorPriority getRenderPriotrity();
+       
 };
 
 #endif
index 96d2a6f44342b12becd5576f891d1d2fe98fb63b..8c0b37a0685f9273cfa59b8bde84bf1afb991e6b 100644 (file)
@@ -127,20 +127,9 @@ void ExecutionSystem::execute()
 
        WorkScheduler::start(this->context);
 
-
-       vector<ExecutionGroup*> executionGroups;
-       this->findOutputExecutionGroup(&executionGroups);
-
-       /* start execution of the ExecutionGroups based on priority of their output node */
-       for (int priority = 9 ; priority>=0 ; priority--) {
-               for (index = 0 ; index < executionGroups.size(); index ++) {
-                       ExecutionGroup *group = executionGroups[index];
-                       NodeOperation *output = group->getOutputNodeOperation();
-                       if (output->getRenderPriority() == priority) {
-                               group->execute(this);
-                       }
-               }
-       }
+       executeGroups(COM_PRIORITY_HIGH);
+       executeGroups(COM_PRIORITY_MEDIUM);
+       executeGroups(COM_PRIORITY_LOW);
 
        WorkScheduler::finish();
        WorkScheduler::stop();
@@ -155,6 +144,18 @@ void ExecutionSystem::execute()
        }
 }
 
+void ExecutionSystem::executeGroups(CompositorPriority priority)
+{
+       int index;
+       vector<ExecutionGroup*> executionGroups;
+       this->findOutputExecutionGroup(&executionGroups, priority);
+
+       for (index = 0 ; index < executionGroups.size(); index ++) {
+               ExecutionGroup *group = executionGroups[index];
+               group->execute(this);
+       }
+}
+
 void ExecutionSystem::addOperation(NodeOperation *operation)
 {
        ExecutionSystemHelper::addOperation(this->operations, operation);
@@ -304,6 +305,17 @@ void ExecutionSystem::determineActualSocketDataTypes(vector<NodeBase*> &nodes)
        }
 }
 
+void ExecutionSystem::findOutputExecutionGroup(vector<ExecutionGroup*> *result, CompositorPriority priority) const
+{
+       unsigned int index;
+       for (index = 0 ; index < this->groups.size() ; index ++) {
+               ExecutionGroup *group = this->groups[index];
+               if (group->isOutputExecutionGroup() && group->getRenderPriotrity() == priority) {
+                       result->push_back(group);
+               }
+       }
+}
+
 void ExecutionSystem::findOutputExecutionGroup(vector<ExecutionGroup*> *result) const
 {
        unsigned int index;
index 85fec8b6145ae4290b589993e17d073f96c6467e..510e58ba1bbe5feeeec418901c9288551725c514 100644 (file)
@@ -138,6 +138,11 @@ private: //methods
        void addReadWriteBufferOperations(NodeOperation *operation);
 
 
+       /**
+         * find all execution group with output nodes
+         */
+       void findOutputExecutionGroup(vector<ExecutionGroup*> *result, CompositorPriority priority) const;
+       
        /**
          * find all execution group with output nodes
          */
@@ -224,6 +229,8 @@ private:
          * @param nodes list of nodes or operations to do the data type determination
          */
        void determineActualSocketDataTypes(vector<NodeBase*> &nodes);
+       
+       void executeGroups(CompositorPriority priority);
 
 };
 #endif
index ba5e21d53ae58f44901f10fe4edfa09e3f0fa315..264725b4b2c2718581619777413607c8c32ab33e 100644 (file)
@@ -83,23 +83,20 @@ void Node::addSetValueOperation(ExecutionSystem *graph, InputSocket *inputsocket
        graph->addOperation(operation);
 }
 
-void Node::addPreviewOperation(ExecutionSystem *system, OutputSocket *outputSocket, int priority)
+void Node::addPreviewOperation(ExecutionSystem *system, OutputSocket *outputSocket)
 {
-#ifdef COM_PREVIEW_ENABLED
        PreviewOperation *operation = new PreviewOperation();
        system->addOperation(operation);
        operation->setbNode(this->getbNode());
        operation->setbNodeTree(system->getContext().getbNodeTree());
-       operation->setPriority(priority);
        this->addLink(system, outputSocket, operation->getInputSocket(0));
-#endif
 }
 
-void Node::addPreviewOperation(ExecutionSystem *system, InputSocket *inputSocket, int priority)
+void Node::addPreviewOperation(ExecutionSystem *system, InputSocket *inputSocket)
 {
        if (inputSocket->isConnected()) {
                OutputSocket *outputsocket = inputSocket->getConnection()->getFromSocket();
-               this->addPreviewOperation(system, outputsocket, priority);
+               this->addPreviewOperation(system, outputsocket);
        }
 }
 
index 2666d0a698058a9d21b3de40402b17d1c4aaa691..23744adf64280b40694868ec3e0f980fdc717db9 100644 (file)
@@ -120,8 +120,8 @@ protected:
        
        Node();
        
-       void addPreviewOperation(ExecutionSystem *system, InputSocket *inputSocket, int priority);
-       void addPreviewOperation(ExecutionSystem *system, OutputSocket *inputSocket, int priority);
+       void addPreviewOperation(ExecutionSystem *system, InputSocket *inputSocket);
+       void addPreviewOperation(ExecutionSystem *system, OutputSocket *outputSocket);
        
        bNodeSocket *getEditorInputSocket(int editorNodeInputSocketIndex);
        bNodeSocket *getEditorOutputSocket(int editorNodeOutputSocketIndex);
index fae652e39d706b76e5e860a4eaa948b1387d806e..650e4af5ae091baf97c8092536ae4cb5abbfebea 100644 (file)
@@ -124,3 +124,111 @@ bool NodeOperation::determineDependingAreaOfInterest(rcti * input, ReadBufferOpe
                return false;
        }
 }
+
+cl_mem NodeOperation::COM_clAttachMemoryBufferToKernelParameter(cl_context context, cl_kernel kernel, int parameterIndex, int offsetIndex, list<cl_mem> *cleanup, MemoryBuffer **inputMemoryBuffers, SocketReader* reader) 
+{
+       cl_int error;
+       MemoryBuffer* result = (MemoryBuffer*)reader->initializeTileData(NULL, inputMemoryBuffers);
+
+       const cl_image_format imageFormat = {
+               CL_RGBA,
+               CL_FLOAT
+       };
+
+       cl_mem clBuffer = clCreateImage2D(context, CL_MEM_READ_ONLY|CL_MEM_USE_HOST_PTR, &imageFormat, result->getWidth(), 
+                                         result->getHeight(), 0, result->getBuffer(), &error);
+       
+       if (error != CL_SUCCESS) { printf("CLERROR[%d]: %s\n", error, clewErrorString(error));  }
+       if (error == CL_SUCCESS) cleanup->push_back(clBuffer);
+
+       error = clSetKernelArg(kernel, parameterIndex, sizeof(cl_mem), &clBuffer);
+       if (error != CL_SUCCESS) { printf("CLERROR[%d]: %s\n", error, clewErrorString(error));  }
+       
+       COM_clAttachMemoryBufferOffsetToKernelParameter(kernel, offsetIndex, result);
+       return clBuffer;
+}
+       
+void NodeOperation::COM_clAttachMemoryBufferOffsetToKernelParameter(cl_kernel kernel, int offsetIndex, MemoryBuffer *memoryBuffer) 
+{
+       if (offsetIndex != -1) {
+               cl_int error;
+               rcti* rect = memoryBuffer->getRect();
+               cl_int2 offset = {rect->xmin, rect->ymin};
+
+               error = clSetKernelArg(kernel, offsetIndex, sizeof(cl_int2), &offset);
+               if (error != CL_SUCCESS) { printf("CLERROR[%d]: %s\n", error, clewErrorString(error));  }
+       }
+}
+
+void NodeOperation::COM_clAttachSizeToKernelParameter(cl_kernel kernel, int offsetIndex) 
+{
+       if (offsetIndex != -1) {
+               cl_int error;
+               cl_int2 offset = {this->getWidth(), this->getHeight()};
+
+               error = clSetKernelArg(kernel, offsetIndex, sizeof(cl_int2), &offset);
+               if (error != CL_SUCCESS) { printf("CLERROR[%d]: %s\n", error, clewErrorString(error));  }
+       }
+}
+
+void NodeOperation::COM_clAttachOutputMemoryBufferToKernelParameter(cl_kernel kernel, int parameterIndex, cl_mem clOutputMemoryBuffer) 
+{
+       cl_int error;
+       error = clSetKernelArg(kernel, parameterIndex, sizeof(cl_mem), &clOutputMemoryBuffer);
+       if (error != CL_SUCCESS) { printf("CLERROR[%d]: %s\n", error, clewErrorString(error)); }
+}
+
+void NodeOperation::COM_clEnqueueRange(cl_command_queue queue, cl_kernel kernel, MemoryBuffer *outputMemoryBuffer) {
+       cl_int error;
+       const size_t size[] = {outputMemoryBuffer->getWidth(),outputMemoryBuffer->getHeight()};
+       
+       error = clEnqueueNDRangeKernel(queue, kernel, 2, NULL, size, 0, 0, 0, NULL);
+       if (error != CL_SUCCESS) { printf("CLERROR[%d]: %s\n", error, clewErrorString(error));  }
+}
+
+void NodeOperation::COM_clEnqueueRange(cl_command_queue queue, cl_kernel kernel, MemoryBuffer *outputMemoryBuffer, int offsetIndex) {
+       cl_int error;
+       const int width = outputMemoryBuffer->getWidth();
+       const int height = outputMemoryBuffer->getHeight();
+       int offsetx;
+       int offsety;
+       const int localSize = 32;
+       size_t size[2];
+       cl_int2 offset;
+       
+       for (offsety = 0 ; offsety < height; offsety+=localSize) {
+               offset[1] = offsety;
+               if (offsety+localSize < height) {
+                       size[1] = localSize;
+               } else {
+                       size[1] = height - offsety;
+               }
+               for (offsetx = 0 ; offsetx < width ; offsetx+=localSize) {
+                       if (offsetx+localSize < width) {
+                               size[0] = localSize;
+                       } else {
+                               size[0] = width - offsetx;
+                       }
+                       offset[0] = offsetx;
+
+                       error = clSetKernelArg(kernel, offsetIndex, sizeof(cl_int2), &offset);
+                       if (error != CL_SUCCESS) { printf("CLERROR[%d]: %s\n", error, clewErrorString(error)); }
+                       error = clEnqueueNDRangeKernel(queue, kernel, 2, NULL, size, 0, 0, 0, NULL);
+                       if (error != CL_SUCCESS) { printf("CLERROR[%d]: %s\n", error, clewErrorString(error));  }
+                       clFlush(queue);
+               }
+       }
+}
+
+cl_kernel NodeOperation::COM_clCreateKernel(cl_program program, const char *kernelname, list<cl_kernel> *clKernelsToCleanUp) 
+{
+       cl_int error;
+       cl_kernel kernel = clCreateKernel(program, kernelname, &error)  ;
+       if (error != CL_SUCCESS) { printf("CLERROR[%d]: %s\n", error, clewErrorString(error));  
+       }
+       else {
+               if (clKernelsToCleanUp) clKernelsToCleanUp->push_back(kernel);
+       }
+       return kernel;
+       
+}
index 73ba5b472d736c806ef3206fe6b46a5d6ea2a4c5..2219907b0c807fdbde4f344888da1bebf6b1bb38 100644 (file)
@@ -139,8 +139,10 @@ public:
          * @param rect the rectangle of the chunk (location and size)
          * @param chunkNumber the chunkNumber to be calculated
          * @param memoryBuffers all input MemoryBuffer's needed
+         * @param outputBuffer the outputbuffer to write to
          */
-       virtual void executeOpenCLRegion(cl_context context, cl_program program, cl_command_queue queue, rcti *rect, unsigned int chunkNumber, MemoryBuffer** memoryBuffers) {}
+       virtual void executeOpenCLRegion(cl_context context, cl_program program, cl_command_queue queue, rcti *rect, 
+                                        unsigned int chunkNumber, MemoryBuffer** memoryBuffers, MemoryBuffer* outputBuffer) {}
 
        /**
          * @brief custom handle to add new tasks to the OpenCL command queue in order to execute a chunk on an GPUDevice
@@ -207,9 +209,9 @@ public:
        /**
          * @brief get the render priority of this node.
          * @note only applicable for output operations like ViewerOperation
-         * @return [0:9] 9 is highest priority
+         * @return CompositorPriority
          */
-       virtual const int getRenderPriority() const {return 0;}
+       virtual const CompositorPriority getRenderPriority() const {return COM_PRIORITY_LOW;}
 
        /**
          * @brief can this NodeOperation be scheduled on an OpenCLDevice
@@ -242,6 +244,13 @@ protected:
          */
        void setOpenCL(bool openCL) {this->openCL = openCL;}
 
+       static cl_mem COM_clAttachMemoryBufferToKernelParameter(cl_context context, cl_kernel kernel, int parameterIndex, int offsetIndex, list<cl_mem> *cleanup, MemoryBuffer **inputMemoryBuffers, SocketReader* reader);
+       static void COM_clAttachMemoryBufferOffsetToKernelParameter(cl_kernel kernel, int offsetIndex, MemoryBuffer *memoryBuffers);
+       static void COM_clAttachOutputMemoryBufferToKernelParameter(cl_kernel kernel, int parameterIndex, cl_mem clOutputMemoryBuffer);
+       void COM_clAttachSizeToKernelParameter(cl_kernel kernel, int offsetIndex);
+       static void COM_clEnqueueRange(cl_command_queue queue, cl_kernel kernel, MemoryBuffer* outputMemoryBuffer);
+       static void COM_clEnqueueRange(cl_command_queue queue, cl_kernel kernel, MemoryBuffer *outputMemoryBuffer, int offsetIndex);
+       cl_kernel COM_clCreateKernel(cl_program program, const char* kernelname, list<cl_kernel> *clKernelsToCleanUp);
 
 };
 
index 692b96f40b309de237afddacc80be605767f6e1b..e6d3789b06d28f035cc79a76c00acbf0677992ed 100644 (file)
@@ -56,10 +56,10 @@ void OpenCLDevice::execute(WorkPackage *work)
        MemoryBuffer ** inputBuffers = executionGroup->getInputBuffersOpenCL(chunkNumber);
        MemoryBuffer * outputBuffer = executionGroup->allocateOutputBuffer(chunkNumber, &rect);
 
-       executionGroup->getOutputNodeOperation()->executeOpenCLRegion(this->context, this->program, this->queue, &rect, chunkNumber, inputBuffers);
+       executionGroup->getOutputNodeOperation()->executeOpenCLRegion(this->context, this->program, this->queue, &rect, 
+                                                                     chunkNumber, inputBuffers, outputBuffer);
+
+       delete outputBuffer;
        
        executionGroup->finalizeChunkExecution(chunkNumber, inputBuffers);
-       if (outputBuffer != NULL) {
-               outputBuffer->setCreatedState();
-       }
 }
index 80b91b2364c0ff6e341c634b87b0f509b6e35fc9..172107f720b94e220d5301f77e9d0a3bed4849db 100644 (file)
@@ -28,7 +28,7 @@
 #include "COM_OpenCLDevice.h"
 #include "OCL_opencl.h"
 #include "stdio.h"
-#include "COM_OpenCLKernels.cl.cpp"
+#include "COM_OpenCLKernels.cl.h"
 #include "BKE_global.h"
 
 #if COM_CURRENT_THREADING_MODEL == COM_TM_NOTHREAD
@@ -260,7 +260,7 @@ void WorkScheduler::initialize()
                if (totalNumberOfDevices > 0) {
                        context = clCreateContext(NULL, totalNumberOfDevices, cldevices, clContextError, NULL, &error);
                        if (error != CL_SUCCESS) { printf("CLERROR[%d]: %s\n", error, clewErrorString(error));  }
-                       program = clCreateProgramWithSource(context, 1, &sourcecode, 0, &error);
+                       program = clCreateProgramWithSource(context, 1, &clkernelstoh_COM_OpenCLKernels_cl, 0, &error);
                        error = clBuildProgram(program, totalNumberOfDevices, cldevices, 0, 0, 0);
                        if (error != CL_SUCCESS) { 
                                cl_int error2;
index b209e36dd4815d557d2ecf9d08b0423c76d0b2ba..d9cf2c2fef0a4856691441bf6e04746c5beecac3 100644 (file)
@@ -55,7 +55,7 @@ void BlurNode::convertToOperations(ExecutionSystem *graph, CompositorContext * c
                this->getInputSocket(1)->relinkConnections(operationfgb->getInputSocket(1), 1, graph);
                this->getOutputSocket(0)->relinkConnections(operationfgb->getOutputSocket(0));
                graph->addOperation(operationfgb);
-               addPreviewOperation(graph, operationfgb->getOutputSocket(), 5);
+               addPreviewOperation(graph, operationfgb->getOutputSocket());
        }
        else if (!data->bokeh) {
                GaussianXBlurOperation *operationx = new GaussianXBlurOperation();
@@ -71,7 +71,7 @@ void BlurNode::convertToOperations(ExecutionSystem *graph, CompositorContext * c
                graph->addOperation(operationy);
                addLink(graph, operationx->getOutputSocket(), operationy->getInputSocket(0));
                addLink(graph, operationx->getInputSocket(1)->getConnection()->getFromSocket(), operationy->getInputSocket(1));
-               addPreviewOperation(graph, operationy->getOutputSocket(), 5);
+               addPreviewOperation(graph, operationy->getOutputSocket());
 
                if (!connectedSizeSocket) {
                        operationx->setSize(size);
@@ -86,7 +86,7 @@ void BlurNode::convertToOperations(ExecutionSystem *graph, CompositorContext * c
                operation->setQuality(quality);
                graph->addOperation(operation);
                this->getOutputSocket(0)->relinkConnections(operation->getOutputSocket());
-               addPreviewOperation(graph, operation->getOutputSocket(), 5);
+               addPreviewOperation(graph, operation->getOutputSocket());
 
                if (!connectedSizeSocket) {
                        operation->setSize(size);
index d6f4f58fe7000541bb054f64e5821a4ab2acde34..abae1b8889087cb36ed89f86eecbcc4e2f0d809e 100644 (file)
@@ -41,9 +41,9 @@ void BokehBlurNode::convertToOperations(ExecutionSystem *graph, CompositorContex
        if (this->getInputSocket(2)->isConnected()) {
                VariableSizeBokehBlurOperation *operation = new VariableSizeBokehBlurOperation();
                ConvertDepthToRadiusOperation *converter = new ConvertDepthToRadiusOperation();
-               converter->setfStop(4.0f);
+               converter->setfStop(this->getbNode()->custom3);
                converter->setCameraObject(camob);
-               operation->setMaxBlur(16);
+               operation->setMaxBlur((int)this->getbNode()->custom4);
                operation->setQuality(context->getQuality());
                this->getInputSocket(0)->relinkConnections(operation->getInputSocket(0), 0, graph);
                this->getInputSocket(1)->relinkConnections(operation->getInputSocket(1), 1, graph);
index 35511d213f51b1241af6d55dd35e11de63c38861..f498fa11e30052545f868c9704be78f09aca5411 100644 (file)
@@ -35,5 +35,5 @@ void BokehImageNode::convertToOperations(ExecutionSystem *graph, CompositorConte
        this->getOutputSocket(0)->relinkConnections(operation->getOutputSocket(0));
        graph->addOperation(operation);
        operation->setData((NodeBokehImage*)this->getbNode()->storage);
-       addPreviewOperation(graph, operation->getOutputSocket(0), 9);
+       addPreviewOperation(graph, operation->getOutputSocket(0));
 }
index dbe5b9936dc60dfa387e2cd8b12907c93d2cf31d..f1d5b8d39cc195acbfe005d89a449e912ce24772 100644 (file)
@@ -82,7 +82,7 @@ void ChannelMatteNode::convertToOperations(ExecutionSystem *graph, CompositorCon
        graph->addOperation(operationAlpha);
 
        addLink(graph, operation->getOutputSocket(), operationAlpha->getInputSocket(1));
-       addPreviewOperation(graph, operationAlpha->getOutputSocket(), 9);
+       addPreviewOperation(graph, operationAlpha->getOutputSocket());
 
        if (outputSocketImage->isConnected()) {
                outputSocketImage->relinkConnections(operationAlpha->getOutputSocket());
index dd3b3855e3f22dcb4d710ed33e9327c37d5db804..82059ed84935968b69b9cc84e4d85500b8d0b4e0 100644 (file)
@@ -63,7 +63,7 @@ void ChromaMatteNode::convertToOperations(ExecutionSystem *graph, CompositorCont
        addLink(graph, operation->getOutputSocket(), operationAlpha->getInputSocket(1));
 
        graph->addOperation(operationAlpha);
-       addPreviewOperation(graph, operationAlpha->getOutputSocket(), 9);
+       addPreviewOperation(graph, operationAlpha->getOutputSocket());
 
        if (outputSocketImage->isConnected()) {
                outputSocketImage->relinkConnections(operationAlpha->getOutputSocket());
index d7cde21a9843a0f9df9bd26cd4606ab4e741a243..0d331ed9b057837bcf9d9db8923759c4186d43cf 100644 (file)
@@ -31,16 +31,32 @@ ColorCurveNode::ColorCurveNode(bNode *editorNode): Node(editorNode)
 
 void ColorCurveNode::convertToOperations(ExecutionSystem *graph, CompositorContext * context)
 {
-       ColorCurveOperation *operation = new ColorCurveOperation();
-
-       this->getInputSocket(0)->relinkConnections(operation->getInputSocket(0), 0, graph);
-       this->getInputSocket(1)->relinkConnections(operation->getInputSocket(1), 1, graph);
-       this->getInputSocket(2)->relinkConnections(operation->getInputSocket(2), 2, graph);
-       this->getInputSocket(3)->relinkConnections(operation->getInputSocket(3), 3, graph);
-
-       this->getOutputSocket(0)->relinkConnections(operation->getOutputSocket());
-
-       operation->setCurveMapping((CurveMapping*)this->getbNode()->storage);
-
-       graph->addOperation(operation);
+       if (this->getInputSocket(2)->isConnected() || this->getInputSocket(3)->isConnected()) {
+               ColorCurveOperation *operation = new ColorCurveOperation();
+       
+               this->getInputSocket(0)->relinkConnections(operation->getInputSocket(0), 0, graph);
+               this->getInputSocket(1)->relinkConnections(operation->getInputSocket(1), 1, graph);
+               this->getInputSocket(2)->relinkConnections(operation->getInputSocket(2), 2, graph);
+               this->getInputSocket(3)->relinkConnections(operation->getInputSocket(3), 3, graph);
+       
+               this->getOutputSocket(0)->relinkConnections(operation->getOutputSocket());
+       
+               operation->setCurveMapping((CurveMapping*)this->getbNode()->storage);
+       
+               graph->addOperation(operation);
+       } else {
+               ConstantLevelColorCurveOperation *operation = new ConstantLevelColorCurveOperation();
+       
+               this->getInputSocket(0)->relinkConnections(operation->getInputSocket(0), 0, graph);
+               this->getInputSocket(1)->relinkConnections(operation->getInputSocket(1), 1, graph);
+               bNodeSocketValueRGBA *val = (bNodeSocketValueRGBA*)this->getInputSocket(2)->getbNodeSocket()->default_value;
+               operation->setBlackLevel(val->value);
+               val = (bNodeSocketValueRGBA*)this->getInputSocket(3)->getbNodeSocket()->default_value;
+               operation->setWhiteLevel(val->value);
+               this->getOutputSocket(0)->relinkConnections(operation->getOutputSocket());
+       
+               operation->setCurveMapping((CurveMapping*)this->getbNode()->storage);
+       
+               graph->addOperation(operation);
+       }
 }
index 860d1a011944432eaef5995566e76a8b30311167..ad117e1ca2c1717284437021661bd43d1b172987 100644 (file)
@@ -60,7 +60,7 @@ void ColorMatteNode::convertToOperations(ExecutionSystem *graph, CompositorConte
        addLink(graph, operationRGBToHSV_Image->getInputSocket(0)->getConnection()->getFromSocket(), operationAlpha->getInputSocket(0));
        addLink(graph, operation->getOutputSocket(), operationAlpha->getInputSocket(1));
        graph->addOperation(operationAlpha);
-       addPreviewOperation(graph, operationAlpha->getOutputSocket(), 9);
+       addPreviewOperation(graph, operationAlpha->getOutputSocket());
 
        if (outputSocketImage->isConnected()) {
                outputSocketImage->relinkConnections(operationAlpha->getOutputSocket());
index 57821e7fe27034bbfc8a6f7e125493e91452acf7..e2cc34bb6ce30d96e853295434e15a84437de55d 100644 (file)
@@ -39,6 +39,6 @@ void CompositorNode::convertToOperations(ExecutionSystem *graph, CompositorConte
                imageSocket->relinkConnections(colourAlphaProg->getInputSocket(0));
                alphaSocket->relinkConnections(colourAlphaProg->getInputSocket(1));
                graph->addOperation(colourAlphaProg);
-               addPreviewOperation(graph, colourAlphaProg->getInputSocket(0), 5);
+               addPreviewOperation(graph, colourAlphaProg->getInputSocket(0));
        }
 }
index c26fb4e5c5dffffe2ae683713418848fb7079272..596fefff77c8ac7a160ba06b3d41b22ea32a0741 100644 (file)
@@ -49,5 +49,5 @@ void DifferenceMatteNode::convertToOperations(ExecutionSystem *graph, Compositor
        addLink(graph, operationSet->getOutputSocket(), operation->getInputSocket(1));
        outputSocketImage->relinkConnections(operation->getOutputSocket());
        graph->addOperation(operation);
-       addPreviewOperation(graph, operation->getOutputSocket(), 5);
+       addPreviewOperation(graph, operation->getOutputSocket());
 }
index d7b4e481ec281a8644a91a087f70d7acaa04a624..20a55ae195ca0d5a618ba977e6b91bdc1292d066 100644 (file)
@@ -52,7 +52,7 @@ void DistanceMatteNode::convertToOperations(ExecutionSystem *graph, CompositorCo
        addLink(graph, operation->getOutputSocket(), operationAlpha->getInputSocket(1));
 
        graph->addOperation(operationAlpha);
-       addPreviewOperation(graph, operationAlpha->getOutputSocket(), 9);
+       addPreviewOperation(graph, operationAlpha->getOutputSocket());
 
        if (outputSocketImage->isConnected()) {
                outputSocketImage->relinkConnections(operationAlpha->getOutputSocket());
index bdba69dc47d24e412597961a351f2e76c69cc067..7700bceb4abbf50b68a8067042c4e28e3c7c5bc8 100644 (file)
@@ -76,7 +76,7 @@ void FilterNode::convertToOperations(ExecutionSystem *graph, CompositorContext *
        inputImageSocket->relinkConnections(operation->getInputSocket(0), 1, graph);
        inputSocket->relinkConnections(operation->getInputSocket(1), 0, graph);
        outputSocket->relinkConnections(operation->getOutputSocket());
-       addPreviewOperation(graph, operation->getOutputSocket(0), 5);
+       addPreviewOperation(graph, operation->getOutputSocket(0));
        
        graph->addOperation(operation);
 }
index 7f14b06813671e312209a32288bac991f6f0faa2..cfd530173a98409fbe0258b37a285d2315eafcaa 100644 (file)
@@ -105,7 +105,7 @@ void ImageNode::convertToOperations(ExecutionSystem *graph, CompositorContext *
                                                        break;
                                                        }
                                                        if (index == 0 && operation) {
-                                                               addPreviewOperation(graph, operation->getOutputSocket(), 9);
+                                                               addPreviewOperation(graph, operation->getOutputSocket());
                                                        }
                                                }
                                        }
@@ -123,7 +123,7 @@ void ImageNode::convertToOperations(ExecutionSystem *graph, CompositorContext *
                        operation->setImageUser(imageuser);
                        operation->setFramenumber(framenumber);
                        graph->addOperation(operation);
-                       addPreviewOperation(graph, operation->getOutputSocket(), 9);
+                       addPreviewOperation(graph, operation->getOutputSocket());
                }
                
                if (numberOfOutputs > 1) {
index eb78657f3c4ec99691389e57d8e37a554fe8be92..3797621610676a55aac362a5f9327904712d204c 100644 (file)
@@ -53,7 +53,7 @@ void LuminanceMatteNode::convertToOperations(ExecutionSystem *graph, CompositorC
        addLink(graph, rgbToYUV->getInputSocket(0)->getConnection()->getFromSocket(), operation->getInputSocket(0));
        addLink(graph, operationSet->getOutputSocket(), operation->getInputSocket(1));
        graph->addOperation(operation);
-       addPreviewOperation(graph, operation->getOutputSocket(), 9);
+       addPreviewOperation(graph, operation->getOutputSocket());
 
        if (outputSocketImage->isConnected()) {
                outputSocketImage->relinkConnections(operation->getOutputSocket());
index 86ca5ebc2378adffdd7c14bb4f56b72f5883a79f..42e32a4e55ed764ca1ed017673dac8f43cff8122 100644 (file)
@@ -125,7 +125,7 @@ void MixNode::convertToOperations(ExecutionSystem *graph, CompositorContext * co
        color1Socket->relinkConnections(convertProg->getInputSocket(1), 1, graph);
        color2Socket->relinkConnections(convertProg->getInputSocket(2), 2, graph);
        outputSocket->relinkConnections(convertProg->getOutputSocket(0));
-       addPreviewOperation(graph, convertProg->getOutputSocket(0), 5);
+       addPreviewOperation(graph, convertProg->getOutputSocket(0));
        
        convertProg->getInputSocket(2)->setResizeMode(color2Socket->getResizeMode());
        
index 75831130936b0dbb1da07d2303687b62c9681551..eac581dc903dc7b34ca9b06c958126db2bbae095 100644 (file)
@@ -62,7 +62,7 @@ void MovieClipNode::convertToOperations(ExecutionSystem *graph, CompositorContex
                converter->setFromColorProfile(IB_PROFILE_LINEAR_RGB);
                converter->setToColorProfile(IB_PROFILE_SRGB);
                addLink(graph, operation->getOutputSocket(), converter->getInputSocket(0));
-               addPreviewOperation(graph, converter->getOutputSocket(), 9);
+               addPreviewOperation(graph, converter->getOutputSocket());
                if (outputMovieClip->isConnected()) {
                        outputMovieClip->relinkConnections(converter->getOutputSocket());
                }
@@ -72,7 +72,7 @@ void MovieClipNode::convertToOperations(ExecutionSystem *graph, CompositorContex
                }
        }
        else {
-               addPreviewOperation(graph, operation->getOutputSocket(), 9);
+               addPreviewOperation(graph, operation->getOutputSocket());
                if (outputMovieClip->isConnected()) {
                        outputMovieClip->relinkConnections(operation->getOutputSocket());
                }
index cc060e9f7cde41a3bf0a6a2fd5372b848791d531..ca18ea5fbf75021b551b0d89c62a359ac6b1f539 100644 (file)
@@ -59,7 +59,7 @@ void OutputFileNode::convertToOperations(ExecutionSystem *graph, CompositorConte
                                input->relinkConnections(outputOperation->getInputSocket(i));
                        }
                }
-               if (hasConnections) addPreviewOperation(graph, outputOperation->getInputSocket(0), 5);
+               if (hasConnections) addPreviewOperation(graph, outputOperation->getInputSocket(0));
                
                graph->addOperation(outputOperation);
        }
@@ -81,7 +81,7 @@ void OutputFileNode::convertToOperations(ExecutionSystem *graph, CompositorConte
                                input->relinkConnections(outputOperation->getInputSocket(0));
                                graph->addOperation(outputOperation);
                                if (!previewAdded) {
-                                       addPreviewOperation(graph, outputOperation->getInputSocket(0), 5);
+                                       addPreviewOperation(graph, outputOperation->getInputSocket(0));
                                        previewAdded = true;
                                }
                        }
index 4e99db090e12258dbb7b3b232b2324e110b2f4a0..8216205b9252e976d36e19aea089b19a2a0d10a5 100644 (file)
@@ -63,7 +63,7 @@ void RenderLayersNode::testSocketConnection(ExecutionSystem *system, int outputS
                outputSocket->relinkConnections(operation->getOutputSocket());
                system->addOperation(operation);
                if (outputSocketNumber == 0) { // only do for image socket if connected
-                       addPreviewOperation(system, operation->getOutputSocket(), 9);
+                       addPreviewOperation(system, operation->getOutputSocket());
                }
        }
        else {
@@ -71,7 +71,7 @@ void RenderLayersNode::testSocketConnection(ExecutionSystem *system, int outputS
                        system->addOperation(operation);
                        operation->setScene(scene);
                        operation->setLayerId(layerId);
-                       addPreviewOperation(system, operation->getOutputSocket(), 9);
+                       addPreviewOperation(system, operation->getOutputSocket());
                }
                else {
                        delete operation;
index 9f9efbd8fe571368453c583209d4925b7bd7a487..bf434c164c0205223c8bc89a88012c46a0260f9a 100644 (file)
@@ -45,7 +45,7 @@ void SplitViewerNode::convertToOperations(ExecutionSystem *graph, CompositorCont
                splitViewerOperation->setXSplit(!this->getbNode()->custom2);
                image1Socket->relinkConnections(splitViewerOperation->getInputSocket(0), 0, graph);
                image2Socket->relinkConnections(splitViewerOperation->getInputSocket(1), 1, graph);
-               addPreviewOperation(graph, splitViewerOperation->getInputSocket(0), 0);
+               addPreviewOperation(graph, splitViewerOperation->getInputSocket(0));
                graph->addOperation(splitViewerOperation);
        }
 }
index be8bb623f4c3bc07270be0d9c9b00445d1ad19ca..fe8a8e2250ef75312d4ab14efcaf5950121df4cd 100644 (file)
@@ -39,7 +39,7 @@ void TextureNode::convertToOperations(ExecutionSystem *system, CompositorContext
        operation->setTexture(texture);
        operation->setScene(context->getScene());
        system->addOperation(operation);
-       addPreviewOperation(system, operation->getOutputSocket(), 9);
+       addPreviewOperation(system, operation->getOutputSocket());
 
        if (this->getOutputSocket(0)->isConnected()) {
                TextureAlphaOperation *alphaOperation = new TextureAlphaOperation();
index 679589a7ce12c86150e85fec2f8464cd0e798c66..f5dab52d02169934a66e1feeae8d59a13ec4b14d 100644 (file)
@@ -51,6 +51,6 @@ void ViewerNode::convertToOperations(ExecutionSystem *graph, CompositorContext *
                imageSocket->relinkConnections(viewerOperation->getInputSocket(0), 0, graph);
                alphaSocket->relinkConnections(viewerOperation->getInputSocket(1));
                graph->addOperation(viewerOperation);
-               addPreviewOperation(graph, viewerOperation->getInputSocket(0), 0);
+               addPreviewOperation(graph, viewerOperation->getInputSocket(0));
        }
 }
index 1050fc571940e41fc9b0b2ecc07f3a383b18696b..c48f3b0a291f76737a284acf810fe70e7f31ef8f 100644 (file)
@@ -34,8 +34,9 @@ BokehBlurOperation::BokehBlurOperation() : NodeOperation()
        this->addInputSocket(COM_DT_VALUE);
        this->addOutputSocket(COM_DT_COLOR);
        this->setComplex(true);
+       this->setOpenCL(true);
 
-       this->size = .01;
+       this->size = 1.0f;
 
        this->inputProgram = NULL;
        this->inputBokehProgram = NULL;
@@ -90,7 +91,7 @@ void BokehBlurOperation::executePixel(float *color, int x, int y, MemoryBuffer *
                int bufferwidth = inputBuffer->getWidth();
                int bufferstartx = inputBuffer->getRect()->xmin;
                int bufferstarty = inputBuffer->getRect()->ymin;
-               int pixelSize = this->size*this->getWidth();
+               int pixelSize = this->size*this->getWidth()/100.0f;
 
                int miny = y - pixelSize;
                int maxy = y + pixelSize;
@@ -142,10 +143,10 @@ bool BokehBlurOperation::determineDependingAreaOfInterest(rcti *input, ReadBuffe
        rcti newInput;
        rcti bokehInput;
 
-       newInput.xmax = input->xmax + (size*this->getWidth());
-       newInput.xmin = input->xmin - (size*this->getWidth());
-       newInput.ymax = input->ymax + (size*this->getWidth());
-       newInput.ymin = input->ymin - (size*this->getWidth());
+       newInput.xmax = input->xmax + (size*this->getWidth()/100.0f);
+       newInput.xmin = input->xmin - (size*this->getWidth()/100.0f);
+       newInput.ymax = input->ymax + (size*this->getWidth()/100.0f);
+       newInput.ymin = input->ymin - (size*this->getWidth()/100.0f);
 
        NodeOperation *operation = getInputOperation(1);
        bokehInput.xmax = operation->getWidth();
@@ -165,3 +166,27 @@ bool BokehBlurOperation::determineDependingAreaOfInterest(rcti *input, ReadBuffe
        }
        return false;
 }
+
+static cl_kernel kernel = 0;
+void BokehBlurOperation::executeOpenCL(cl_context context, cl_program program, cl_command_queue queue, 
+                                       MemoryBuffer *outputMemoryBuffer, cl_mem clOutputBuffer, 
+                                       MemoryBuffer **inputMemoryBuffers, list<cl_mem> *clMemToCleanUp, 
+                                       list<cl_kernel> *clKernelsToCleanUp) 
+{
+       if (!kernel) {
+               kernel = COM_clCreateKernel(program, "bokehBlurKernel", NULL);
+       }
+       cl_int radius = this->getWidth()*this->size/100.0f;
+       cl_int step = this->getStep();
+       
+       COM_clAttachMemoryBufferToKernelParameter(context, kernel, 0, -1, clMemToCleanUp, inputMemoryBuffers, this->inputBoundingBoxReader);
+       COM_clAttachMemoryBufferToKernelParameter(context, kernel, 1,  4, clMemToCleanUp, inputMemoryBuffers, this->inputProgram);
+       COM_clAttachMemoryBufferToKernelParameter(context, kernel, 2,  -1, clMemToCleanUp, inputMemoryBuffers, this->inputBokehProgram);
+       COM_clAttachOutputMemoryBufferToKernelParameter(kernel, 3, clOutputBuffer);
+       COM_clAttachMemoryBufferOffsetToKernelParameter(kernel, 5, outputMemoryBuffer);
+       clSetKernelArg(kernel, 6, sizeof(cl_int), &radius);
+       clSetKernelArg(kernel, 7, sizeof(cl_int), &step);
+       COM_clAttachSizeToKernelParameter(kernel, 8);
+       
+       COM_clEnqueueRange(queue, kernel, outputMemoryBuffer, 9);       
+}
index ce14faa859626520f47cb4561e4619d2dd5c1abf..3cdd995b1df5fc38833dd4e829abe7fb5a2cba21 100644 (file)
@@ -56,5 +56,7 @@ public:
        bool determineDependingAreaOfInterest(rcti *input, ReadBufferOperation *readOperation, rcti *output);
 
        void setSize(float size) {this->size = size;}
+       
+       void executeOpenCL(cl_context context, cl_program program, cl_command_queue queue, MemoryBuffer *outputMemoryBuffer, cl_mem clOutputBuffer, MemoryBuffer **inputMemoryBuffers, list<cl_mem> *clMemToCleanUp, list<cl_kernel> *clKernelsToCleanUp);
 };
 #endif
index 8aee54013b19c70eeda57baa2081612b50b6c1a4..069bbde5e735717ef91aca379f91ff039c2a5ca6 100644 (file)
@@ -28,6 +28,7 @@ extern "C" {
        #include "BKE_colortools.h"
 #ifdef __cplusplus
 }
+#include "MEM_guardedalloc.h"
 #endif
 
 ColorCurveOperation::ColorCurveOperation(): CurveBaseOperation()
@@ -59,6 +60,9 @@ void ColorCurveOperation::initExecution()
 
 void ColorCurveOperation::executePixel(float *color, float x, float y, PixelSampler sampler, MemoryBuffer *inputBuffers[])
 {
+       CurveMapping* cumap = this->curveMapping;
+       CurveMapping* workingCopy = (CurveMapping*)MEM_dupallocN(cumap);
+       
        float black[4];
        float white[4];
        float fac[4];
@@ -67,13 +71,13 @@ void ColorCurveOperation::executePixel(float *color, float x, float y, PixelSamp
        this->inputBlackProgram->read(black, x, y, sampler, inputBuffers);
        this->inputWhiteProgram->read(white, x, y, sampler, inputBuffers);
 
-       curvemapping_set_black_white(this->curveMapping, black, white);
+       curvemapping_set_black_white(workingCopy, black, white);
 
        this->inputFacProgram->read(fac, x, y, sampler, inputBuffers);
        this->inputImageProgram->read(image, x, y, sampler, inputBuffers);
 
        if (fac[0] >= 1.0)
-               curvemapping_evaluate_premulRGBF(this->curveMapping, color, image);
+               curvemapping_evaluate_premulRGBF(workingCopy, color, image);
        else if (*fac<=0.0) {
                color[0] = image[0];
                color[1] = image[1];
@@ -81,12 +85,13 @@ void ColorCurveOperation::executePixel(float *color, float x, float y, PixelSamp
        }
        else {
                float col[4], mfac = 1.0f-*fac;
-               curvemapping_evaluate_premulRGBF(this->curveMapping, col, image);
+               curvemapping_evaluate_premulRGBF(workingCopy, col, image);
                color[0] = mfac*image[0] + *fac*col[0];
                color[1] = mfac*image[1] + *fac*col[1];
                color[2] = mfac*image[2] + *fac*col[2];
        }
        color[3] = image[3];
+       MEM_freeN(workingCopy);
 }
 
 void ColorCurveOperation::deinitExecution()
@@ -97,3 +102,61 @@ void ColorCurveOperation::deinitExecution()
        this->inputWhiteProgram = NULL;
        curvemapping_premultiply(this->curveMapping, 1);
 }
+
+
+// Constant level curve mapping
+
+ConstantLevelColorCurveOperation::ConstantLevelColorCurveOperation(): CurveBaseOperation()
+{
+       this->addInputSocket(COM_DT_VALUE);
+       this->addInputSocket(COM_DT_COLOR);
+       this->addOutputSocket(COM_DT_COLOR);
+
+       this->inputFacProgram = NULL;
+       this->inputImageProgram = NULL;
+
+       this->setResolutionInputSocketIndex(1);
+}
+void ConstantLevelColorCurveOperation::initExecution()
+{
+       CurveBaseOperation::initExecution();
+       this->inputFacProgram = this->getInputSocketReader(0);
+       this->inputImageProgram = this->getInputSocketReader(1);
+
+       curvemapping_premultiply(this->curveMapping, 0);
+
+       curvemapping_set_black_white(this->curveMapping, this->black, this->white);
+}
+
+void ConstantLevelColorCurveOperation::executePixel(float *color, float x, float y, PixelSampler sampler, MemoryBuffer *inputBuffers[])
+{
+       float fac[4];
+       float image[4];
+
+
+       this->inputFacProgram->read(fac, x, y, sampler, inputBuffers);
+       this->inputImageProgram->read(image, x, y, sampler, inputBuffers);
+
+       if (fac[0] >= 1.0)
+               curvemapping_evaluate_premulRGBF(this->curveMapping, color, image);
+       else if (*fac<=0.0) {
+               color[0] = image[0];
+               color[1] = image[1];
+               color[2] = image[2];
+       }
+       else {
+               float col[4], mfac = 1.0f-*fac;
+               curvemapping_evaluate_premulRGBF(this->curveMapping, col, image);
+               color[0] = mfac*image[0] + *fac*col[0];
+               color[1] = mfac*image[1] + *fac*col[1];
+               color[2] = mfac*image[2] + *fac*col[2];
+       }
+       color[3] = image[3];
+}
+
+void ConstantLevelColorCurveOperation::deinitExecution()
+{
+       this->inputFacProgram = NULL;
+       this->inputImageProgram = NULL;
+       curvemapping_premultiply(this->curveMapping, 1);
+}
index 15f9fd25e81a0d5fdb2130ee6e2c7b24d50d93e5..6ce5befb14a098187bdc500891f75aec2dec65ba 100644 (file)
@@ -53,4 +53,37 @@ public:
          */
        void deinitExecution();
 };
+
+class ConstantLevelColorCurveOperation : public CurveBaseOperation {
+private:
+       /**
+         * Cached reference to the inputProgram
+         */
+       SocketReader * inputFacProgram;
+       SocketReader * inputImageProgram;
+       float black[3];
+       float white[3];
+       
+public:
+       ConstantLevelColorCurveOperation();
+       
+       /**
+         * the inner loop of this program
+         */
+       void executePixel(float *color, float x, float y, PixelSampler sampler, MemoryBuffer *inputBuffers[]);
+       
+       /**
+         * Initialize the execution
+         */
+       void initExecution();
+       
+       /**
+         * Deinitialize the execution
+         */
+       void deinitExecution();
+       
+       void setBlackLevel(float black[3]) {this->black[0] =black[0];this->black[1] =black[1];this->black[2] =black[2]; }
+       void setWhiteLevel(float white[3]) {this->white[0] =white[0];this->white[1] =white[1];this->white[2] =white[2]; }
+};
+
 #endif
index 41d43f896bb265dc752b67f508a82e3f93236858..13cb4f2832437f1d6dc9547342431eeec9f63b14 100644 (file)
@@ -63,7 +63,7 @@ public:
        bool isOutputOperation(bool rendering) const {return true;}
        void initExecution();
        void deinitExecution();
-       const int getRenderPriority() const {return 7;}
+       const CompositorPriority getRenderPriority() const {return COM_PRIORITY_MEDIUM;}
        void determineResolution(unsigned int resolution[], unsigned int preferredResolution[]);
 };
 #endif
index a742306f4401bafd84d78accd97f4b1e1c65d304..a7c1de323f1d4f7463f27483696046376d575ae4 100644 (file)
@@ -75,7 +75,7 @@ void *MaskOperation::initializeTileData(rcti *rect, MemoryBuffer **memoryBuffers
                float *buffer;
 
                buffer = (float *)MEM_callocN(sizeof(float) * width * height, "rasterized mask");
-               BKE_mask_rasterize(mask, width, height, buffer);
+               BKE_mask_rasterize(mask, width, height, buffer, TRUE, TRUE);
 
                this->rasterizedMask = buffer;
        }
index 40932e54bc7e20432b8db77c3e429014e44b2178..aeccfcab8b5e276bfcded7dacb5580df7fc20c70 100644 (file)
@@ -1,10 +1,52 @@
 /// This file contains all opencl kernels for node-operation implementations 
 
-__kernel void testKernel(__global __write_only image2d_t output)
+// Global SAMPLERS
+const sampler_t SAMPLER_NEAREST      = CLK_NORMALIZED_COORDS_FALSE | CLK_ADDRESS_CLAMP_TO_EDGE | CLK_FILTER_NEAREST;
+
+__constant const int2 zero = {0,0};
+
+// KERNEL --- BOKEH BLUR ---
+__kernel void bokehBlurKernel(__global __read_only image2d_t boundingBox, __global __read_only image2d_t inputImage, 
+                              __global __read_only image2d_t bokehImage, __global __write_only image2d_t output, 
+                              int2 offsetInput, int2 offsetOutput, int radius, int step, int2 dimension, int2 offset) 
 {
-       int x = get_global_id(0);
-       int y = get_global_id(1);
-       int2 coords = {x, y}; 
-       float4 color = {0.0f, 1.0f, 0.0f, 1.0f};
+       int2 coords = {get_global_id(0), get_global_id(1)}; 
+       coords += offset;
+       float tempBoundingBox;
+       float4 color = {0.0f,0.0f,0.0f,0.0f};
+       float4 multiplyer = {0.0f,0.0f,0.0f,0.0f};
+       float4 bokeh;
+       const float radius2 = radius*2.0f;
+       const int2 realCoordinate = coords + offsetOutput;
+
+       tempBoundingBox = read_imagef(boundingBox, SAMPLER_NEAREST, coords).s0;
+
+       if (tempBoundingBox > 0.0f) {
+               const int2 bokehImageDim = get_image_dim(bokehImage);
+               const int2 bokehImageCenter = bokehImageDim/2;
+               const int2 minXY = max(realCoordinate - radius, zero);
+               const int2 maxXY = min(realCoordinate + radius, dimension);
+               int nx, ny;
+               
+               float2 uv;
+               int2 inputXy;
+               
+               for (ny = minXY.y, inputXy.y = ny - offsetInput.y ; ny < maxXY.y ; ny +=step, inputXy.y+=step) {
+                       uv.y = ((realCoordinate.y-ny)/radius2)*bokehImageDim.y+bokehImageCenter.y;
+                       
+                       for (nx = minXY.x, inputXy.x = nx - offsetInput.x; nx < maxXY.x ; nx +=step, inputXy.x+=step) {
+                               uv.x = ((realCoordinate.x-nx)/radius2)*bokehImageDim.x+bokehImageCenter.x;
+                               bokeh = read_imagef(bokehImage, SAMPLER_NEAREST, uv);
+                               color += bokeh * read_imagef(inputImage, SAMPLER_NEAREST, inputXy);
+                               multiplyer += bokeh;
+                       }
+               }
+               color /= multiplyer;
+               
+       } else {
+               int2 imageCoordinates = realCoordinate - offsetInput;
+               color = read_imagef(inputImage, SAMPLER_NEAREST, imageCoordinates);
+       }
+       
        write_imagef(output, coords, color);
 }
diff --git a/source/blender/compositor/operations/COM_OpenCLKernels.cl.cpp b/source/blender/compositor/operations/COM_OpenCLKernels.cl.cpp
deleted file mode 100644 (file)
index 1024d46..0000000
+++ /dev/null
@@ -1,15 +0,0 @@
-/// @todo: this source needs to be generated from COM_OpenCLKernels.cl.
-/// not implemented yet. new data to h
-
-const char *sourcecode = "/// This file contains all opencl kernels for node-operation implementations \n" \
-"\n" \
-"__kernel void testKernel(__global __write_only image2d_t output)\n" \
-"{\n" \
-"      int x = get_global_id(0);\n" \
-"      int y = get_global_id(1);\n" \
-"      int2 coords = {x, y}; \n" \
-"      float4 color = {0.0f, 1.0f, 0.0f, 1.0f};\n" \
-"      write_imagef(output, coords, color);\n" \
-"}\n" \
-"\0\n";
-
diff --git a/source/blender/compositor/operations/COM_OpenCLKernels.cl.h b/source/blender/compositor/operations/COM_OpenCLKernels.cl.h
new file mode 100644 (file)
index 0000000..3cf33c7
--- /dev/null
@@ -0,0 +1,55 @@
+/* clkernelstoh output of file <COM_OpenCLKernels_cl> */
+
+const char * clkernelstoh_COM_OpenCLKernels_cl = "/// This file contains all opencl kernels for node-operation implementations\n" \
+"\n" \
+"// Global SAMPLERS\n" \
+"const sampler_t SAMPLER_NEAREST      = CLK_NORMALIZED_COORDS_FALSE | CLK_ADDRESS_CLAMP_TO_EDGE | CLK_FILTER_NEAREST;\n" \
+"\n" \
+"__constant const int2 zero = {0,0};\n" \
+"\n" \
+"// KERNEL --- BOKEH BLUR ---\n" \
+"__kernel void bokehBlurKernel(__global __read_only image2d_t boundingBox, __global __read_only image2d_t inputImage,\n" \
+"                              __global __read_only image2d_t bokehImage, __global __write_only image2d_t output,\n" \
+"                              int2 offsetInput, int2 offsetOutput, int radius, int step, int2 dimension, int2 offset)\n" \
+"{\n" \
+"      int2 coords = {get_global_id(0), get_global_id(1)};\n" \
+"      coords += offset;\n" \
+"      float tempBoundingBox;\n" \
+"      float4 color = {0.0f,0.0f,0.0f,0.0f};\n" \
+"      float4 multiplyer = {0.0f,0.0f,0.0f,0.0f};\n" \
+"      float4 bokeh;\n" \
+"      const float radius2 = radius*2.0f;\n" \
+"      const int2 realCoordinate = coords + offsetOutput;\n" \
+"\n" \
+"      tempBoundingBox = read_imagef(boundingBox, SAMPLER_NEAREST, coords).s0;\n" \
+"\n" \
+"      if (tempBoundingBox > 0.0f) {\n" \
+"              const int2 bokehImageDim = get_image_dim(bokehImage);\n" \
+"              const int2 bokehImageCenter = bokehImageDim/2;\n" \
+"              const int2 minXY = max(realCoordinate - radius, zero);;\n" \
+"              const int2 maxXY = min(realCoordinate + radius, dimension);;\n" \
+"              int nx, ny;\n" \
+"\n" \
+"              float2 uv;\n" \
+"              int2 inputXy;\n" \
+"\n" \
+"              for (ny = minXY.y, inputXy.y = ny - offsetInput.y ; ny < maxXY.y ; ny +=step, inputXy.y+=step) {\n" \
+"                      uv.y = ((realCoordinate.y-ny)/radius2)*bokehImageDim.y+bokehImageCenter.y;\n" \
+"\n" \
+"                      for (nx = minXY.x, inputXy.x = nx - offsetInput.x; nx < maxXY.x ; nx +=step, inputXy.x+=step) {\n" \
+"                              uv.x = ((realCoordinate.x-nx)/radius2)*bokehImageDim.x+bokehImageCenter.x;\n" \
+"                              bokeh = read_imagef(bokehImage, SAMPLER_NEAREST, uv);\n" \
+"                              color += bokeh * read_imagef(inputImage, SAMPLER_NEAREST, inputXy);\n" \
+"                              multiplyer += bokeh;\n" \
+"                      }\n" \
+"              }\n" \
+"              color /= multiplyer;\n" \
+"\n" \
+"      } else {\n" \
+"              int2 imageCoordinates = realCoordinate - offsetInput;\n" \
+"              color = read_imagef(inputImage, SAMPLER_NEAREST, imageCoordinates);\n" \
+"      }\n" \
+"\n" \
+"      write_imagef(output, coords, color);\n" \
+"}\n" \
+"\0";
index 0e37432ca5ba0bdc5516bd1013419bc7512ae902..9b9fb02346757649c59a54f667f2bcc332acdc08 100644 (file)
@@ -49,7 +49,7 @@ public:
        bool isOutputOperation(bool rendering) const {return true;}
        void initExecution();
        void deinitExecution();
-       const int getRenderPriority() const {return 7;}
+       const CompositorPriority getRenderPriority() const {return COM_PRIORITY_LOW;}
 };
 
 /* extra info for OpenEXR layers */
@@ -83,7 +83,7 @@ public:
        bool isOutputOperation(bool rendering) const {return true;}
        void initExecution();
        void deinitExecution();
-       const int getRenderPriority() const {return 7;}
+       const CompositorPriority getRenderPriority() const {return COM_PRIORITY_LOW;}
 };
 
 #endif
index a7b6fc93b25f18390816cf89b4ef93a2ca895908..4975f13a285fdc72448dd7714333040d7f8cbe92 100644 (file)
@@ -46,7 +46,6 @@ PreviewOperation::PreviewOperation() : NodeOperation()
        this->input = NULL;
        this->divider = 1.0f;
        this->node = NULL;
-       this->priority = 0;
 }
 
 void PreviewOperation::initExecution()
@@ -129,7 +128,7 @@ void PreviewOperation::determineResolution(unsigned int resolution[], unsigned i
        resolution[1] = height;
 }
 
-const int PreviewOperation::getRenderPriority() const
+const CompositorPriority PreviewOperation::getRenderPriority() const
 {
-       return this->priority;
+       return COM_PRIORITY_LOW;
 }
index 8450b7fc556ca139e167df785e0701de8fed41f2..3d1cd38a5ea4dea6f8db0f707499d84ddd152933 100644 (file)
@@ -37,20 +37,18 @@ protected:
        const bNodeTree *tree;
        SocketReader *input;
        float divider;
-       int priority;
 
 public:
        PreviewOperation();
        bool isOutputOperation(bool rendering) const {return true;}
        void initExecution();
        void deinitExecution();
-       const int getRenderPriority() const;
+       const CompositorPriority getRenderPriority() const;
        
        void executeRegion(rcti *rect, unsigned int tileNumber, MemoryBuffer **memoryBuffers);
        void determineResolution(unsigned int resolution[], unsigned int preferredResolution[]);
        void setbNode(bNode *node) { this->node = node;}
        void setbNodeTree(const bNodeTree *tree) { this->tree = tree;}
        bool determineDependingAreaOfInterest(rcti *input, ReadBufferOperation *readOperation, rcti *output);
-       void setPriority(int priority) { this->priority = priority; }
 };
 #endif
index 71fc53e8f8e167efe48c8f548bd5bccb9fa30327..809c688195f93bd535cda4a88d8cfe611283e00a 100644 (file)
@@ -88,12 +88,12 @@ void ViewerBaseOperation::deinitExecution()
        this->outputBuffer = NULL;
 }
 
-const int ViewerBaseOperation::getRenderPriority() const
+const CompositorPriority ViewerBaseOperation::getRenderPriority() const
 {
        if (this->isActiveViewerOutput()) {
-               return 8;
+               return COM_PRIORITY_HIGH;
        }
        else {
-               return 0;
+               return COM_PRIORITY_LOW;
        }
 }
index f5f30809f6504969d0c79ed464fa3224e202f1a5..51fa8cecc0d752226dc04ca2509e8faca6b3318c 100644 (file)
@@ -56,7 +56,7 @@ public:
        float getCenterX() { return this->centerX; }
        float getCenterY() { return this->centerY; }
        OrderOfChunks getChunkOrder() { return this->chunkOrder; }
-       const int getRenderPriority() const;
+       const CompositorPriority getRenderPriority() const;
        void setColorManagement(bool doColorManagement) {this->doColorManagement = doColorManagement;}
        void setColorPredivide(bool doColorPredivide) {this->doColorPredivide = doColorPredivide;}
        bool isViewerOperation() {return true;}
index 498add2fc870396af21288c318216eed3bbfa259..222b879645cd0eb1f195e0b4fe0dfdb232fedd56 100644 (file)
@@ -111,10 +111,9 @@ void WriteBufferOperation::executeRegion(rcti *rect, unsigned int tileNumber, Me
        memoryBuffer->setCreatedState();
 }
 
-void WriteBufferOperation::executeOpenCLRegion(cl_context context, cl_program program, cl_command_queue queue, rcti *rect, unsigned int chunkNumber, MemoryBuffer** inputMemoryBuffers)
+void WriteBufferOperation::executeOpenCLRegion(cl_context context, cl_program program, cl_command_queue queue, rcti *rect, unsigned int chunkNumber, MemoryBuffer** inputMemoryBuffers, MemoryBuffer* outputBuffer)
 {
-       MemoryBuffer *outputMemoryBuffer = this->getMemoryProxy()->getBuffer();// @todo wrong implementation needs revision
-       float *outputFloatBuffer = outputMemoryBuffer->getBuffer();
+       float *outputFloatBuffer = outputBuffer->getBuffer();
        cl_int error;
        /*
         * 1. create cl_mem from outputbuffer
@@ -125,8 +124,8 @@ void WriteBufferOperation::executeOpenCLRegion(cl_context context, cl_program pr
         * note: list of cl_mem will be filled by 2, and needs to be cleaned up by 4
         */
        // STEP 1
-       const unsigned int outputBufferWidth = outputMemoryBuffer->getWidth();
-       const unsigned int outputBufferHeight = outputMemoryBuffer->getHeight();
+       const unsigned int outputBufferWidth = outputBuffer->getWidth();
+       const unsigned int outputBufferHeight = outputBuffer->getHeight();
 
        const cl_image_format imageFormat = {
                CL_RGBA,
@@ -141,19 +140,26 @@ void WriteBufferOperation::executeOpenCLRegion(cl_context context, cl_program pr
        clMemToCleanUp->push_back(clOutputBuffer);
        list<cl_kernel> *clKernelsToCleanUp = new list<cl_kernel>();
 
-       this->input->executeOpenCL(context, program, queue, outputMemoryBuffer, clOutputBuffer, inputMemoryBuffers, clMemToCleanUp, clKernelsToCleanUp);
+       this->input->executeOpenCL(context, program, queue, outputBuffer, clOutputBuffer, inputMemoryBuffers, clMemToCleanUp, clKernelsToCleanUp);
 
        // STEP 3
 
        size_t origin[3] = {0,0,0};
        size_t region[3] = {outputBufferWidth,outputBufferHeight,1};
 
+//     clFlush(queue);
+//     clFinish(queue);
+
        error = clEnqueueBarrier(queue);
        if (error != CL_SUCCESS) { printf("CLERROR[%d]: %s\n", error, clewErrorString(error));  }
        error = clEnqueueReadImage(queue, clOutputBuffer, CL_TRUE, origin, region, 0, 0, outputFloatBuffer, 0, NULL, NULL);
        if (error != CL_SUCCESS) { printf("CLERROR[%d]: %s\n", error, clewErrorString(error));  }
+       
+       this->getMemoryProxy()->getBuffer()->copyContentFrom(outputBuffer);
+       
        // STEP 4
 
+       
        while (clMemToCleanUp->size()>0) {
                cl_mem mem = clMemToCleanUp->front();
                error = clReleaseMemObject(mem);
index b17122d68f05bfa5e2e653199f28f21e17f4c854..6f2c49c49bd616c6106346429bfe5308e3236b16 100644 (file)
@@ -46,7 +46,7 @@ public:
        void initExecution();
        void deinitExecution();
        void setbNodeTree(const bNodeTree *tree) {this->tree = tree;}
-       void executeOpenCLRegion(cl_context context, cl_program program, cl_command_queue queue, rcti *rect, unsigned int chunkNumber, MemoryBuffer** memoryBuffers);
+       void executeOpenCLRegion(cl_context context, cl_program program, cl_command_queue queue, rcti *rect, unsigned int chunkNumber, MemoryBuffer** memoryBuffers, MemoryBuffer* outputBuffer);
 
 };
 #endif
index 4f24d254cbfdf5ea11a8d42fd8a8d6a8e8a9b87c..d91b29bb2816849edcd683b98be1a3b7ffd3856d 100644 (file)
@@ -89,15 +89,15 @@ typedef struct bAnimContext {
 
 /* Main Data container types */
 typedef enum eAnimCont_Types {
-       ANIMCONT_NONE = 0,      /* invalid or no data */
-       ANIMCONT_ACTION,        /* action (bAction) */
-       ANIMCONT_SHAPEKEY,      /* shapekey (Key) */
-       ANIMCONT_GPENCIL,       /* grease pencil (screen) */
-       ANIMCONT_DOPESHEET,     /* dopesheet (bDopesheet) */
-       ANIMCONT_FCURVES,       /* animation F-Curves (bDopesheet) */
-       ANIMCONT_DRIVERS,       /* drivers (bDopesheet) */
-       ANIMCONT_NLA,           /* nla (bDopesheet) */
-       ANIMCONT_CHANNEL        /* animation channel (bAnimListElem) */
+       ANIMCONT_NONE      = 0, /* invalid or no data */
+       ANIMCONT_ACTION    = 1, /* action (bAction) */
+       ANIMCONT_SHAPEKEY  = 2, /* shapekey (Key) */
+       ANIMCONT_GPENCIL   = 3, /* grease pencil (screen) */
+       ANIMCONT_DOPESHEET = 4, /* dopesheet (bDopesheet) */
+       ANIMCONT_FCURVES   = 5, /* animation F-Curves (bDopesheet) */
+       ANIMCONT_DRIVERS   = 6, /* drivers (bDopesheet) */
+       ANIMCONT_NLA       = 7, /* nla (bDopesheet) */
+       ANIMCONT_CHANNEL   = 8  /* animation channel (bAnimListElem) */
 } eAnimCont_Types;
 
 /* --------------- Channels -------------------- */
@@ -341,20 +341,20 @@ short ANIM_animdata_context_getdata(bAnimContext *ac);
 
 /* flag-setting behavior */
 typedef enum eAnimChannels_SetFlag {
-       ACHANNEL_SETFLAG_CLEAR = 0,     /* turn off */
-       ACHANNEL_SETFLAG_ADD,           /* turn on */
-       ACHANNEL_SETFLAG_INVERT,        /* on->off, off->on */
-       ACHANNEL_SETFLAG_TOGGLE         /* some on -> all off // all on */
+       ACHANNEL_SETFLAG_CLEAR  = 0,     /* turn off */
+       ACHANNEL_SETFLAG_ADD    = 1,     /* turn on */
+       ACHANNEL_SETFLAG_INVERT = 2,     /* on->off, off->on */
+       ACHANNEL_SETFLAG_TOGGLE = 3      /* some on -> all off // all on */
 } eAnimChannels_SetFlag;
 
 /* types of settings for AnimChannels */
 typedef enum eAnimChannel_Settings {
-       ACHANNEL_SETTING_SELECT = 0,
-       ACHANNEL_SETTING_PROTECT,           // warning: for drawing UI's, need to check if this is off (maybe inverse this later)
-       ACHANNEL_SETTING_MUTE,
-       ACHANNEL_SETTING_EXPAND,
-       ACHANNEL_SETTING_VISIBLE,           /* only for Graph Editor */
-       ACHANNEL_SETTING_SOLO               /* only for NLA Tracks */
+       ACHANNEL_SETTING_SELECT   = 0,
+       ACHANNEL_SETTING_PROTECT  = 1, /* warning: for drawing UI's, need to check if this is off (maybe inverse this later) */
+       ACHANNEL_SETTING_MUTE     = 2,
+       ACHANNEL_SETTING_EXPAND   = 3,
+       ACHANNEL_SETTING_VISIBLE  = 4,  /* only for Graph Editor */
+       ACHANNEL_SETTING_SOLO     = 5   /* only for NLA Tracks */
 } eAnimChannel_Settings;
 
 
index 2ef5277a3c667f7e0f4adb0971b45b175d468d39..51df30d6c285b120fb324f3308d2eef70b05a6cf 100644 (file)
@@ -151,6 +151,7 @@ enum {
        
        TH_SEQ_MOVIE,
        TH_SEQ_MOVIECLIP,
+       TH_SEQ_MASK,
        TH_SEQ_IMAGE,
        TH_SEQ_SCENE,
        TH_SEQ_AUDIO,
index 2e70a941a54331f459e00c6332e618edfbfe2412..02f34873ea77fd82338f6d06c298f0dfebe505fd 100644 (file)
@@ -372,6 +372,8 @@ const unsigned char *UI_ThemeGetColorPtr(bTheme *btheme, int spacetype, int colo
                                        cp = ts->movie; break;
                                case TH_SEQ_MOVIECLIP:
                                        cp = ts->movieclip; break;
+                               case TH_SEQ_MASK:
+                                       cp = ts->mask; break;
                                case TH_SEQ_IMAGE:
                                        cp = ts->image; break;
                                case TH_SEQ_SCENE:
@@ -819,6 +821,7 @@ void ui_theme_init_default(void)
        rgba_char_args_set(btheme->tseq.back,   116, 116, 116, 255);
        rgba_char_args_set(btheme->tseq.movie,  81, 105, 135, 255);
        rgba_char_args_set(btheme->tseq.movieclip,  32, 32, 143, 255);
+       rgba_char_args_set(btheme->tseq.mask,   152, 78, 62, 255);
        rgba_char_args_set(btheme->tseq.image,  109, 88, 129, 255);
        rgba_char_args_set(btheme->tseq.scene,  78, 152, 62, 255);
        rgba_char_args_set(btheme->tseq.audio,  46, 143, 143, 255);
@@ -1899,6 +1902,15 @@ void init_userdef_do_versions(void)
                }
        }
 
+       if (bmain->versionfile < 263 || (bmain->versionfile == 263 && bmain->subversionfile < 11)) {
+               bTheme *btheme;
+               for (btheme = U.themes.first; btheme; btheme = btheme->next) {
+                       if (btheme->tseq.movieclip[0] == 0) {
+                               rgba_char_args_set(btheme->tseq.mask,  152, 78, 62, 255);
+                       }
+               }
+       }
+
        /* GL Texture Garbage Collection (variable abused above!) */
        if (U.textimeout == 0) {
                U.texcollectrate = 60;
index f81496c377a511e5fe133665406d47655ff3ca98..0bc9adb65778c9864a4aa7856aca14a9772bfee9 100644 (file)
@@ -448,6 +448,7 @@ static int add_vertex_extrude(bContext *C, Mask *mask, MaskLayer *masklay, const
                do_recalc_src = TRUE;
        }
        else {
+               do_prev = FALSE;  /* quiet warning */
                /* should never get here */
                BLI_assert(0);
        }
index a26ae5ea3c0c515979059573bf03895d1d80e2e5..e1efb6d841b1b517c0f6a226dec1ec8e1c020566 100644 (file)
@@ -100,7 +100,7 @@ static void draw_spline_parents(MaskLayer *UNUSED(masklay), MaskSpline *spline)
                MaskSplinePoint *point = &points_array[i];
                BezTriple *bezt = &point->bezt;
 
-               if (point->parent.flag & MASK_PARENT_ACTIVE) {
+               if (point->parent.id) {
                        glVertex2f(bezt->vec[1][0],
                                   bezt->vec[1][1]);
 
index 9bfcd2a988679668ed95f1e08003ca0973f703ae..6a59279934e950bf80e7a03d22113c917c4e0de8 100644 (file)
@@ -35,6 +35,8 @@
 #include "BKE_context.h"
 #include "BKE_mask.h"
 
+#include "DNA_scene_types.h"
+
 #include "WM_api.h"
 #include "WM_types.h"
 
@@ -132,16 +134,24 @@ void ED_mask_point_pos__reverse(bContext *C, float x, float y, float *xr, float
 
 void ED_mask_size(bContext *C, int *width, int *height)
 {
-       SpaceClip *sc = CTX_wm_space_clip(C);
-
-       if (sc) {
-               ED_space_clip_mask_size(sc, width, height);
-       }
-       else {
-               /* possible other spaces from which mask editing is available */
-               *width = 0;
-               *height = 0;
+       ScrArea *sa = CTX_wm_area(C);
+       if (sa && sa->spacedata.first) {
+               if (sa->spacetype == SPACE_CLIP) {
+                       SpaceClip *sc = sa->spacedata.first;
+                       ED_space_clip_mask_size(sc, width, height);
+                       return;
+               }
+               else if (sa->spacetype == SPACE_SEQ) {
+                       Scene *scene = CTX_data_scene(C);
+                       *width = (scene->r.size * scene->r.xsch) / 100;
+                       *height = (scene->r.size * scene->r.ysch) / 100;
+                       return;
+               }
        }
+
+       /* possible other spaces from which mask editing is available */
+       *width = 0;
+       *height = 0;
 }
 
 void ED_mask_aspect(bContext *C, float *aspx, float *aspy)
index 0e893ee2f9ff24196e0074192f806080ac3e0c93..7c0a598ba9f8a8f9c5c76bf9433c071fc44ee287 100644 (file)
@@ -66,7 +66,7 @@ static int mask_parent_clear_exec(bContext *C, wmOperator *UNUSED(op))
                                MaskSplinePoint *point = &spline->points[i];
 
                                if (MASKPOINT_ISSEL_ANY(point)) {
-                                       point->parent.flag &= ~MASK_PARENT_ACTIVE;
+                                       point->parent.id = NULL;
                                }
                        }
                }
@@ -141,8 +141,6 @@ static int mask_parent_set_exec(bContext *C, wmOperator *UNUSED(op))
                                        strcpy(point->parent.parent, tracking->name);
                                        strcpy(point->parent.sub_parent, track->name);
 
-                                       point->parent.flag |= MASK_PARENT_ACTIVE;
-
                                        copy_v2_v2(point->parent.parent_orig, parmask_pos);
                                }
                        }
index 6bbcd1d253e2e8e283a94bcf41e7d2c5b7fd53cb..f154aec2eb4f4a941c95eba76f7739c0e77114ca 100644 (file)
@@ -2247,7 +2247,7 @@ static int find_hole_chains(KnifeTool_OpData *kcd, ListBase *hole, BMFace *f, Li
        ListBase *chain;
        BMVert *v;
        BMIter iter;
-       int nh, nf, i, j, k, m, ax, ay, ok, sep, bestsep;
+       int nh, nf, i, j, k, m, ax, ay, ok, sep = 0 /* Quite warnings */, bestsep;
        int besti[2], bestj[2];
        float d, bestd;
 
index 7dd17e59f6ff45f4b4c3005ed4a4875e81a283d9..d6b5fb9fc10c33e443734682549e74deb8e017f3 100644 (file)
@@ -642,8 +642,10 @@ int ED_object_modifier_apply(ReportList *reports, Scene *scene, Object *ob, Modi
        BLI_remlink(&ob->modifiers, md);
        modifier_free(md);
 
-       /* ensure mesh paint mask layer remains after applying */
-       ED_sculpt_mask_layers_ensure(ob, NULL);
+       if (ob->type == OB_MESH) {
+               /* ensure mesh paint mask layer remains after applying */
+               ED_sculpt_mask_layers_ensure(ob, NULL);
+       }
 
        return 1;
 }
index cd8b9164862a95909a621caf8c35815f94723544..89c328e71d8366142a61dafc6b68558b4f1cd197 100644 (file)
@@ -265,7 +265,7 @@ static void get_pbvh_nodes(PBVH *pbvh,
                            float clip_planes[4][4],
                            PartialVisArea mode)
 {
-       BLI_pbvh_SearchCallback cb;
+       BLI_pbvh_SearchCallback cb = NULL;
 
        /* select search callback */
        switch (mode) {
@@ -277,7 +277,6 @@ static void get_pbvh_nodes(PBVH *pbvh,
                        break;
                case PARTIALVIS_ALL:
                case PARTIALVIS_MASKED:
-                       cb = NULL;
                        break;
        }
        
index e069a6b9663e5d43573542aad8fc64c7691fe2fd..6a9257ecb6ae7797a7c3140bc0a771e2de2e21c1 100644 (file)
@@ -753,8 +753,8 @@ static float tex_strength(SculptSession *ss, Brush *br, float point[3],
        else if (ss->texcache) {
                float rotation = -mtex->rot;
                float symm_point[3], point_2d[2];
-               float x, y;
-               float radius;
+               float x = 0.0f, y = 0.0f; /* Quite warnings */
+               float radius = 1.0f; /* Quite warnings */
 
                /* if the active area is being applied for symmetry, flip it
                 * across the symmetry axis and rotate it back to the original
index 4884171364e2bed13eb055d3d24a4a1dd9f52f59..65d2b8f23b32ab70a70bf3cf74c8fe63411bc98f 100644 (file)
@@ -2320,17 +2320,20 @@ static Object *get_orientation_object(bContext *C)
 
 static int set_orientation_poll(bContext *C)
 {
-       Scene *scene = CTX_data_scene(C);
        SpaceClip *sc = CTX_wm_space_clip(C);
-       MovieClip *clip = ED_space_clip(sc);
-       MovieTracking *tracking = &clip->tracking;
-       MovieTrackingObject *tracking_object = BKE_tracking_active_object(tracking);
 
-       if (tracking_object->flag & TRACKING_OBJECT_CAMERA) {
-               return TRUE;
-       }
-       else {
-               return OBACT != NULL;
+       if (sc) {
+               Scene *scene = CTX_data_scene(C);
+               MovieClip *clip = ED_space_clip(sc);
+               MovieTracking *tracking = &clip->tracking;
+               MovieTrackingObject *tracking_object = BKE_tracking_active_object(tracking);
+
+               if (tracking_object->flag & TRACKING_OBJECT_CAMERA) {
+                       return TRUE;
+               }
+               else {
+                       return OBACT != NULL;
+               }
        }
 
        return FALSE;
@@ -2929,11 +2932,16 @@ void CLIP_OT_set_scale(wmOperatorType *ot)
 static int set_solution_scale_poll(bContext *C)
 {
        SpaceClip *sc = CTX_wm_space_clip(C);
-       MovieClip *clip = ED_space_clip(sc);
-       MovieTracking *tracking = &clip->tracking;
-       MovieTrackingObject *tracking_object = BKE_tracking_active_object(tracking);
 
-       return (tracking_object->flag & TRACKING_OBJECT_CAMERA) == 0;
+       if (sc) {
+               MovieClip *clip = ED_space_clip(sc);
+               MovieTracking *tracking = &clip->tracking;
+               MovieTrackingObject *tracking_object = BKE_tracking_active_object(tracking);
+
+               return (tracking_object->flag & TRACKING_OBJECT_CAMERA) == 0;
+       }
+
+       return FALSE;
 }
 
 static int set_solution_scale_exec(bContext *C, wmOperator *op)
index b75b3e6aeb3f1125cef23d7a73d0e2414f941968..1a6ec2813fa46da19492787912c68b8ef79efc31 100644 (file)
@@ -2294,7 +2294,7 @@ static void node_composit_buts_bokehimage(uiLayout *layout, bContext *UNUSED(C),
 void node_composit_backdrop_viewer(SpaceNode *snode, ImBuf *backdrop, bNode *node, int x, int y)
 {
 //     node_composit_backdrop_canvas(snode, backdrop, node, x, y);
-       if (node->custom1 == 0) { /// @todo: why did we need this one?
+       if (node->custom1 == 0) {
                const float backdropWidth = backdrop->x;
                const float backdropHeight = backdrop->y;
                const float cx  = x + snode->zoom * backdropWidth * node->custom3;
index e656b1242abd79c8a0e5a1cc102e6a5486db3754..3d01de1c67a45f685b30f8d1d8511a86ad515def 100644 (file)
@@ -651,7 +651,7 @@ static EnumPropertyItem prop_group_op_types[] = {
        {0, "UNLINK",   0, "Unlink Group", ""},
        {1, "LOCAL",    0, "Make Local Group", ""},
        {2, "LINK",     0, "Link Group Objects to Scene", ""},
-       {3, "INSTANCE", 0, "Instance Group in Scene", ""},
+       {3, "INSTANCE", 0, "Instance Groups in Scene", ""},
        {4, "TOGVIS",   0, "Toggle Visible Group", ""},
        {5, "TOGSEL",   0, "Toggle Selectable", ""},
        {6, "TOGREN",   0, "Toggle Renderable", ""},
index 9301f13c8c0e6612a6c9661a04ba492d8974805a..26bedd14d6e268feebb2f5693b50eda0b944c0be 100644 (file)
@@ -46,6 +46,7 @@
 #include "BLI_utildefines.h"
 
 #include "DNA_scene_types.h"
+#include "DNA_mask_types.h"
 #include "DNA_userdef_types.h"
 
 #include "BKE_context.h"
@@ -54,6 +55,8 @@
 #include "BKE_main.h"
 #include "BKE_sequencer.h"
 #include "BKE_movieclip.h"
+#include "BKE_sequencer.h"
+#include "BKE_mask.h"
 #include "BKE_report.h"
 
 #include "WM_api.h"
@@ -360,7 +363,6 @@ static int sequencer_add_movieclip_strip_exec(bContext *C, wmOperator *op)
        return OPERATOR_FINISHED;
 }
 
-
 static int sequencer_add_movieclip_strip_invoke(bContext *C, wmOperator *op, wmEvent *event)
 {
        if (!ED_operator_sequencer_active(C)) {
@@ -377,11 +379,10 @@ static int sequencer_add_movieclip_strip_invoke(bContext *C, wmOperator *op, wmE
        // return WM_menu_invoke(C, op, event);
 }
 
-
 void SEQUENCER_OT_movieclip_strip_add(struct wmOperatorType *ot)
 {
        PropertyRNA *prop;
-       
+
        /* identifiers */
        ot->name = "Add MovieClip Strip";
        ot->idname = "SEQUENCER_OT_movieclip_strip_add";
@@ -392,16 +393,113 @@ void SEQUENCER_OT_movieclip_strip_add(struct wmOperatorType *ot)
        ot->exec = sequencer_add_movieclip_strip_exec;
 
        ot->poll = ED_operator_scene_editable;
-       
+
        /* flags */
        ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
-       
+
        sequencer_generic_props__internal(ot, SEQPROP_STARTFRAME);
        prop = RNA_def_enum(ot->srna, "clip", DummyRNA_NULL_items, 0, "Clip", "");
        RNA_def_enum_funcs(prop, RNA_movieclip_itemf);
        ot->prop = prop;
 }
 
+static int sequencer_add_mask_strip_exec(bContext *C, wmOperator *op)
+{
+       Scene *scene = CTX_data_scene(C);
+       Editing *ed = BKE_sequencer_editing_get(scene, TRUE);
+
+       Mask *mask;
+
+       Sequence *seq;  /* generic strip vars */
+       Strip *strip;
+
+       int start_frame, channel; /* operator props */
+
+       start_frame = RNA_int_get(op->ptr, "frame_start");
+       channel = RNA_int_get(op->ptr, "channel");
+
+       mask = BLI_findlink(&CTX_data_main(C)->mask, RNA_enum_get(op->ptr, "mask"));
+
+       if (mask == NULL) {
+               BKE_report(op->reports, RPT_ERROR, "Mask not found");
+               return OPERATOR_CANCELLED;
+       }
+
+       seq = alloc_sequence(ed->seqbasep, start_frame, channel);
+       seq->type = SEQ_TYPE_MASK;
+       seq->blend_mode = SEQ_TYPE_CROSS;
+       seq->mask = mask;
+
+       if (seq->mask->id.us == 0)
+               seq->mask->id.us = 1;
+
+       /* basic defaults */
+       seq->strip = strip = MEM_callocN(sizeof(Strip), "strip");
+       seq->len = BKE_mask_get_duration(mask);
+       strip->us = 1;
+
+       BLI_strncpy(seq->name + 2, mask->id.name + 2, sizeof(seq->name) - 2);
+       seqbase_unique_name_recursive(&ed->seqbase, seq);
+
+       calc_sequence_disp(scene, seq);
+       BKE_sequencer_sort(scene);
+
+       if (RNA_boolean_get(op->ptr, "replace_sel")) {
+               ED_sequencer_deselect_all(scene);
+               BKE_sequencer_active_set(scene, seq);
+               seq->flag |= SELECT;
+       }
+
+       if (RNA_boolean_get(op->ptr, "overlap") == FALSE) {
+               if (seq_test_overlap(ed->seqbasep, seq)) shuffle_seq(ed->seqbasep, seq, scene);
+       }
+
+       WM_event_add_notifier(C, NC_SCENE | ND_SEQUENCER, scene);
+
+       return OPERATOR_FINISHED;
+}
+
+static int sequencer_add_mask_strip_invoke(bContext *C, wmOperator *op, wmEvent *event)
+{
+       if (!ED_operator_sequencer_active(C)) {
+               BKE_report(op->reports, RPT_ERROR, "Sequencer area not active");
+               return OPERATOR_CANCELLED;
+       }
+
+       if (!RNA_struct_property_is_set(op->ptr, "mask"))
+               return WM_enum_search_invoke(C, op, event);
+
+       sequencer_generic_invoke_xy__internal(C, op, event, 0);
+       return sequencer_add_mask_strip_exec(C, op);
+       // needs a menu
+       // return WM_menu_invoke(C, op, event);
+}
+
+
+void SEQUENCER_OT_mask_strip_add(struct wmOperatorType *ot)
+{
+       PropertyRNA *prop;
+
+       /* identifiers */
+       ot->name = "Add Mask Strip";
+       ot->idname = "SEQUENCER_OT_mask_strip_add";
+       ot->description = "Add a mask strip to the sequencer";
+
+       /* api callbacks */
+       ot->invoke = sequencer_add_mask_strip_invoke;
+       ot->exec = sequencer_add_mask_strip_exec;
+
+       ot->poll = ED_operator_scene_editable;
+
+       /* flags */
+       ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
+
+       sequencer_generic_props__internal(ot, SEQPROP_STARTFRAME);
+       prop = RNA_def_enum(ot->srna, "mask", DummyRNA_NULL_items, 0, "Mask", "");
+       RNA_def_enum_funcs(prop, RNA_mask_itemf);
+       ot->prop = prop;
+}
+
 
 static int sequencer_add_generic_strip_exec(bContext *C, wmOperator *op, SeqLoadFunc seq_load_func)
 {
index cb15eed6a37c58a35e2101202189b15aeec39538..b674943b2dc67128bec1359ef11d1d309cf07733 100644 (file)
@@ -40,6 +40,7 @@
 #include "IMB_imbuf_types.h"
 
 #include "DNA_scene_types.h"
+#include "DNA_mask_types.h"
 #include "DNA_screen_types.h"
 #include "DNA_space_types.h"
 #include "DNA_userdef_types.h"
@@ -58,7 +59,9 @@
 
 #include "ED_anim_api.h"
 #include "ED_markers.h"
+#include "ED_mask.h"
 #include "ED_types.h"
+#include "ED_space_api.h"
 
 #include "UI_interface.h"
 #include "UI_resources.h"
@@ -97,7 +100,11 @@ static void get_seq_color3ubv(Scene *curscene, Sequence *seq, unsigned char col[
                case SEQ_TYPE_MOVIECLIP:
                        UI_GetThemeColor3ubv(TH_SEQ_MOVIECLIP, col);
                        break;
-               
+
+               case SEQ_TYPE_MASK:
+                       UI_GetThemeColor3ubv(TH_SEQ_MASK, col); /* TODO */
+                       break;
+
                case SEQ_TYPE_SCENE:
                        UI_GetThemeColor3ubv(TH_SEQ_SCENE, col);
                
@@ -550,6 +557,16 @@ static void draw_seq_text(View2D *v2d, Sequence *seq, float x1, float x2, float
                                     seq->len, name);
                }
        }
+       else if (seq->type == SEQ_TYPE_MASK) {
+               if (seq->mask && strcmp(name, seq->mask->id.name + 2) != 0) {
+                       BLI_snprintf(str, sizeof(str), "%d | %s: %s",
+                                    seq->len, name, seq->mask->id.name + 2);
+               }
+               else {
+                       BLI_snprintf(str, sizeof(str), "%d | %s",
+                                    seq->len, name);
+               }
+       }
        else if (seq->type == SEQ_TYPE_MULTICAM) {
                BLI_snprintf(str, sizeof(str), "Cam | %s: %d",
                             name, seq->multicam_source);
@@ -969,6 +986,59 @@ void draw_image_seq(const bContext *C, Scene *scene, ARegion *ar, SpaceSeq *sseq
        
        /* ortho at pixel level */
        UI_view2d_view_restore(C);
+
+       //if (sc->mode == SC_MODE_MASKEDIT) {
+       if (sseq->mainb == SEQ_DRAW_IMG_IMBUF) {
+               Sequence *seq_act = BKE_sequencer_active_get(scene);
+
+               if (seq_act && seq_act->type == SEQ_TYPE_MASK && seq_act->mask) {
+                       int x, y;
+                       int width, height;
+                       float zoomx, zoomy;
+
+                       /* frame image */
+                       float maxdim;
+                       float xofs, yofs;
+
+                       /* find window pixel coordinates of origin */
+                       UI_view2d_to_region_no_clip(&ar->v2d, 0.0f, 0.0f, &x, &y);
+
+                       width = v2d->tot.xmax - v2d->tot.xmin;
+                       height = v2d->tot.ymax - v2d->tot.ymin;
+
+                       zoomx = (float)(ar->winrct.xmax - ar->winrct.xmin + 1) / (float)((ar->v2d.cur.xmax - ar->v2d.cur.xmin));
+                       zoomy = (float)(ar->winrct.ymax - ar->winrct.ymin + 1) / (float)((ar->v2d.cur.ymax - ar->v2d.cur.ymin));
+
+                       x += v2d->tot.xmin * zoomx;
+                       y += v2d->tot.ymin * zoomy;
+
+                       /* frame the image */
+                       maxdim = maxf(width, height);
+                       if (width == height) {
+                               xofs = yofs = 0;
+                       }
+                       else if (width < height) {
+                               xofs = ((height - width) / -2.0f) * zoomx;
+                               yofs = 0.0f;
+                       }
+                       else { /* (width > height) */
+                               xofs = 0.0f;
+                               yofs = ((width - height) / -2.0f) * zoomy;
+                       }
+
+                       /* apply transformation so mask editing tools will assume drawing from the origin in normalized space */
+                       glPushMatrix();
+                       glTranslatef(x + xofs, y + yofs, 0);
+                       glScalef(maxdim * zoomx, maxdim * zoomy, 0);
+
+                       ED_mask_draw((bContext *)C, 0, 0); // sc->mask_draw_flag, sc->mask_draw_type
+
+                       ED_region_draw_cb_draw(C, ar, REGION_DRAW_POST_VIEW);
+
+                       glPopMatrix();
+               }
+       }
+
 }
 
 #if 0
index 19cd7ed4ad43f75c2953bc546608a45fecef9e0f..25a322c69051406cb9c96441adb0cfeb66d7b8d8 100644 (file)
@@ -138,6 +138,7 @@ void SEQUENCER_OT_select_grouped(struct wmOperatorType *ot);
 void SEQUENCER_OT_scene_strip_add(struct wmOperatorType *ot);
 void SEQUENCER_OT_movie_strip_add(struct wmOperatorType *ot);
 void SEQUENCER_OT_movieclip_strip_add(struct wmOperatorType *ot);
+void SEQUENCER_OT_mask_strip_add(struct wmOperatorType *ot);
 void SEQUENCER_OT_sound_strip_add(struct wmOperatorType *ot);
 void SEQUENCER_OT_image_strip_add(struct wmOperatorType *ot);
 void SEQUENCER_OT_effect_strip_add(struct wmOperatorType *ot);
index 3a02c90f99a217cff1b70788d1083da366dfb4e2..79ecd9f7481078a8a2d45439b974373ec08d60d5 100644 (file)
@@ -105,6 +105,7 @@ void sequencer_operatortypes(void)
        /* sequencer_add.c */
        WM_operatortype_append(SEQUENCER_OT_scene_strip_add);
        WM_operatortype_append(SEQUENCER_OT_movieclip_strip_add);
+       WM_operatortype_append(SEQUENCER_OT_mask_strip_add);
        WM_operatortype_append(SEQUENCER_OT_movie_strip_add);
        WM_operatortype_append(SEQUENCER_OT_sound_strip_add);
        WM_operatortype_append(SEQUENCER_OT_image_strip_add);
index 261bc57542013bd0342d23b9f9e1d15773144575..b03edfc61b906bc5434d4c986a2c163e932c1024 100644 (file)
@@ -934,7 +934,7 @@ static EnumPropertyItem sequencer_prop_select_grouped_types[] = {
 
 #define SEQ_IS_EFFECT(_seq) (_seq->type & SEQ_TYPE_EFFECT)
 
-#define SEQ_USE_DATA(_seq) (ELEM(_seq->type, SEQ_TYPE_SCENE, SEQ_TYPE_MOVIECLIP) || SEQ_HAS_PATH(_seq))
+#define SEQ_USE_DATA(_seq) (ELEM3(_seq->type, SEQ_TYPE_SCENE, SEQ_TYPE_MOVIECLIP, SEQ_TYPE_MASK) || SEQ_HAS_PATH(_seq))
 
 static short select_grouped_type(Editing *ed, Sequence *actseq)
 {
@@ -1030,6 +1030,17 @@ static short select_grouped_data(Editing *ed, Sequence *actseq)
                }
                SEQ_END;
        }
+       else if (actseq->type == SEQ_TYPE_MASK) {
+               struct Mask *mask = actseq->mask;
+               SEQP_BEGIN (ed, seq)
+               {
+                       if (seq->type == SEQ_TYPE_MASK && seq->mask == mask) {
+                               seq->flag |= SELECT;
+                               changed = TRUE;
+                       }
+               }
+               SEQ_END;
+       }
 
        return changed;
 }
index 4168cb9ac77afdee56be586945e58a82c2b979cf..3643f92d33407e88b46a4b6ca0614d6142b2e298 100644 (file)
@@ -33,6 +33,7 @@
 #include <stdio.h>
 
 #include "DNA_scene_types.h"
+#include "DNA_mask_types.h"
 
 #include "MEM_guardedalloc.h"
 
@@ -380,6 +381,29 @@ static void sequencer_dropboxes(void)
 
 /* ************* end drop *********** */
 
+const char *sequencer_context_dir[] = {"edit_mask", NULL};
+
+static int sequencer_context(const bContext *C, const char *member, bContextDataResult *result)
+{
+       Scene *scene = CTX_data_scene(C);
+
+       if (CTX_data_dir(member)) {
+               CTX_data_dir_set(result, sequencer_context_dir);
+
+               return TRUE;
+       }
+       else if (CTX_data_equals(member, "edit_mask")) {
+               Sequence *seq_act = BKE_sequencer_active_get(scene);
+               if (seq_act && seq_act->type == SEQ_TYPE_MASK && seq_act->mask) {
+                       CTX_data_id_pointer_set(result, &seq_act->mask->id);
+               }
+               return TRUE;
+       }
+
+       return FALSE;
+}
+
+
 /* add handlers, stuff you only do once or on area/region changes */
 static void sequencer_header_area_init(wmWindowManager *UNUSED(wm), ARegion *ar)
 {
@@ -482,6 +506,12 @@ static void sequencer_preview_area_listener(ARegion *ar, wmNotifier *wmn)
                                        break;
                        }
                        break;
+
+               case NC_MASK:
+                       if (wmn->action == NA_EDITED) {
+                               ED_region_tag_redraw(ar);
+                       }
+                       break;
        }
 }
 
@@ -539,6 +569,7 @@ void ED_spacetype_sequencer(void)
        st->duplicate = sequencer_duplicate;
        st->operatortypes = sequencer_operatortypes;
        st->keymap = sequencer_keymap;
+       st->context = sequencer_context;
        st->dropboxes = sequencer_dropboxes;
        st->refresh = sequencer_refresh;
 
@@ -591,4 +622,3 @@ void ED_spacetype_sequencer(void)
                sequencer_view3d_cb = ED_view3d_draw_offscreen_imbuf_simple;
        }
 }
-
index 9cb5ca5da555b42243377faea84d5926afb02f28..b61916f7bfabd65ae9411a406f34c09ceb0d0b9a 100644 (file)
@@ -50,37 +50,37 @@ struct GHash;
 
 /* Data point for motion path (mpv) */
 typedef struct bMotionPathVert {
-       float co[3];                            /* coordinates of point in 3D-space */
-       int flag;                                       /* quick settings */
+       float co[3];                /* coordinates of point in 3D-space */
+       int flag;                   /* quick settings */
 } bMotionPathVert;
 
 /* bMotionPathVert->flag */
 typedef enum eMotionPathVert_Flag {
-               /* vert is selected */
-       MOTIONPATH_VERT_SEL             = (1<<0)
+       /* vert is selected */
+       MOTIONPATH_VERT_SEL     = (1 << 0)
 } eMotionPathVert_Flag;
 
 /* ........ */
 
 /* Motion Path data cache (mpath)
- *     - for elements providing transforms (i.e. Objects or PoseChannels) 
+ *  - for elements providing transforms (i.e. Objects or PoseChannels)
  */
 typedef struct bMotionPath {
-       bMotionPathVert *points;        /* path samples */
-       int     length;                                 /* the number of cached verts */
+       bMotionPathVert *points;    /* path samples */
+       int length;                 /* the number of cached verts */
        
-       int start_frame;                        /* for drawing paths, the start frame number */
-       int     end_frame;                              /* for drawing paths, the end frame number */
+       int start_frame;            /* for drawing paths, the start frame number */
+       int end_frame;              /* for drawing paths, the end frame number */
        
-       int flag;                                       /* baking settings - eMotionPath_Flag */ 
+       int flag;                   /* baking settings - eMotionPath_Flag */
 } bMotionPath;
 
 /* bMotionPath->flag */
 typedef enum eMotionPath_Flag {
-               /* (for bones) path represents the head of the bone */
-       MOTIONPATH_FLAG_BHEAD           = (1<<0),
-               /* motion path is being edited */
-       MOTIONPATH_FLAG_EDIT            = (1<<1)
+       /* (for bones) path represents the head of the bone */
+       MOTIONPATH_FLAG_BHEAD       = (1 << 0),
+       /* motion path is being edited */
+       MOTIONPATH_FLAG_EDIT        = (1 << 1)
 } eMotionPath_Flag;
 
 /* Visualisation General --------------------------- */
@@ -89,83 +89,83 @@ typedef enum eMotionPath_Flag {
 /* Animation Visualisation Settings (avs) */
 typedef struct bAnimVizSettings {
        /* Onion-Skinning Settings ----------------- */
-       int     ghost_sf, ghost_ef;                     /* start and end frames of ghost-drawing range (only used for GHOST_TYPE_RANGE) */
-       int ghost_bc, ghost_ac;                 /* number of frames before/after current frame to show */
+       int ghost_sf, ghost_ef;         /* start and end frames of ghost-drawing range (only used for GHOST_TYPE_RANGE) */
+       int ghost_bc, ghost_ac;         /* number of frames before/after current frame to show */
        
-       short ghost_type;                               /* eOnionSkin_Types */
-       short ghost_step;                               /* number of frames between each ghost shown (not for GHOST_TYPE_KEYS) */
+       short ghost_type;               /* eOnionSkin_Types */
+       short ghost_step;               /* number of frames between each ghost shown (not for GHOST_TYPE_KEYS) */
        
-       short ghost_flag;                               /* eOnionSkin_Flag */
+       short ghost_flag;               /* eOnionSkin_Flag */
        
        /* General Settings ------------------------ */
-       short recalc;                                   /* eAnimViz_RecalcFlags */
+       short recalc;                   /* eAnimViz_RecalcFlags */
        
        /* Motion Path Settings ------------------- */
-       short path_type;                                /* eMotionPath_Types */
-       short path_step;                                /* number of frames between points indicated on the paths */
+       short path_type;                /* eMotionPath_Types */
+       short path_step;                /* number of frames between points indicated on the paths */
        
-       short path_viewflag;                    /* eMotionPaths_ViewFlag */
-       short path_bakeflag;                    /* eMotionPaths_BakeFlag */
+       short path_viewflag;            /* eMotionPaths_ViewFlag */
+       short path_bakeflag;            /* eMotionPaths_BakeFlag */
        
-       int path_sf, path_ef;                   /* start and end frames of path-calculation range */
-       int     path_bc, path_ac;                       /* number of frames before/after current frame to show */
+       int path_sf, path_ef;           /* start and end frames of path-calculation range */
+       int path_bc, path_ac;           /* number of frames before/after current frame to show */
 } bAnimVizSettings;
 
 
 /* bAnimVizSettings->recalc */
 typedef enum eAnimViz_RecalcFlags {
-               /* motionpaths need recalculating */
-       ANIMVIZ_RECALC_PATHS    = (1<<0)
+       /* motionpaths need recalculating */
+       ANIMVIZ_RECALC_PATHS    = (1 << 0)
 } eAnimViz_RecalcFlags;
 
 
 /* bAnimVizSettings->ghost_type */
 typedef enum eOnionSkin_Types {
-               /* no ghosts at all */
+       /* no ghosts at all */
        GHOST_TYPE_NONE = 0,
-               /* around current frame */
-       GHOST_TYPE_ACFRA,
-               /* show ghosts within the specified frame range */
-       GHOST_TYPE_RANGE,
-               /* show ghosts on keyframes within the specified range only */
-       GHOST_TYPE_KEYS
+       /* around current frame */
+       GHOST_TYPE_ACFRA = 1,
+       /* show ghosts within the specified frame range */
+       GHOST_TYPE_RANGE = 2,
+       /* show ghosts on keyframes within the specified range only */
+       GHOST_TYPE_KEYS = 3
 } eOnionSkin_Types;
 
 /* bAnimVizSettings->ghost_flag */
 typedef enum eOnionSkin_Flag {
-               /* only show selected bones in ghosts */
-       GHOST_FLAG_ONLYSEL      = (1<<0)
+       /* only show selected bones in ghosts */
+       GHOST_FLAG_ONLYSEL  = (1 << 0)
 } eOnionSkin_Flag;
 
 
 /* bAnimVizSettings->path_type */
 typedef enum eMotionPaths_Types {
-               /* show the paths along their entire ranges */
+       /* show the paths along their entire ranges */
        MOTIONPATH_TYPE_RANGE = 0,
-               /* only show the parts of the paths around the current frame */
-       MOTIONPATH_TYPE_ACFRA
+       /* only show the parts of the paths around the current frame */
+       MOTIONPATH_TYPE_ACFRA = 1,
 } eMotionPath_Types;
 
 /* bAnimVizSettings->path_viewflag */
 typedef enum eMotionPaths_ViewFlag {
-               /* show frames on path */
-       MOTIONPATH_VIEW_FNUMS           = (1<<0),
-               /* show keyframes on path */
-       MOTIONPATH_VIEW_KFRAS           = (1<<1),
-               /* show keyframe/frame numbers */
-       MOTIONPATH_VIEW_KFNOS           = (1<<2),
-               /* find keyframes in whole action (instead of just in matching group name) */
-       MOTIONPATH_VIEW_KFACT           = (1<<3)
+       /* show frames on path */
+       MOTIONPATH_VIEW_FNUMS       = (1 << 0),
+       /* show keyframes on path */
+       MOTIONPATH_VIEW_KFRAS       = (1 << 1),
+       /* show keyframe/frame numbers */
+       MOTIONPATH_VIEW_KFNOS       = (1 << 2),
+       /* find keyframes in whole action (instead of just in matching group name) */
+       MOTIONPATH_VIEW_KFACT       = (1 << 3)
 } eMotionPath_ViewFlag;
 
 /* bAnimVizSettings->path_bakeflag */
 typedef enum eMotionPaths_BakeFlag {
-               /* motion paths directly associated with this block of settings needs updating */
-       MOTIONPATH_BAKE_NEEDS_RECALC    = (1<<0),
-               /* for bones - calculate head-points for curves instead of tips */
-       MOTIONPATH_BAKE_HEADS                   = (1<<1),
-               /* motion paths exist for AnimVizSettings instance - set when calc for first time, and unset when clearing */
-       MOTIONPATH_BAKE_HAS_PATHS               = (1<<2)
+       /* motion paths directly associated with this block of settings needs updating */
+       MOTIONPATH_BAKE_NEEDS_RECALC    = (1 << 0),
+       /* for bones - calculate head-points for curves instead of tips */
+       MOTIONPATH_BAKE_HEADS           = (1 << 1),
+       /* motion paths exist for AnimVizSettings instance - set when calc for first time, and unset when clearing */
+       MOTIONPATH_BAKE_HAS_PATHS       = (1 << 2)
 } eMotionPath_BakeFlag;
 
 /* ************************************************ */
@@ -179,142 +179,142 @@ typedef enum eMotionPaths_BakeFlag {
  * with respect to the restposition of Armature bones 
  */
 typedef struct bPoseChannel {
-       struct bPoseChannel     *next, *prev;
+       struct bPoseChannel *next, *prev;
        
-       IDProperty                      *prop;          /* User-Defined Properties on this PoseChannel */                       
+       IDProperty          *prop;      /* User-Defined Properties on this PoseChannel */
        
-       ListBase                        constraints;/* Constraints that act on this PoseChannel */
-       char                            name[64];       /* need to match bone name length: MAXBONENAME */
+       ListBase constraints;           /* Constraints that act on this PoseChannel */
+       char name[64];                  /* need to match bone name length: MAXBONENAME */
        
-       short                           flag;           /* dynamic, for detecting transform changes */
-       short                           ikflag;         /* settings for IK bones */
-       short                           protectflag; /* protect channels from being transformed */
-       short                           agrp_index; /* index of action-group this bone belongs to (0 = default/no group) */
-       char                            constflag;  /* for quick detecting which constraints affect this channel */
-       char                selectflag; /* copy of bone flag, so you can work with library armatures, not for runtime use */
-       char                            pad0[6];
+       short flag;                     /* dynamic, for detecting transform changes */
+       short ikflag;                   /* settings for IK bones */
+       short protectflag;              /* protect channels from being transformed */
+       short agrp_index;               /* index of action-group this bone belongs to (0 = default/no group) */
+       char constflag;                 /* for quick detecting which constraints affect this channel */
+       char selectflag;                /* copy of bone flag, so you can work with library armatures, not for runtime use */
+       char pad0[6];
 
-       struct Bone                     *bone;          /* set on read file or rebuild pose */
-       struct bPoseChannel *parent;    /* set on read file or rebuild pose */
-       struct bPoseChannel *child;             /* set on read file or rebuild pose, the 'ik' child, for b-bones */
-       
-       struct ListBase          iktree;                /* "IK trees" - only while evaluating pose */
-       struct ListBase         siktree;                /* Spline-IK "trees" - only while evaluating pose */
-       
-       bMotionPath *mpath;                             /* motion path cache for this bone */
-       struct Object *custom;                  /* draws custom object instead of default bone shape */
-       struct bPoseChannel *custom_tx; /* odd feature, display with another bones transform.
+       struct Bone         *bone;      /* set on read file or rebuild pose */
+       struct bPoseChannel *parent;    /* set on read file or rebuild pose */
+       struct bPoseChannel *child;     /* set on read file or rebuild pose, the 'ik' child, for b-bones */
+
+       struct ListBase iktree;         /* "IK trees" - only while evaluating pose */
+       struct ListBase siktree;        /* Spline-IK "trees" - only while evaluating pose */
+
+       bMotionPath *mpath;             /* motion path cache for this bone */
+       struct Object *custom;          /* draws custom object instead of default bone shape */
+       struct bPoseChannel *custom_tx; /* odd feature, display with another bones transform.
                                         * needed in rare cases for advanced rigs,
                                         * since the alternative is highly complicated - campbell */
 
-               /* transforms - written in by actions or transform */
-       float           loc[3];                         
-       float           size[3];
-       
-               /* rotations - written in by actions or transform (but only one representation gets used at any time) */
-       float           eul[3];                                 /* euler rotation */
-       float           quat[4];                                /* quaternion rotation */
-       float           rotAxis[3], rotAngle;   /* axis-angle rotation */
-       short           rotmode;                                /* eRotationModes - rotation representation to use */
-       short           pad;
+       /* transforms - written in by actions or transform */
+       float loc[3];
+       float size[3];
+
+       /* rotations - written in by actions or transform (but only one representation gets used at any time) */
+       float eul[3];                       /* euler rotation */
+       float quat[4];                      /* quaternion rotation */
+       float rotAxis[3], rotAngle;         /* axis-angle rotation */
+       short rotmode;                      /* eRotationModes - rotation representation to use */
+       short pad;
        
-       float           chan_mat[4][4];         /* matrix result of loc/quat/size , and where we put deform in, see next line */
-       float           pose_mat[4][4];         /* constraints accumulate here. in the end, pose_mat = bone->arm_mat * chan_mat
+       float chan_mat[4][4];           /* matrix result of loc/quat/size , and where we put deform in, see next line */
+       float pose_mat[4][4];           /* constraints accumulate here. in the end, pose_mat = bone->arm_mat * chan_mat
                                         * this matrix is object space */
-       float           constinv[4][4];         /* inverse result of constraints.
+       float constinv[4][4];           /* inverse result of constraints.
                                         * doesn't include effect of restposition, parent, and local transform*/
        
-       float           pose_head[3];           /* actually pose_mat[3] */
-       float           pose_tail[3];           /* also used for drawing help lines... */
+       float pose_head[3];             /* actually pose_mat[3] */
+       float pose_tail[3];             /* also used for drawing help lines... */
        
-       float           limitmin[3], limitmax[3];       /* DOF constraint, note! - these are stored in degrees, not radians */
-       float           stiffness[3];                           /* DOF stiffness */
-       float           ikstretch;
-       float           ikrotweight;            /* weight of joint rotation constraint */
-       float           iklinweight;            /* weight of joint stretch constraint */
+       float limitmin[3], limitmax[3]; /* DOF constraint, note! - these are stored in degrees, not radians */
+       float stiffness[3];             /* DOF stiffness */
+       float ikstretch;
+       float ikrotweight;              /* weight of joint rotation constraint */
+       float iklinweight;              /* weight of joint stretch constraint */
 
-       void            *temp;                          /* use for outliner */
+       void        *temp;              /* use for outliner */
 } bPoseChannel;
 
 
 /* PoseChannel (transform) flags */
 typedef enum ePchan_Flag {
-               /* has transforms */
-       POSE_LOC                =       (1<<0),
-       POSE_ROT                =       (1<<1),
-       POSE_SIZE               =       (1<<2),
-               /* old IK/cache stuff... */
-       POSE_IK_MAT             =       (1<<3),
-       POSE_UNUSED2    =       (1<<4),
-       POSE_UNUSED3    =       (1<<5),
-       POSE_UNUSED4    =       (1<<6),
-       POSE_UNUSED5    =       (1<<7),
-               /* has Standard IK */
-       POSE_HAS_IK             =       (1<<8),
-               /* IK/Pose solving*/
-       POSE_CHAIN              =       (1<<9),
-       POSE_DONE               =   (1<<10),
-               /* visualisation */
-       POSE_KEY                =       (1<<11),
-       POSE_STRIDE             =       (1<<12),
-               /* standard IK solving */
-       POSE_IKTREE             =   (1<<13),
-               /* has Spline IK */
-       POSE_HAS_IKS    =       (1<<14),
-               /* spline IK solving */
-       POSE_IKSPLINE   =       (1<<15)
+       /* has transforms */
+       POSE_LOC        =   (1 << 0),
+       POSE_ROT        =   (1 << 1),
+       POSE_SIZE       =   (1 << 2),
+       /* old IK/cache stuff... */
+       POSE_IK_MAT     =   (1 << 3),
+       POSE_UNUSED2    =   (1 << 4),
+       POSE_UNUSED3    =   (1 << 5),
+       POSE_UNUSED4    =   (1 << 6),
+       POSE_UNUSED5    =   (1 << 7),
+       /* has Standard IK */
+       POSE_HAS_IK     =   (1 << 8),
+       /* IK/Pose solving*/
+       POSE_CHAIN      =   (1 << 9),
+       POSE_DONE       =   (1 << 10),
+       /* visualisation */
+       POSE_KEY        =   (1 << 11),
+       POSE_STRIDE     =   (1 << 12),
+       /* standard IK solving */
+       POSE_IKTREE     =   (1 << 13),
+       /* has Spline IK */
+       POSE_HAS_IKS    =   (1 << 14),
+       /* spline IK solving */
+       POSE_IKSPLINE   =   (1 << 15)
 } ePchan_Flag;
 
 /* PoseChannel constflag (constraint detection) */
 typedef enum ePchan_ConstFlag {
-       PCHAN_HAS_IK            = (1<<0),
-       PCHAN_HAS_CONST         = (1<<1),
-               /* only used for drawing Posemode, not stored in channel */
-       PCHAN_HAS_ACTION        = (1<<2),
-       PCHAN_HAS_TARGET        = (1<<3),
-               /* only for drawing Posemode too */
-       PCHAN_HAS_STRIDE        = (1<<4),
-               /* spline IK */
-       PCHAN_HAS_SPLINEIK      = (1<<5)
+       PCHAN_HAS_IK        = (1 << 0),
+       PCHAN_HAS_CONST     = (1 << 1),
+       /* only used for drawing Posemode, not stored in channel */
+       PCHAN_HAS_ACTION    = (1 << 2),
+       PCHAN_HAS_TARGET    = (1 << 3),
+       /* only for drawing Posemode too */
+       PCHAN_HAS_STRIDE    = (1 << 4),
+       /* spline IK */
+       PCHAN_HAS_SPLINEIK  = (1 << 5)
 } ePchan_ConstFlag;
 
 /* PoseChannel->ikflag */
 typedef enum ePchan_IkFlag {
-       BONE_IK_NO_XDOF = (1<<0),
-       BONE_IK_NO_YDOF = (1<<1),
-       BONE_IK_NO_ZDOF = (1<<2),
+       BONE_IK_NO_XDOF = (1 << 0),
+       BONE_IK_NO_YDOF = (1 << 1),
+       BONE_IK_NO_ZDOF = (1 << 2),
 
-       BONE_IK_XLIMIT  = (1<<3),
-       BONE_IK_YLIMIT  = (1<<4),
-       BONE_IK_ZLIMIT  = (1<<5),
-       
-       BONE_IK_ROTCTL  = (1<<6),
-       BONE_IK_LINCTL  = (1<<7),
+       BONE_IK_XLIMIT  = (1 << 3),
+       BONE_IK_YLIMIT  = (1 << 4),
+       BONE_IK_ZLIMIT  = (1 << 5),
+
+       BONE_IK_ROTCTL  = (1 << 6),
+       BONE_IK_LINCTL  = (1 << 7),
 
-       BONE_IK_NO_XDOF_TEMP = (1<<10),
-       BONE_IK_NO_YDOF_TEMP = (1<<11),
-       BONE_IK_NO_ZDOF_TEMP = (1<<12)
+       BONE_IK_NO_XDOF_TEMP = (1 << 10),
+       BONE_IK_NO_YDOF_TEMP = (1 << 11),
+       BONE_IK_NO_ZDOF_TEMP = (1 << 12)
 } ePchan_IkFlag;
 
 /* PoseChannel->rotmode and Object->rotmode */
 typedef enum eRotationModes {
-               /* quaternion rotations (default, and for older Blender versions) */
-       ROT_MODE_QUAT   = 0,
-               /* euler rotations - keep in sync with enum in BLI_math.h */
-       ROT_MODE_EUL = 1,               /* Blender 'default' (classic) - must be as 1 to sync with BLI_math_rotation.h defines */
+       /* quaternion rotations (default, and for older Blender versions) */
+       ROT_MODE_QUAT   = 0,
+       /* euler rotations - keep in sync with enum in BLI_math.h */
+       ROT_MODE_EUL = 1,       /* Blender 'default' (classic) - must be as 1 to sync with BLI_math_rotation.h defines */
        ROT_MODE_XYZ = 1,
-       ROT_MODE_XZY,
-       ROT_MODE_YXZ,
-       ROT_MODE_YZX,
-       ROT_MODE_ZXY,
-       ROT_MODE_ZYX,
+       ROT_MODE_XZY = 2,
+       ROT_MODE_YXZ = 3,
+       ROT_MODE_YZX = 4,
+       ROT_MODE_ZXY = 5,
+       ROT_MODE_ZYX = 6,
        /* NOTE: space is reserved here for 18 other possible 
         * euler rotation orders not implemented 
         */
-               /* axis angle rotations */
+       /* axis angle rotations */
        ROT_MODE_AXISANGLE = -1,
 
-       ROT_MODE_MIN = ROT_MODE_AXISANGLE,      /* sentinel for Py API */
+       ROT_MODE_MIN = ROT_MODE_AXISANGLE,  /* sentinel for Py API */
        ROT_MODE_MAX = ROT_MODE_ZYX
 } eRotationModes;
 
@@ -326,46 +326,46 @@ typedef enum eRotationModes {
  * though there is a define for it (hack for the outliner).
  */
 typedef struct bPose {
-       ListBase chanbase;                      /* list of pose channels, PoseBones in RNA */
-       struct GHash *chanhash;         /* ghash for quicker string lookups */
+       ListBase chanbase;          /* list of pose channels, PoseBones in RNA */
+       struct GHash *chanhash;     /* ghash for quicker string lookups */
        
        short flag, pad;
-       unsigned int proxy_layer;       /* proxy layer: copy from armature, gets synced */
+       unsigned int proxy_layer;   /* proxy layer: copy from armature, gets synced */
        int pad1;
        
-       float ctime;                            /* local action time of this pose */
-       float stride_offset[3];         /* applied to object */
-       float cyclic_offset[3];         /* result of match and cycles, applied in BKE_pose_where_is() */
+       float ctime;                /* local action time of this pose */
+       float stride_offset[3];     /* applied to object */
+       float cyclic_offset[3];     /* result of match and cycles, applied in BKE_pose_where_is() */
        
        
-       ListBase agroups;                       /* list of bActionGroups */
+       ListBase agroups;           /* list of bActionGroups */
        
-       int active_group;                       /* index of active group (starts from 1) */
-       int     iksolver;                               /* ik solver to use, see ePose_IKSolverType */
-       void *ikdata;                           /* temporary IK data, depends on the IK solver. Not saved in file */
-       void *ikparam;                          /* IK solver parameters, structure depends on iksolver */ 
+       int active_group;           /* index of active group (starts from 1) */
+       int iksolver;               /* ik solver to use, see ePose_IKSolverType */
+       void *ikdata;               /* temporary IK data, depends on the IK solver. Not saved in file */
+       void *ikparam;              /* IK solver parameters, structure depends on iksolver */
        
-       bAnimVizSettings avs;           /* settings for visualization of bone animation */
+       bAnimVizSettings avs;       /* settings for visualization of bone animation */
        char proxy_act_bone[64];    /* proxy active bone name, MAXBONENAME */
 } bPose;
 
 
 /* Pose->flag */
 typedef enum ePose_Flags {
-               /* results in BKE_pose_rebuild being called */
-       POSE_RECALC = (1<<0),
-               /* prevents any channel from getting overridden by anim from IPO */
-       POSE_LOCKED     = (1<<1),
-               /* clears the POSE_LOCKED flag for the next time the pose is evaluated */
-       POSE_DO_UNLOCK  = (1<<2),
-               /* pose has constraints which depend on time (used when depsgraph updates for a new frame) */
-       POSE_CONSTRAINTS_TIMEDEPEND = (1<<3),
-               /* recalculate bone paths */
-       POSE_RECALCPATHS = (1<<4),
-               /* set by BKE_pose_rebuild to give a chance to the IK solver to rebuild IK tree */
-       POSE_WAS_REBUILT = (1<<5),
-               /* set by game_copy_pose to indicate that this pose is used in the game engine */
-       POSE_GAME_ENGINE = (1<<6)
+       /* results in BKE_pose_rebuild being called */
+       POSE_RECALC = (1 << 0),
+       /* prevents any channel from getting overridden by anim from IPO */
+       POSE_LOCKED = (1 << 1),
+       /* clears the POSE_LOCKED flag for the next time the pose is evaluated */
+       POSE_DO_UNLOCK  = (1 << 2),
+       /* pose has constraints which depend on time (used when depsgraph updates for a new frame) */
+       POSE_CONSTRAINTS_TIMEDEPEND = (1 << 3),
+       /* recalculate bone paths */
+       POSE_RECALCPATHS = (1 << 4),
+       /* set by BKE_pose_rebuild to give a chance to the IK solver to rebuild IK tree */
+       POSE_WAS_REBUILT = (1 << 5),
+       /* set by game_copy_pose to indicate that this pose is used in the game engine */
+       POSE_GAME_ENGINE = (1 << 6)
 } ePose_Flags;
 
 /* IK Solvers ------------------------------------ */
@@ -378,37 +378,37 @@ typedef enum ePose_IKSolverType {
 
 /* header for all bPose->ikparam structures */
 typedef struct bIKParam {
-       int   iksolver;
+       int iksolver;
 } bIKParam;
 
 /* bPose->ikparam when bPose->iksolver=1 */
 typedef struct bItasc {
-       int   iksolver;
+       int iksolver;
        float precision;
        short numiter;
        short numstep;
        float minstep;
        float maxstep;
-       short solver;   
+       short solver;
        short flag;
        float feedback;
-       float maxvel;   /* max velocity to SDLS solver */
-       float dampmax;  /* maximum damping for DLS solver */
-       float dampeps;  /* threshold of singular value from which the damping start progressively */
+       float maxvel;   /* max velocity to SDLS solver */
+       float dampmax;  /* maximum damping for DLS solver */
+       float dampeps;  /* threshold of singular value from which the damping start progressively */
 } bItasc;
 
 /* bItasc->flag */
 typedef enum eItasc_Flags {
-       ITASC_AUTO_STEP = (1<<0),
-       ITASC_INITIAL_REITERATION = (1<<1),
-       ITASC_REITERATION = (1<<2),
-       ITASC_SIMULATION = (1<<3)
+       ITASC_AUTO_STEP           = (1 << 0),
+       ITASC_INITIAL_REITERATION = (1 << 1),
+       ITASC_REITERATION         = (1 << 2),
+       ITASC_SIMULATION          = (1 << 3)
 } eItasc_Flags;
 
 /* bItasc->solver */
 typedef enum eItasc_Solver {
-       ITASC_SOLVER_SDLS = 0,  /* selective damped least square, suitable for CopyPose constraint */
-       ITASC_SOLVER_DLS                /* damped least square with numerical filtering of damping */
+       ITASC_SOLVER_SDLS = 0,  /* selective damped least square, suitable for CopyPose constraint */
+       ITASC_SOLVER_DLS  = 1,  /* damped least square with numerical filtering of damping */
 } eItasc_Solver;
 
 /* ************************************************ */
@@ -434,34 +434,34 @@ typedef enum eItasc_Solver {
 typedef struct bActionGroup {
        struct bActionGroup *next, *prev;
        
-       ListBase channels;                      /* Note: this must not be touched by standard listbase functions which would clear links to other channels */
+       ListBase channels;          /* Note: this must not be touched by standard listbase functions which would clear links to other channels */
        
-       int flag;                                       /* settings for this action-group */
-       int customCol;                          /* index of custom color set to use when used for bones (0=default - used for all old files, -1=custom set) */                          
-       char name[64];                          /* name of the group */
+       int flag;                   /* settings for this action-group */
+       int customCol;              /* index of custom color set to use when used for bones (0=default - used for all old files, -1=custom set) */
+       char name[64];              /* name of the group */
        
-       ThemeWireColor cs;                      /* color set to use when customCol == -1 */
+       ThemeWireColor cs;          /* color set to use when customCol == -1 */
 } bActionGroup;
 
 /* Action Group flags */
 typedef enum eActionGroup_Flag {
-               /* group is selected */
-       AGRP_SELECTED   = (1<<0),
-               /* group is 'active' / last selected one */
-       AGRP_ACTIVE     = (1<<1),
-               /* keyframes/channels belonging to it cannot be edited */
-       AGRP_PROTECTED  = (1<<2),
-               /* for UI (DopeSheet), sub-channels are shown */
-       AGRP_EXPANDED   = (1<<3),
-               /* sub-channels are not evaluated */
-       AGRP_MUTED              = (1<<4),
-               /* sub-channels are not visible in Graph Editor */
-       AGRP_NOTVISIBLE = (1<<5),
-               /* for UI (Graph Editor), sub-channels are shown */
-       AGRP_EXPANDED_G = (1<<6),
-       
-       AGRP_TEMP               = (1<<30),
-       AGRP_MOVED              = (1<<31)
+       /* group is selected */
+       AGRP_SELECTED   = (1 << 0),
+       /* group is 'active' / last selected one */
+       AGRP_ACTIVE     = (1 << 1),
+       /* keyframes/channels belonging to it cannot be edited */
+       AGRP_PROTECTED  = (1 << 2),
+       /* for UI (DopeSheet), sub-channels are shown */
+       AGRP_EXPANDED   = (1 << 3),
+       /* sub-channels are not evaluated */
+       AGRP_MUTED      = (1 << 4),
+       /* sub-channels are not visible in Graph Editor */
+       AGRP_NOTVISIBLE = (1 << 5),
+       /* for UI (Graph Editor), sub-channels are shown */
+       AGRP_EXPANDED_G = (1 << 6),
+       
+       AGRP_TEMP       = (1 << 30),
+       AGRP_MOVED      = (1 << 31)
 } eActionGroup_Flag;
 
 
@@ -478,31 +478,31 @@ typedef enum eActionGroup_Flag {
  * affects a group of related settings (as defined by the user). 
  */
 typedef struct bAction {
-       ID      id;                             /* ID-serialisation for relinking */
+       ID id;              /* ID-serialisation for relinking */
        
-       ListBase curves;        /* function-curves (FCurve) */
-       ListBase chanbase;      /* legacy data - Action Channels (bActionChannel) in pre-2.5 animation system */
-       ListBase groups;        /* groups of function-curves (bActionGroup) */
-       ListBase markers;       /* markers local to the Action (used to provide Pose-Libraries) */
+       ListBase curves;    /* function-curves (FCurve) */
+       ListBase chanbase;  /* legacy data - Action Channels (bActionChannel) in pre-2.5 animation system */
+       ListBase groups;    /* groups of function-curves (bActionGroup) */
+       ListBase markers;   /* markers local to the Action (used to provide Pose-Libraries) */
        
-       int flag;                       /* settings for this action */
-       int active_marker;      /* index of the active marker */
+       int flag;           /* settings for this action */
+       int active_marker;  /* index of the active marker */
        
-       int idroot;                     /* type of ID-blocks that action can be assigned to (if 0, will be set to whatever ID first evaluates it) */
+       int idroot;         /* type of ID-blocks that action can be assigned to (if 0, will be set to whatever ID first evaluates it) */
        int pad;
 } bAction;
 
 
 /* Flags for the action */
 typedef enum eAction_Flags {
-               /* flags for displaying in UI */
-       ACT_COLLAPSED   = (1<<0),
-       ACT_SELECTED    = (1<<1),
-       
-               /* flags for evaluation/editing */
-       ACT_MUTED               = (1<<9),
-       ACT_PROTECTED   = (1<<10),
-       ACT_DISABLED    = (1<<11)
+       /* flags for displaying in UI */
+       ACT_COLLAPSED   = (1 << 0),
+       ACT_SELECTED    = (1 << 1),
+
+       /* flags for evaluation/editing */
+       ACT_MUTED       = (1 << 9),
+       ACT_PROTECTED   = (1 << 10),
+       ACT_DISABLED    = (1 << 11)
 } eAction_Flags;
 
 
@@ -511,67 +511,67 @@ typedef enum eAction_Flags {
 
 /* Storage for Dopesheet/Grease-Pencil Editor data */
 typedef struct bDopeSheet {
-       ID              *source;                        /* currently ID_SCE (for Dopesheet), and ID_SC (for Grease Pencil) */
-       ListBase chanbase;                      /* cache for channels (only initialized when pinned) */  // XXX not used!
+       ID      *source;            /* currently ID_SCE (for Dopesheet), and ID_SC (for Grease Pencil) */
+       ListBase chanbase; /* cache for channels (only initialized when pinned) */           // XXX not used!
        
-       struct Group *filter_grp;       /* object group for ADS_FILTER_ONLYOBGROUP filtering option */
-       char searchstr[64];                     /* string to search for in displayed names of F-Curves for ADS_FILTER_BY_FCU_NAME filtering option */
+       struct Group *filter_grp;   /* object group for ADS_FILTER_ONLYOBGROUP filtering option */
+       char searchstr[64];         /* string to search for in displayed names of F-Curves for ADS_FILTER_BY_FCU_NAME filtering option */
        
-       int filterflag;                         /* flags to use for filtering data */
-       int flag;                                       /* standard flags */
+       int filterflag;             /* flags to use for filtering data */
+       int flag;                   /* standard flags */
        
-       int renameIndex;                        /* index+1 of channel to rename - only gets set by renaming operator */
+       int renameIndex;            /* index+1 of channel to rename - only gets set by renaming operator */
        int pad;
 } bDopeSheet;
 
 
 /* DopeSheet filter-flag */
 typedef enum eDopeSheet_FilterFlag {
-               /* general filtering */
-       ADS_FILTER_ONLYSEL                      = (1<<0),       /* only include channels relating to selected data */
-       
-               /* temporary filters */
-       ADS_FILTER_ONLYDRIVERS          = (1<<1),       /* for 'Drivers' editor - only include Driver data from AnimData */
-       ADS_FILTER_ONLYNLA                      = (1<<2),       /* for 'NLA' editor - only include NLA data from AnimData */
-       ADS_FILTER_SELEDIT                      = (1<<3),       /* for Graph Editor - used to indicate whether to include a filtering flag or not */
-       
-               /* general filtering 2 */
-       ADS_FILTER_SUMMARY                      = (1<<4),       /* for 'DopeSheet' Editors - include 'summary' line */
-       ADS_FILTER_ONLYOBGROUP          = (1<<5),       /* only the objects in the specified object group get used */
-       
-               /* datatype-based filtering */
-       ADS_FILTER_NOSHAPEKEYS          = (1<<6),
-       ADS_FILTER_NOMESH                       = (1<<7),
-       ADS_FILTER_NOOBJ                        = (1<<8),       /* for animdata on object level, if we only want to concentrate on materials/etc. */
-       ADS_FILTER_NOLAT                        = (1<<9),
-       ADS_FILTER_NOCAM                        = (1<<10),
-       ADS_FILTER_NOMAT                        = (1<<11),
-       ADS_FILTER_NOLAM                        = (1<<12),
-       ADS_FILTER_NOCUR                        = (1<<13),
-       ADS_FILTER_NOWOR                        = (1<<14),
-       ADS_FILTER_NOSCE                        = (1<<15),
-       ADS_FILTER_NOPART                       = (1<<16),
-       ADS_FILTER_NOMBA                        = (1<<17),
-       ADS_FILTER_NOARM                        = (1<<18),
-       ADS_FILTER_NONTREE                      = (1<<19),
-       ADS_FILTER_NOTEX                        = (1<<20),
-       ADS_FILTER_NOSPK                        = (1<<21),
-       
-               /* NLA-specific filters */
-       ADS_FILTER_NLA_NOACT            = (1<<25),      /* if the AnimData block has no NLA data, don't include to just show Action-line */
-       
-               /* general filtering 3 */
-       ADS_FILTER_INCL_HIDDEN          = (1<<26),      /* include 'hidden' channels too (i.e. those from hidden Objects/Bones) */
-       ADS_FILTER_BY_FCU_NAME          = (1<<27),      /* for F-Curves, filter by the displayed name (i.e. to isolate all Location curves only) */
-       
-               /* combination filters (some only used at runtime) */
-       ADS_FILTER_NOOBDATA = (ADS_FILTER_NOCAM|ADS_FILTER_NOMAT|ADS_FILTER_NOLAM|ADS_FILTER_NOCUR|ADS_FILTER_NOPART|ADS_FILTER_NOARM|ADS_FILTER_NOSPK)
+       /* general filtering */
+       ADS_FILTER_ONLYSEL          = (1 << 0),   /* only include channels relating to selected data */
+       
+       /* temporary filters */
+       ADS_FILTER_ONLYDRIVERS      = (1 << 1),   /* for 'Drivers' editor - only include Driver data from AnimData */
+       ADS_FILTER_ONLYNLA          = (1 << 2),   /* for 'NLA' editor - only include NLA data from AnimData */
+       ADS_FILTER_SELEDIT          = (1 << 3),   /* for Graph Editor - used to indicate whether to include a filtering flag or not */
+
+       /* general filtering 2 */
+       ADS_FILTER_SUMMARY          = (1 << 4),   /* for 'DopeSheet' Editors - include 'summary' line */
+       ADS_FILTER_ONLYOBGROUP      = (1 << 5),   /* only the objects in the specified object group get used */
+
+       /* datatype-based filtering */
+       ADS_FILTER_NOSHAPEKEYS      = (1 << 6),
+       ADS_FILTER_NOMESH           = (1 << 7),
+       ADS_FILTER_NOOBJ            = (1 << 8),   /* for animdata on object level, if we only want to concentrate on materials/etc. */
+       ADS_FILTER_NOLAT            = (1 << 9),
+       ADS_FILTER_NOCAM            = (1 << 10),
+       ADS_FILTER_NOMAT            = (1 << 11),
+       ADS_FILTER_NOLAM            = (1 << 12),
+       ADS_FILTER_NOCUR            = (1 << 13),
+       ADS_FILTER_NOWOR            = (1 << 14),
+       ADS_FILTER_NOSCE            = (1 << 15),
+       ADS_FILTER_NOPART           = (1 << 16),
+       ADS_FILTER_NOMBA            = (1 << 17),
+       ADS_FILTER_NOARM            = (1 << 18),
+       ADS_FILTER_NONTREE          = (1 << 19),
+       ADS_FILTER_NOTEX            = (1 << 20),
+       ADS_FILTER_NOSPK            = (1 << 21),
+
+       /* NLA-specific filters */
+       ADS_FILTER_NLA_NOACT        = (1 << 25),  /* if the AnimData block has no NLA data, don't include to just show Action-line */
+
+       /* general filtering 3 */
+       ADS_FILTER_INCL_HIDDEN      = (1 << 26),  /* include 'hidden' channels too (i.e. those from hidden Objects/Bones) */
+       ADS_FILTER_BY_FCU_NAME      = (1 << 27),  /* for F-Curves, filter by the displayed name (i.e. to isolate all Location curves only) */
+       
+       /* combination filters (some only used at runtime) */
+       ADS_FILTER_NOOBDATA = (ADS_FILTER_NOCAM | ADS_FILTER_NOMAT | ADS_FILTER_NOLAM | ADS_FILTER_NOCUR | ADS_FILTER_NOPART | ADS_FILTER_NOARM | ADS_FILTER_NOSPK)
 } eDopeSheet_FilterFlag;       
 
 /* DopeSheet general flags */
 typedef enum eDopeSheet_Flag {
-       ADS_FLAG_SUMMARY_COLLAPSED      = (1<<0),       /* when summary is shown, it is collapsed, so all other channels get hidden */
-       ADS_FLAG_SHOW_DBFILTERS         = (1<<1)        /* show filters for datablocks */
+       ADS_FLAG_SUMMARY_COLLAPSED  = (1 << 0),   /* when summary is shown, it is collapsed, so all other channels get hidden */
+       ADS_FLAG_SHOW_DBFILTERS     = (1 << 1)    /* show filters for datablocks */
 } eDopeSheet_Flag;
 
 
@@ -579,72 +579,72 @@ typedef enum eDopeSheet_Flag {
 /* Action Editor Space. This is defined here instead of in DNA_space_types.h */
 typedef struct SpaceAction {
        struct SpaceLink *next, *prev;
-       ListBase regionbase;            /* storage of regions for inactive spaces */
+       ListBase regionbase;        /* storage of regions for inactive spaces */
        int spacetype;
        float blockscale;
 
        short blockhandler[8];
 
-       View2D v2d  DNA_DEPRECATED; /* copied to region */
+       View2D v2d DNA_DEPRECATED;  /* copied to region */
        
-       bAction         *action;                /* the currently active action */
-       bDopeSheet      ads;                    /* the currently active context (when not showing action) */
+       bAction     *action;        /* the currently active action */
+       bDopeSheet ads;             /* the currently active context (when not showing action) */
        
-       char  mode, autosnap;           /* mode: editing context; autosnap: automatic keyframe snapping mode   */
-       short flag;                             /* flag: bitmapped settings; */
-       float timeslide;                        /* for Time-Slide transform mode drawing - current frame? */
+       char mode, autosnap;        /* mode: editing context; autosnap: automatic keyframe snapping mode   */
+       short flag;                 /* flag: bitmapped settings; */
+       float timeslide;            /* for Time-Slide transform mode drawing - current frame? */
 } SpaceAction;
 
 /* SpaceAction flag */
 typedef enum eSAction_Flag {
-               /* during transform (only set for TimeSlide) */
-       SACTION_MOVING  = (1<<0),       
-               /* show sliders */
-       SACTION_SLIDERS = (1<<1),       
-               /* draw time in seconds instead of time in frames */
-       SACTION_DRAWTIME = (1<<2),
-               /* don't filter action channels according to visibility */
+       /* during transform (only set for TimeSlide) */
+       SACTION_MOVING  = (1 << 0),
+       /* show sliders */
+       SACTION_SLIDERS = (1 << 1),
+       /* draw time in seconds instead of time in frames */
+       SACTION_DRAWTIME = (1 << 2),
+       /* don't filter action channels according to visibility */
        //SACTION_NOHIDE = (1<<3), // XXX depreceated... old animation system
-               /* don't kill overlapping keyframes after transform */
-       SACTION_NOTRANSKEYCULL = (1<<4),
-               /* don't include keyframes that are out of view */
+       /* don't kill overlapping keyframes after transform */
+       SACTION_NOTRANSKEYCULL = (1 << 4),
+       /* don't include keyframes that are out of view */
        //SACTION_HORIZOPTIMISEON = (1<<5), // XXX depreceated... old irrelevant trick
-               /* show pose-markers (local to action) in Action Editor mode  */
-       SACTION_POSEMARKERS_SHOW = (1<<6),
-               /* don't draw action channels using group colors (where applicable) */
-       SACTION_NODRAWGCOLORS = (1<<7),
-               /* don't draw current frame number beside frame indicator */
-       SACTION_NODRAWCFRANUM = (1<<8),
-               /* temporary flag to force channel selections to be synced with main */
-       SACTION_TEMP_NEEDCHANSYNC = (1<<9),
-               /* don't perform realtime updates */
-       SACTION_NOREALTIMEUPDATES =     (1<<10),
-               /* move markers as well as keyframes */
-       SACTION_MARKERS_MOVE = (1<<11)
+       /* show pose-markers (local to action) in Action Editor mode  */
+       SACTION_POSEMARKERS_SHOW = (1 << 6),
+       /* don't draw action channels using group colors (where applicable) */
+       SACTION_NODRAWGCOLORS = (1 << 7),
+       /* don't draw current frame number beside frame indicator */
+       SACTION_NODRAWCFRANUM = (1 << 8),
+       /* temporary flag to force channel selections to be synced with main */
+       SACTION_TEMP_NEEDCHANSYNC = (1 << 9),
+       /* don't perform realtime updates */
+       SACTION_NOREALTIMEUPDATES = (1 << 10),
+       /* move markers as well as keyframes */
+       SACTION_MARKERS_MOVE = (1 << 11)
 } eSAction_Flag;       
 
 /* SpaceAction Mode Settings */
 typedef enum eAnimEdit_Context {
-               /* action on the active object */
-       SACTCONT_ACTION = 0,
-               /* list of all shapekeys on the active object, linked with their F-Curves */
-       SACTCONT_SHAPEKEY,
-               /* editing of gpencil data */
-       SACTCONT_GPENCIL,
-               /* dopesheet (default) */
-       SACTCONT_DOPESHEET
+       /* action on the active object */
+       SACTCONT_ACTION = 0,
+       /* list of all shapekeys on the active object, linked with their F-Curves */
+       SACTCONT_SHAPEKEY = 1,
+       /* editing of gpencil data */
+       SACTCONT_GPENCIL = 2,
+       /* dopesheet (default) */
+       SACTCONT_DOPESHEET = 3
 } eAnimEdit_Context;
 
 /* SpaceAction AutoSnap Settings (also used by other Animation Editors) */
 typedef enum eAnimEdit_AutoSnap {
-               /* no auto-snap */
-       SACTSNAP_OFF = 0,       
-               /* snap to 1.0 frame/second intervals */
-       SACTSNAP_STEP,
-               /* snap to actual frames/seconds (nla-action time) */
-       SACTSNAP_FRAME,
-               /* snap to nearest marker */
-       SACTSNAP_MARKER
+       /* no auto-snap */
+       SACTSNAP_OFF = 0,
+       /* snap to 1.0 frame/second intervals */
+       SACTSNAP_STEP = 1,
+       /* snap to actual frames/seconds (nla-action time) */
+       SACTSNAP_FRAME = 2,
+       /* snap to nearest marker */
+       SACTSNAP_MARKER = 3
 } eAnimEdit_AutoSnap;
 
 
@@ -652,7 +652,7 @@ typedef enum eAnimEdit_AutoSnap {
 /* Legacy Data */
 
 /* WARNING: Action Channels are now depreceated... they were part of the old animation system!
- *               (ONLY USED FOR DO_VERSIONS...)
+ *        (ONLY USED FOR DO_VERSIONS...)
  * 
  * Action Channels belong to Actions. They are linked with an IPO block, and can also own 
  * Constraint Channels in certain situations. 
@@ -663,27 +663,27 @@ typedef enum eAnimEdit_AutoSnap {
  * to the position of the group in the list, and their position within the group. 
  */
 typedef struct bActionChannel {
-       struct bActionChannel   *next, *prev;
-       bActionGroup                    *grp;                                   /* Action Group this Action Channel belongs to */
+       struct bActionChannel   *next, *prev;
+       bActionGroup            *grp;           /* Action Group this Action Channel belongs to */
        
-       struct Ipo                              *ipo;                                   /* IPO block this action channel references */
-       ListBase                                constraintChannels;             /* Constraint Channels (when Action Channel represents an Object or Bone) */
+       struct Ipo              *ipo;           /* IPO block this action channel references */
+       ListBase constraintChannels;            /* Constraint Channels (when Action Channel represents an Object or Bone) */
        
-       int             flag;                   /* settings accessed via bitmapping */
-       char    name[64];               /* channel name, MAX_NAME */
-       int             temp;                   /* temporary setting - may be used to indicate group that channel belongs to during syncing  */
+       int flag;               /* settings accessed via bitmapping */
+       char name[64];          /* channel name, MAX_NAME */
+       int temp;               /* temporary setting - may be used to indicate group that channel belongs to during syncing  */
 } bActionChannel;
 
 /* Action Channel flags (ONLY USED FOR DO_VERSIONS...) */
 typedef enum ACHAN_FLAG {
-       ACHAN_SELECTED  = (1<<0),
-       ACHAN_HILIGHTED = (1<<1),
-       ACHAN_HIDDEN    = (1<<2),
-       ACHAN_PROTECTED = (1<<3),
-       ACHAN_EXPANDED  = (1<<4),
-       ACHAN_SHOWIPO   = (1<<5),
-       ACHAN_SHOWCONS  = (1<<6),
-       ACHAN_MOVED     = (1<<31)
+       ACHAN_SELECTED  = (1 << 0),
+       ACHAN_HILIGHTED = (1 << 1),
+       ACHAN_HIDDEN    = (1 << 2),
+       ACHAN_PROTECTED = (1 << 3),
+       ACHAN_EXPANDED  = (1 << 4),
+       ACHAN_SHOWIPO   = (1 << 5),
+       ACHAN_SHOWCONS  = (1 << 6),
+       ACHAN_MOVED     = (1 << 31)
 } ACHAN_FLAG; 
 
 #endif
index 23f33729f69e9ca6ebf010fdf5db252e4cd68fc1..e4c27a57d855221067472008510d8cd895a866d3 100644 (file)
@@ -46,10 +46,13 @@ typedef struct Mask {
        ListBase masklayers;  /* mask layers */
        int masklay_act;      /* index of active mask layer (-1 == None) */
        int masklay_tot;      /* total number of mask layers */
+
+       int sfra, efra;       /* frames, used by the sequencer */
 } Mask;
 
 typedef struct MaskParent {
-       int flag;             /* parenting flags */
+       // int flag;             /* parenting flags */ /* not used */
+       int pad;
        int id_type;          /* type of parenting */
        ID *id;               /* ID block of entity to which mask/spline is parented to
                               * in case of parenting to movie tracking data set to MovieClip datablock */
@@ -128,7 +131,7 @@ typedef struct MaskLayer {
 } MaskLayer;
 
 /* MaskParent->flag */
-#define MASK_PARENT_ACTIVE  (1 << 0)
+/* #define MASK_PARENT_ACTIVE  (1 << 0) */ /* UNUSED */
 
 /* MaskSpline->flag */
 /* reserve (1 << 0) for SELECT */
index 38622569590e469d6b47049f680cb676f53082a2..a441936e054e6f8c534303b1da687a64fab5d72b 100644 (file)
@@ -241,6 +241,14 @@ typedef struct bNodeLink {
 #define NTREE_QUALITY_MEDIUM  1
 #define NTREE_QUALITY_LOW     2
 
+/* tree->chunksize */
+#define NTREE_CHUNCKSIZE_32 32
+#define NTREE_CHUNCKSIZE_64 64
+#define NTREE_CHUNCKSIZE_128 128
+#define NTREE_CHUNCKSIZE_256 256
+#define NTREE_CHUNCKSIZE_512 512
+#define NTREE_CHUNCKSIZE_1024 1024
+
 /* the basis for a Node tree, all links and nodes reside internal here */
 /* only re-usable node trees are in the library though, materials and textures allocate own tree struct */
 typedef struct bNodeTree {
index 73b6efedd770ab34e976100fccf9230002d63918..161c448476d176e25019932676e0438196a25885 100644 (file)
@@ -132,6 +132,7 @@ typedef struct Sequence {
 
        struct anim *anim;      /* for MOVIE strips */
        struct MovieClip *clip; /* for MOVIECLIP strips */
+       struct Mask *mask;      /* for MASK strips */
 
        float effect_fader;
        float speed_fader;
@@ -305,6 +306,7 @@ enum {
        SEQ_TYPE_SOUND_RAM   = 4,
        SEQ_TYPE_SOUND_HD    = 5,
        SEQ_TYPE_MOVIECLIP   = 6,
+       SEQ_TYPE_MASK        = 7,
 
        SEQ_TYPE_EFFECT      = 8,
        SEQ_TYPE_CROSS       = 8,
index f06a2b6f80adf79c9dabd2a655f06cd93501f261..5465dbf6e3c259953af54e4079d7f5671fd4c3ff 100644 (file)
@@ -236,7 +236,7 @@ typedef struct ThemeSpace {
        char syntaxl[4], syntaxn[4], syntaxb[4]; // syntax for textwindow and nodes
        char syntaxv[4], syntaxc[4];
        
-       char movie[4], movieclip[4], image[4], scene[4], audio[4];              // for sequence editor
+       char movie[4], movieclip[4], mask[4], image[4], scene[4], audio[4];             // for sequence editor
        char effect[4], hpad0[4], transition[4], meta[4];
        char editmesh_active[4]; 
 
@@ -249,7 +249,7 @@ typedef struct ThemeSpace {
        char bundle_solid[4];
        char path_before[4], path_after[4];
        char camera_path[4];
-       char hpad[7];
+       char hpad[3];
        
        char preview_back[4];
        char preview_stitch_face[4];
index 319e93b30844c4be341d9d374b16a1f92ab482e2..198a30015a85bb25db251c28167ceccc240d3baf 100644 (file)
@@ -295,6 +295,7 @@ extern StructRNA RNA_Macro;
 extern StructRNA RNA_MagicTexture;
 extern StructRNA RNA_MarbleTexture;
 extern StructRNA RNA_MaskModifier;
+extern StructRNA RNA_MaskSequence;
 extern StructRNA RNA_Material;
 extern StructRNA RNA_MaterialHalo;
 extern StructRNA RNA_MaterialPhysics;
index d2eeaa72fed50fbd3f98bc304940b32dce3a3998..473ab7485b09f5ff866af6411e7e475e5ccca643 100644 (file)
@@ -144,6 +144,7 @@ EnumPropertyItem *RNA_scene_itemf(struct bContext *C, struct PointerRNA *ptr, st
 EnumPropertyItem *RNA_scene_local_itemf(struct bContext *C, struct PointerRNA *ptr, struct PropertyRNA *prop, int *free);
 EnumPropertyItem *RNA_movieclip_itemf(struct bContext *C, struct PointerRNA *ptr, struct PropertyRNA *prop, int *free);
 EnumPropertyItem *RNA_movieclip_local_itemf(struct bContext *C, struct PointerRNA *ptr, struct PropertyRNA *prop, int *free);
-
+EnumPropertyItem *RNA_mask_itemf(struct bContext *C, struct PointerRNA *ptr, struct PropertyRNA *prop, int *free);
+EnumPropertyItem *RNA_mask_local_itemf(struct bContext *C, struct PointerRNA *ptr, struct PropertyRNA *prop, int *free);
 
 #endif /* __RNA_ENUM_TYPES_H__ */
index 82a838010f64b108e48555ab4932673681b8ed56..3b4f87d8b95c3e9f2ad3c99d362798a576f8fffc 100644 (file)
@@ -547,7 +547,7 @@ static void rna_def_cloth_collision_settings(BlenderRNA *brna)
        RNA_def_property_string_funcs(prop, "rna_CollSettings_selfcol_vgroup_get", "rna_CollSettings_selfcol_vgroup_length",
                                      "rna_CollSettings_selfcol_vgroup_set");
        RNA_def_property_ui_text(prop, "Selfcollision Vertex Group",
-                                "Vertex group to define vertices which are not used during self collisions.");
+                                "Vertex group to define vertices which are not used during self collisions");
        RNA_def_property_update(prop, 0, "rna_cloth_update");
 }
 
index 51d370d5a886548a75427cc08bc4884149751efd..42c893eca16d08a6d37e555ddac4e9eb1b99c73a 100644 (file)
@@ -312,6 +312,29 @@ static void rna_MaskLayer_spline_add(ID *id, MaskLayer *masklay, int number)
        WM_main_add_notifier(NC_MASK|NA_EDITED, mask);
 }
 
+static void rna_Mask_start_frame_set(PointerRNA *ptr, int value)
+{
+       Mask *data = (Mask *)ptr->data;
+       /* MINFRAME not MINAFRAME, since some output formats can't taken negative frames */
+       CLAMP(value, MINFRAME, MAXFRAME);
+       data->sfra = value;
+
+       if (data->sfra >= data->efra) {
+               data->efra = MIN2(data->sfra, MAXFRAME);
+       }
+}
+
+static void rna_Mask_end_frame_set(PointerRNA *ptr, int value)
+{
+       Mask *data = (Mask *)ptr->data;
+       CLAMP(value, MINFRAME, MAXFRAME);
+       data->efra = value;
+
+       if (data->sfra >= data->efra) {
+               data->sfra = MAX2(data->efra, MINFRAME);
+       }
+}
+
 #else
 
 static void rna_def_maskParent(BlenderRNA *brna)
@@ -326,13 +349,6 @@ static void rna_def_maskParent(BlenderRNA *brna)
        srna = RNA_def_struct(brna, "MaskParent", NULL);
        RNA_def_struct_ui_text(srna, "Mask Parent", "Parenting settings for masking element");
 
-       /* use_parent */
-       prop = RNA_def_property(srna, "use_parent", PROP_BOOLEAN, PROP_NONE);
-       RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
-       RNA_def_property_boolean_sdna(prop, NULL, "flag", MASK_PARENT_ACTIVE);
-       RNA_def_property_ui_text(prop, "Use Parent", "Use parenting for this layer");
-       RNA_def_property_update(prop, 0, "rna_Mask_update_data");
-
        /* Target Properties - ID-block to Drive */
        prop = RNA_def_property(srna, "id", PROP_POINTER, PROP_NONE);
        RNA_def_property_struct_type(prop, "ID");
@@ -644,6 +660,23 @@ static void rna_def_mask(BlenderRNA *brna)
        RNA_def_property_int_funcs(prop, "rna_Mask_layer_active_index_get", "rna_Mask_layer_active_index_set", "rna_Mask_layer_active_index_range");
        RNA_def_property_ui_text(prop, "Active Shape Index", "Index of active layer in list of all mask's layers");
 
+       /* frame range */
+       prop = RNA_def_property(srna, "frame_start", PROP_INT, PROP_TIME);
+       RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
+       RNA_def_property_int_sdna(prop, NULL, "sfra");
+       RNA_def_property_int_funcs(prop, NULL, "rna_Mask_start_frame_set", NULL);
+       RNA_def_property_range(prop, MINFRAME, MAXFRAME);
+       RNA_def_property_ui_text(prop, "Start Frame", "First frame of the mask (used for sequencer)");
+       RNA_def_property_update(prop, NC_SCENE | ND_FRAME_RANGE, NULL);
+
+       prop = RNA_def_property(srna, "frame_end", PROP_INT, PROP_TIME);
+       RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
+       RNA_def_property_int_sdna(prop, NULL, "efra");
+       RNA_def_property_int_funcs(prop, NULL, "rna_Mask_end_frame_set", NULL);
+       RNA_def_property_range(prop, MINFRAME, MAXFRAME);
+       RNA_def_property_ui_text(prop, "End Frame", "Final frame of the mask (used for sequencer)");
+       RNA_def_property_update(prop, NC_SCENE | ND_FRAME_RANGE, NULL);
+
        /* pointers */
        rna_def_animdata_common(srna);
 }
index ae489790825fe146b509aff484600d27edb3083d..e97f3195f47baa03086da6090a52c17bdab2dd9d 100644 (file)
@@ -71,6 +71,16 @@ EnumPropertyItem node_quality_items[] = {
        {0, NULL, 0, NULL, NULL}
 };
 
+EnumPropertyItem node_chunksize_items[] = {
+    {NTREE_CHUNCKSIZE_32,   "32",     0,    "32x32",     "Chunksize of 32x32"},
+    {NTREE_CHUNCKSIZE_64,   "64",     0,    "64x64",     "Chunksize of 64x64"},
+    {NTREE_CHUNCKSIZE_128,   "128",     0,    "128x128",     "Chunksize of 128x128"},
+    {NTREE_CHUNCKSIZE_256,   "256",     0,    "256x256",     "Chunksize of 256x256"},
+    {NTREE_CHUNCKSIZE_512,   "512",     0,    "512x512",     "Chunksize of 512x512"},
+    {NTREE_CHUNCKSIZE_1024,   "1024",     0,    "1024x1024",     "Chunksize of 1024x1024"},
+       {0, NULL, 0, NULL, NULL}
+};
+
 EnumPropertyItem node_socket_type_items[] = {
        {SOCK_FLOAT,   "VALUE",     0,    "Value",     ""},
        {SOCK_VECTOR,  "VECTOR",    0,    "Vector",    ""},
@@ -3245,6 +3255,25 @@ static void def_cmp_ellipsemask(StructRNA *srna)
        RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
 }
 
+static void def_cmp_bokehblur(StructRNA *srna)
+{
+       PropertyRNA *prop;
+       prop = RNA_def_property(srna, "f_stop", PROP_FLOAT, PROP_NONE);
+       RNA_def_property_float_sdna(prop, NULL, "custom3");
+       RNA_def_property_range(prop, 0.0f, 128.0f);
+       RNA_def_property_ui_text(prop, "fStop",
+                                "Amount of focal blur, 128=infinity=perfect focus, half the value doubles "
+                                "the blur radius");
+       RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
+       
+       prop = RNA_def_property(srna, "blur_max", PROP_FLOAT, PROP_NONE);
+       RNA_def_property_float_sdna(prop, NULL, "custom4");
+       RNA_def_property_range(prop, 0.0f, 10000.0f);
+       RNA_def_property_ui_text(prop, "Max Blur", "Blur limit, maximum CoC radius");
+       RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
+       
+}
+
 static void def_cmp_bokehimage(StructRNA *srna)
 {
        PropertyRNA *prop;
@@ -4090,11 +4119,11 @@ static void rna_def_composite_nodetree(BlenderRNA *brna)
        RNA_def_property_enum_items(prop, node_quality_items);
        RNA_def_property_ui_text(prop, "Edit Quality", "Quality when editing");
 
-       prop = RNA_def_property(srna, "chunk_size", PROP_INT, PROP_NONE);
-       RNA_def_property_int_sdna(prop, NULL, "chunksize");
+       prop = RNA_def_property(srna, "chunk_size", PROP_ENUM, PROP_NONE);
+       RNA_def_property_enum_sdna(prop, NULL, "chunksize");
+       RNA_def_property_enum_items(prop, node_chunksize_items);
        RNA_def_property_ui_text(prop, "Chunksize", "Max size of a tile (smaller values gives better distribution "
                                                    "of multiple threads, but more overhead)");
-       RNA_def_property_range(prop, 32, 1024);
 
        prop = RNA_def_property(srna, "use_opencl", PROP_BOOLEAN, PROP_NONE);
        RNA_def_property_boolean_sdna(prop, NULL, "flag", NTREE_COM_OPENCL);
index d8c27a3677fb43982ff27f4f84b67a9c6a0fe550..ba6e40d32540f5fa0492dd5de2b1dbdf38d14ee7 100644 (file)
@@ -163,6 +163,7 @@ DefNode( CompositorNode, CMP_NODE_MOVIEDISTORTION,def_cmp_moviedistortion,"MOVIE
 DefNode( CompositorNode, CMP_NODE_MASK_BOX,       def_cmp_boxmask,        "BOXMASK"        ,BoxMask,          "Box mask",          ""              )
 DefNode( CompositorNode, CMP_NODE_MASK_ELLIPSE,   def_cmp_ellipsemask,    "ELLIPSEMASK"    ,EllipseMask,      "Ellipse mask",      ""              )
 DefNode( CompositorNode, CMP_NODE_BOKEHIMAGE,     def_cmp_bokehimage,     "BOKEHIMAGE"     ,BokehImage,       "Bokeh image",       ""              )
+DefNode( CompositorNode, CMP_NODE_BOKEHBLUR,      def_cmp_bokehblur,      "BOKEHBLUR"      ,BokehBlur,        "Bokeh Blur",        ""              )
 DefNode( CompositorNode, CMP_NODE_SWITCH,         def_cmp_switch,         "SWITCH"         ,Switch,           "Switch",            ""              )
 DefNode( CompositorNode, CMP_NODE_COLORCORRECTION,def_cmp_colorcorrection,"COLORCORRECTION",ColorCorrection,  "ColorCorrection",   ""              )
 DefNode( CompositorNode, CMP_NODE_MASK,           def_cmp_mask,           "MASK",           Mask,             "Mask",              ""              )
index 1edf144452d8ea4f873b69bca6b2e445703347d4..fb8ba2f863e080e10efaa7f7a5c116becf430a6c 100644 (file)
@@ -406,6 +406,8 @@ static StructRNA *rna_Sequence_refine(struct PointerRNA *ptr)
                        return &RNA_MovieSequence;
                case SEQ_TYPE_MOVIECLIP:
                        return &RNA_MovieClipSequence;
+               case SEQ_TYPE_MASK:
+                       return &RNA_MaskSequence;
                case SEQ_TYPE_SOUND_RAM:
                        return &RNA_SoundSequence;
                case SEQ_TYPE_CROSS:
@@ -989,6 +991,7 @@ static void rna_def_sequence(BlenderRNA *brna)
                {SEQ_TYPE_SCENE, "SCENE", 0, "Scene", ""},
                {SEQ_TYPE_MOVIE, "MOVIE", 0, "Movie", ""},
                {SEQ_TYPE_MOVIECLIP, "MOVIECLIP", 0, "Clip", ""},
+               {SEQ_TYPE_MASK, "MASK", 0, "Mask", ""},
                {SEQ_TYPE_SOUND_RAM, "SOUND", 0, "Sound", ""},
                {SEQ_TYPE_CROSS, "CROSS", 0, "Cross", ""},
                {SEQ_TYPE_ADD, "ADD", 0, "Add", ""},
@@ -1505,6 +1508,8 @@ static void rna_def_movieclip(BlenderRNA *brna)
        RNA_def_struct_ui_text(srna, "MovieClip Sequence", "Sequence strip to load a video from the clip editor");
        RNA_def_struct_sdna(srna, "Sequence");
 
+       /* TODO - add clip property? */
+
        prop = RNA_def_property(srna, "undistort", PROP_BOOLEAN, PROP_NONE);
        RNA_def_property_boolean_sdna(prop, NULL, "clip_flag", SEQ_MOVIECLIP_RENDER_UNDISTORTED);
        RNA_def_property_ui_text(prop, "Undistort Clip", "Use the undistorted version of the clip");
@@ -1519,6 +1524,23 @@ static void rna_def_movieclip(BlenderRNA *brna)
        rna_def_input(srna);
 }
 
+static void rna_def_mask(BlenderRNA *brna)
+{
+       StructRNA *srna;
+       PropertyRNA *prop;
+
+       srna = RNA_def_struct(brna, "MaskSequence", "Sequence");
+       RNA_def_struct_ui_text(srna, "Mask Sequence", "Sequence strip to load a video from a mask");
+       RNA_def_struct_sdna(srna, "Sequence");
+
+       prop = RNA_def_property(srna, "mask", PROP_POINTER, PROP_NONE);
+       RNA_def_property_flag(prop, PROP_EDITABLE);
+       RNA_def_property_ui_text(prop, "Mask", "Mask that this sequence uses");
+       RNA_def_property_update(prop, NC_SCENE | ND_SEQUENCER, "rna_Sequence_update");
+
+       rna_def_filter_video(srna);
+       rna_def_input(srna);
+}
 
 static void rna_def_sound(BlenderRNA *brna)
 {
@@ -1883,6 +1905,7 @@ void RNA_def_sequencer(BlenderRNA *brna)
        rna_def_scene(brna);
        rna_def_movie(brna);
        rna_def_movieclip(brna);
+       rna_def_mask(brna);
        rna_def_sound(brna);
        rna_def_effect(brna);
        rna_def_effects(brna);
index bbc772770ea9aa4a8d7f1c9a9591e85fa3bfbcaf..e20435a07cd7b17baa8a8d21218cc8ad49a7c7d5 100644 (file)
@@ -45,6 +45,7 @@ extern EnumPropertyItem blend_mode_items[];
 #include "DNA_image_types.h"
 #include "DNA_scene_types.h"
 #include "DNA_sequence_types.h"
+#include "DNA_mask_types.h"
 #include "DNA_sound_types.h"
 
 #include "BLI_path_util.h" /* BLI_split_dirfile */
@@ -52,6 +53,7 @@ extern EnumPropertyItem blend_mode_items[];
 #include "BKE_image.h"
 #include "BKE_library.h" /* id_us_plus */
 #include "BKE_movieclip.h"
+#include "BKE_mask.h"
 
 #include "BKE_report.h"
 #include "BKE_sequencer.h"
@@ -116,6 +118,25 @@ static Sequence *rna_Sequences_new_clip(ID *id, Editing *ed, ReportList *reports
        return seq;
 }
 
+static Sequence *rna_Sequences_new_mask(ID *id, Editing *ed, ReportList *reports,
+                                        const char *name, Mask *mask, int channel,
+                                        int start_frame)
+{
+       Scene *scene = (Scene *)id;
+       Sequence *seq;
+
+       seq = alloc_generic_sequence(ed, name, start_frame, channel, SEQ_TYPE_MASK, mask->id.name);
+       seq->mask = mask;
+       seq->len = BKE_mask_get_duration(mask);
+       id_us_plus((ID *)mask);
+
+       calc_sequence_disp(scene, seq);
+
+       WM_main_add_notifier(NC_SCENE | ND_SEQUENCER, scene);
+
+       return seq;
+}
+
 static Sequence *rna_Sequences_new_scene(ID *id, Editing *ed, ReportList *reports,
                                          const char *name, Scene *sce_seq, int channel,
                                          int start_frame)
@@ -451,6 +472,23 @@ void RNA_api_sequences(BlenderRNA *brna, PropertyRNA *cprop)
        parm = RNA_def_pointer(func, "sequence", "Sequence", "", "New Sequence");
        RNA_def_function_return(func, parm);
 
+       func = RNA_def_function(srna, "new_mask", "rna_Sequences_new_mask");
+       RNA_def_function_flag(func, FUNC_USE_REPORTS | FUNC_USE_SELF_ID);
+       RNA_def_function_ui_description(func, "Add a new movie clip sequence");
+       parm = RNA_def_string(func, "name", "Name", 0, "", "New name for the sequence");
+       RNA_def_property_flag(parm, PROP_REQUIRED);
+       parm = RNA_def_pointer(func, "mask", "Mask", "", "Mask to add");
+       RNA_def_property_flag(parm, PROP_REQUIRED | PROP_NEVER_NULL);
+       parm = RNA_def_int(func, "channel", 0, 0, MAXSEQ - 1, "Channel",
+                          "The channel for the new sequence", 0, MAXSEQ - 1);
+       RNA_def_property_flag(parm, PROP_REQUIRED);
+       parm = RNA_def_int(func, "start_frame", 0, -MAXFRAME, MAXFRAME, "",
+                          "The start frame for the new sequence", -MAXFRAME, MAXFRAME);
+       RNA_def_property_flag(parm, PROP_REQUIRED);
+       /* return type */
+       parm = RNA_def_pointer(func, "sequence", "Sequence", "", "New Sequence");
+       RNA_def_function_return(func, parm);
+
        func = RNA_def_function(srna, "new_scene", "rna_Sequences_new_scene");
        RNA_def_function_flag(func, FUNC_USE_REPORTS | FUNC_USE_SELF_ID);
        RNA_def_function_ui_description(func, "Add a new scene sequence");
index 1313f5aa3ef1c6ecd1360b57a142a810869ca5ff..545e2135344f98e73c95e29ecf1655464f6bda3a 100644 (file)
@@ -118,8 +118,14 @@ static void smoothModifier_do(
        fac = smd->fac;
        facm = 1 - fac;
 
-       medges = dm->getEdgeArray(dm);
-       numDMEdges = dm->getNumEdges(dm);
+       if (dm->getNumVerts(dm) == numVerts) {
+               medges = dm->getEdgeArray(dm);
+               numDMEdges = dm->getNumEdges(dm);
+       }
+       else {
+               medges = NULL;
+               numDMEdges = 0;
+       }
 
        modifier_get_vgroup(ob, dm, smd->defgrp_name, &dvert, &defgrp_index);
 
index ab679b9242fbcfbe43f6ff628786fa81fa7a5ace..06b6e79444a68b8f4f13d83c138b528bf8166243 100644 (file)
@@ -39,7 +39,7 @@
 static bNodeSocketTemplate cmp_node_bokehblur_in[]= {
        {       SOCK_RGBA, 1, N_("Image"),                      0.8f, 0.8f, 0.8f, 1.0f, 0.0f, 1.0f},
        {       SOCK_RGBA, 1, N_("Bokeh"),                      1.0f, 1.0f, 1.0f, 1.0f, 0.0f, 1.0f},
-       {       SOCK_FLOAT, 1, N_("Size"),                      0.01f, 0.0f, 0.0f, 0.0f, 0.0f, 0.5f},
+       {       SOCK_FLOAT, 1, N_("Size"),                      1.0f, 0.0f, 0.0f, 0.0f, 0.0f, 10.0f},
        {       SOCK_FLOAT, 1, N_("Bounding box"),      1.0f, 1.0f, 1.0f, 1.0f, 0.0f, 1.0f},
        {       -1, 0, ""       }
 };
@@ -49,6 +49,12 @@ static bNodeSocketTemplate cmp_node_bokehblur_out[]= {
        {       -1, 0, ""       }
 };
 
+static void node_composit_init_bokehblur(bNodeTree *UNUSED(ntree), bNode* node, bNodeTemplate *UNUSED(ntemp))
+{
+       node->custom3 = 4.0f;
+       node->custom4 = 16.0f;
+}
+
 void register_node_type_cmp_bokehblur(bNodeTreeType *ttype)
 {
        static bNodeType ntype;
@@ -56,5 +62,7 @@ void register_node_type_cmp_bokehblur(bNodeTreeType *ttype)
        node_type_base(ttype, &ntype, CMP_NODE_BOKEHBLUR, "Bokeh Blur", NODE_CLASS_OP_FILTER, NODE_OPTIONS);
        node_type_socket_templates(&ntype, cmp_node_bokehblur_in, cmp_node_bokehblur_out);
        node_type_size(&ntype, 120, 80, 200);
+       node_type_init(&ntype, node_composit_init_bokehblur);
+       
        nodeRegisterType(ttype, &ntype);
 }
index c90c7918660102d51f15377c89e9466ac99d868d..01461aec08d832444d8fed3fe51145d5fe61a8e1 100644 (file)
@@ -81,7 +81,7 @@ static void exec(void *data, bNode *node, bNodeStack **in, bNodeStack **out)
                stackbuf = alloc_compbuf(sx, sy, CB_VAL, TRUE);
                res = stackbuf->rect;
 
-               BKE_mask_rasterize(mask, sx, sy, res);
+               BKE_mask_rasterize(mask, sx, sy, res, TRUE, TRUE);
 
                /* pass on output and free */
                out[0]->data = stackbuf;
index ed023e42ea3fc0cbb9f64fc871c896fcaf73724b..425baac25fd7a020190f2784f0dfb37e05ed903c 100644 (file)
@@ -4166,3 +4166,13 @@ EnumPropertyItem *RNA_movieclip_local_itemf(bContext *C, PointerRNA *ptr, Proper
 {
        return rna_id_itemf(C, ptr, do_free, C ? (ID *)CTX_data_main(C)->movieclip.first : NULL, TRUE);
 }
+
+EnumPropertyItem *RNA_mask_itemf(bContext *C, PointerRNA *ptr, PropertyRNA *UNUSED(prop), int *do_free)
+{
+       return rna_id_itemf(C, ptr, do_free, C ? (ID *)CTX_data_main(C)->mask.first : NULL, FALSE);
+}
+EnumPropertyItem *RNA_mask_local_itemf(bContext *C, PointerRNA *ptr, PropertyRNA *UNUSED(prop), int *do_free)
+{
+       return rna_id_itemf(C, ptr, do_free, C ? (ID *)CTX_data_main(C)->mask.first : NULL, TRUE);
+}
+