mask mode for clip editor developed by Sergey Sharybin, Pete Larabell and myself.
authorCampbell Barton <ideasman42@gmail.com>
Mon, 4 Jun 2012 16:42:58 +0000 (16:42 +0000)
committerCampbell Barton <ideasman42@gmail.com>
Mon, 4 Jun 2012 16:42:58 +0000 (16:42 +0000)
see:
http://wiki.blender.org/index.php/User:Nazg-gul/MaskEditor

note - mask editing tools need continued development, feather option is not working 100%

68 files changed:
intern/CMakeLists.txt
intern/SConscript
release/scripts/modules/bpy_extras/keyconfig_utils.py
release/scripts/startup/bl_ui/space_clip.py
source/blender/CMakeLists.txt
source/blender/blenkernel/BKE_context.h
source/blender/blenkernel/BKE_library.h
source/blender/blenkernel/BKE_main.h
source/blender/blenkernel/BKE_node.h
source/blender/blenkernel/CMakeLists.txt
source/blender/blenkernel/SConscript
source/blender/blenkernel/intern/anim_sys.c
source/blender/blenkernel/intern/context.c
source/blender/blenkernel/intern/depsgraph.c
source/blender/blenkernel/intern/idcode.c
source/blender/blenkernel/intern/library.c
source/blender/blenkernel/intern/node.c
source/blender/blenkernel/intern/scene.c
source/blender/blenloader/intern/readfile.c
source/blender/blenloader/intern/writefile.c
source/blender/compositor/CMakeLists.txt
source/blender/compositor/intern/COM_Converter.cpp
source/blender/editors/CMakeLists.txt
source/blender/editors/SConscript
source/blender/editors/animation/keyframes_draw.c
source/blender/editors/include/ED_clip.h
source/blender/editors/include/ED_keyframes_draw.h
source/blender/editors/include/ED_object.h
source/blender/editors/include/ED_screen.h
source/blender/editors/include/ED_transform.h
source/blender/editors/interface/interface_templates.c
source/blender/editors/object/object_ops.c
source/blender/editors/screen/screen_ops.c
source/blender/editors/space_api/spacetypes.c
source/blender/editors/space_clip/clip_draw.c
source/blender/editors/space_clip/clip_editor.c
source/blender/editors/space_clip/space_clip.c
source/blender/editors/space_node/drawnode.c
source/blender/editors/space_node/space_node.c
source/blender/editors/transform/transform.c
source/blender/editors/transform/transform.h
source/blender/editors/transform/transform_conversions.c
source/blender/editors/transform/transform_generics.c
source/blender/makesdna/DNA_ID.h
source/blender/makesdna/DNA_scene_types.h
source/blender/makesdna/DNA_space_types.h
source/blender/makesdna/intern/makesdna.c
source/blender/makesrna/RNA_access.h
source/blender/makesrna/intern/CMakeLists.txt
source/blender/makesrna/intern/makesrna.c
source/blender/makesrna/intern/rna_ID.c
source/blender/makesrna/intern/rna_internal.h
source/blender/makesrna/intern/rna_main.c
source/blender/makesrna/intern/rna_main_api.c
source/blender/makesrna/intern/rna_nodetree.c
source/blender/makesrna/intern/rna_nodetree_types.h
source/blender/makesrna/intern/rna_scene.c
source/blender/makesrna/intern/rna_space.c
source/blender/nodes/CMakeLists.txt
source/blender/nodes/NOD_composite.h
source/blender/nodes/composite/node_composite_tree.c
source/blender/nodes/composite/node_composite_util.c
source/blender/nodes/composite/node_composite_util.h
source/blender/windowmanager/WM_types.h
source/blender/windowmanager/intern/wm_operators.c
source/blenderplayer/CMakeLists.txt
source/blenderplayer/bad_level_call_stubs/stubs.c
source/creator/CMakeLists.txt

index c85f0fddc34be8b09b352ba8b85f60b07db4625f..71d2ef5e410f45f79533ef017b55353b943d2782 100644 (file)
@@ -31,6 +31,7 @@ add_subdirectory(memutil)
 add_subdirectory(iksolver)
 add_subdirectory(opennl)
 add_subdirectory(mikktspace)
+add_subdirectory(raskter)
 
 if(WITH_AUDASPACE)
        add_subdirectory(audaspace)
index a1e7f840800061a2194bfbbffaa9fb625bc9eb2d..3bfdc2c4ca7d5e0976ee6b219653906a3ed19a9a 100644 (file)
@@ -14,7 +14,8 @@ SConscript(['audaspace/SConscript',
             'boolop/SConscript',
             'opennl/SConscript',
             'mikktspace/SConscript',
-            'smoke/SConscript'])
+            'smoke/SConscript',
+            'raskter/SConscript'])
 
 if env ['WITH_BF_REMESH']:
     SConscript(['dualcon/SConscript'])
index e652b8461b22bc342b3d5ec875769d9f8eaf983e..287cd81eff26be25d458f089ebca764c1ba49557 100644 (file)
@@ -95,6 +95,7 @@ KM_HIERARCHY = [
     ('Clip', 'CLIP_EDITOR', 'WINDOW', [
         ('Clip Editor', 'CLIP_EDITOR', 'WINDOW', []),
         ('Clip Graph Editor', 'CLIP_EDITOR', 'WINDOW', []),
+        ('Mask Editor', 'EMPTY', 'WINDOW', []),  # image (reverse order, UVEdit before Image
         ]),
 
     ('View3D Gesture Circle', 'EMPTY', 'WINDOW', []),
index 4ab23359fd8d47cd02e06c86686b7b1196d76321..988cd92a2eba7ce22913e04b665be8b8996745a9 100644 (file)
@@ -44,15 +44,29 @@ class CLIP_HT_header(Header):
 
                 sub.menu("CLIP_MT_clip")
 
-                sub.menu("CLIP_MT_track")
-                sub.menu("CLIP_MT_reconstruction")
+                if clip:
+                    if sc.mode == 'MASKEDITING':
+                        sub.menu("CLIP_MT_mask")
+                    else:
+                        sub.menu("CLIP_MT_track")
+                        sub.menu("CLIP_MT_reconstruction")
 
-        layout.prop(sc, "view", text="", expand=True)
+        if sc.mode != 'MASKEDITING':
+            layout.prop(sc, "view", text="", expand=True)
 
         if clip:
             if sc.view == 'CLIP':
                 layout.prop(sc, "mode", text="")
-            if sc.view == 'GRAPH':
+                layout.prop(sc, "pivot_point", text="", icon_only=True)
+
+                if sc.mode == 'MASKEDITING':
+                    toolsettings = context.tool_settings
+
+                    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)
+            elif sc.view == 'GRAPH':
                 row = layout.row(align=True)
 
                 if sc.show_filters:
@@ -71,6 +85,10 @@ class CLIP_HT_header(Header):
         row = layout.row()
         row.template_ID(sc, "clip", open='clip.open')
 
+        if sc.mode == 'MASKEDITING':
+            row = layout.row()
+            row.template_ID(sc, "mask", new="mask.new")
+
         if clip:
             tracking = clip.tracking
             active = tracking.objects.active
@@ -102,6 +120,16 @@ class CLIP_PT_clip_view_panel:
         return clip and sc.view == 'CLIP'
 
 
+class CLIP_PT_mask_view_panel:
+
+    @classmethod
+    def poll(cls, context):
+        sc = context.space_data
+        clip = sc.clip
+
+        return clip and sc.view == 'CLIP' and sc.mode == 'MASKEDITING'
+
+
 class CLIP_PT_tracking_panel:
 
     @classmethod
@@ -359,11 +387,52 @@ class CLIP_PT_tools_object(CLIP_PT_reconstruction_panel, Panel):
         col.prop(settings, "object_distance")
 
 
-class CLIP_PT_tools_grease_pencil(CLIP_PT_distortion_panel, Panel):
+class CLIP_PT_tools_mask(CLIP_PT_mask_view_panel, Panel):
+    bl_space_type = 'CLIP_EDITOR'
+    bl_region_type = 'TOOLS'
+    bl_label = "Mask Tools"
+
+    def draw(self, context):
+        layout = self.layout
+
+        col = layout.column(align=True)
+        col.label(text="Transform:")
+        col.operator("transform.translate")
+        col.operator("transform.rotate")
+        col.operator("transform.resize", text="Scale")
+
+        col = layout.column(align=True)
+        col.label(text="Spline:")
+        col.operator("mask.delete")
+        col.operator("mask.cyclic_toggle")
+        col.operator("mask.switch_direction")
+
+        col = layout.column(align=True)
+        col.label(text="Parenting:")
+        col.operator("mask.parent_set")
+        col.operator("mask.parent_clear")
+
+
+class CLIP_PT_tools_grease_pencil(Panel):
     bl_space_type = 'CLIP_EDITOR'
     bl_region_type = 'TOOLS'
     bl_label = "Grease Pencil"
 
+    @classmethod
+    def poll(cls, context):
+        sc = context.space_data
+        clip = sc.clip
+
+        if not clip:
+            return False
+
+        if sc.mode == 'DISTORTION':
+            return sc.view == 'CLIP'
+        elif sc.mode == 'MASKEDITING':
+            return True
+
+        return False
+
     def draw(self, context):
         layout = self.layout
 
@@ -550,6 +619,119 @@ class CLIP_PT_tracking_camera(Panel):
         col.prop(clip.tracking.camera, "k3")
 
 
+class CLIP_PT_mask_objects(Panel):
+    bl_space_type = 'CLIP_EDITOR'
+    bl_region_type = 'UI'
+    bl_label = "Mask Layers"
+
+    @classmethod
+    def poll(cls, context):
+        sc = context.space_data
+
+        return sc.mask and sc.mode == 'MASKEDITING'
+
+    def draw(self, context):
+        layout = self.layout
+
+        sc = context.space_data
+        mask = sc.mask
+
+        row = layout.row()
+        row.template_list(mask, "layers",
+                          mask, "active_layer_index", rows=3)
+
+        sub = row.column(align=True)
+
+        sub.operator("mask.layer_new", icon='ZOOMIN', text="")
+        sub.operator("mask.layer_remove", icon='ZOOMOUT', text="")
+
+        active = mask.layers.active
+        if active:
+            layout.prop(active, "name")
+
+            # blending
+            row = layout.row(align=True)
+            row.prop(active, "alpha")
+            row.prop(active, "invert", text="", icon='IMAGE_ALPHA')
+
+            layout.prop(active, "blend")
+
+
+class CLIP_PT_active_mask_spline(Panel):
+    bl_space_type = 'CLIP_EDITOR'
+    bl_region_type = 'UI'
+    bl_label = "Active Spline"
+
+    @classmethod
+    def poll(cls, context):
+        sc = context.space_data
+        mask = sc.mask
+
+        if mask and sc.mode == 'MASKEDITING':
+            return mask.layers.active and mask.layers.active.splines.active
+
+        return False
+
+    def draw(self, context):
+        layout = self.layout
+
+        sc = context.space_data
+        mask = sc.mask
+        spline = mask.layers.active.splines.active
+
+        col = layout.column()
+        col.prop(spline, "weight_interpolation")
+        col.prop(spline, "use_cyclic")
+
+
+class CLIP_PT_active_mask_point(Panel):
+    bl_space_type = 'CLIP_EDITOR'
+    bl_region_type = 'UI'
+    bl_label = "Active Point"
+
+    @classmethod
+    def poll(cls, context):
+        sc = context.space_data
+        mask = sc.mask
+
+        if mask and sc.mode == 'MASKEDITING':
+            return mask.layers.active and mask.layers.active.splines.active_point
+
+        return False
+
+    def draw(self, context):
+        layout = self.layout
+
+        sc = context.space_data
+        mask = sc.mask
+        point = mask.layers.active.splines.active_point
+        parent = point.parent
+
+        col = layout.column()
+        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="")
+
+            col.template_ID(parent, "id")
+
+            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:")
+
+                if parent.parent and parent.parent in tracking.objects:
+                    object = clip.tracking.objects[parent.parent]
+                    col.prop_search(parent, "sub_parent", object, "tracks", icon='ANIM_DATA', text="Track:")
+                else:
+                    col.prop_search(parent, "sub_parent", clip.tracking, "tracks", icon='ANIM_DATA', text="Track:")
+
+
 class CLIP_PT_display(CLIP_PT_clip_view_panel, Panel):
     bl_space_type = 'CLIP_EDITOR'
     bl_region_type = 'UI'
@@ -594,12 +776,23 @@ class CLIP_PT_display(CLIP_PT_clip_view_panel, Panel):
             row = col.row()
             row.prop(clip, "display_aspect", text="")
 
+        if sc.mode == 'MASKEDITING':
+            col = layout.column()
+            col.prop(sc, "mask_draw_type", text="")
+            col.prop(sc, "show_mask_smooth")
+
 
 class CLIP_PT_marker_display(CLIP_PT_clip_view_panel, Panel):
     bl_space_type = 'CLIP_EDITOR'
     bl_region_type = 'UI'
     bl_label = "Marker Display"
 
+    @classmethod
+    def poll(cls, context):
+        sc = context.space_data
+
+        return sc.mode != 'MASKEDITING'
+
     def draw(self, context):
         layout = self.layout
         sc = context.space_data
@@ -763,6 +956,7 @@ class CLIP_PT_footage(CLIP_PT_clip_view_panel, Panel):
             layout.operator("clip.open", icon='FILESEL')
 
 
+
 class CLIP_PT_tools_clip(CLIP_PT_clip_view_panel, Panel):
     bl_space_type = 'CLIP_EDITOR'
     bl_region_type = 'TOOLS'
@@ -942,16 +1136,26 @@ class CLIP_MT_select(Menu):
 
     def draw(self, context):
         layout = self.layout
+        sc = context.space_data
 
-        layout.operator("clip.select_border")
-        layout.operator("clip.select_circle")
+        if sc.mode == 'MASKEDITING':
+            layout.operator("mask.select_border")
+            layout.operator("mask.select_circle")
 
-        layout.separator()
+            layout.separator()
+
+            layout.operator("mask.select_all").action = 'TOGGLE'
+            layout.operator("mask.select_all", text="Inverse").action = 'INVERT'
+        else:
+            layout.operator("clip.select_border")
+            layout.operator("clip.select_circle")
+
+            layout.separator()
 
-        layout.operator("clip.select_all").action = 'TOGGLE'
-        layout.operator("clip.select_all", text="Inverse").action = 'INVERT'
+            layout.operator("clip.select_all").action = 'TOGGLE'
+            layout.operator("clip.select_all", text="Inverse").action = 'INVERT'
 
-        layout.menu("CLIP_MT_select_grouped")
+            layout.menu("CLIP_MT_select_grouped")
 
 
 class CLIP_MT_select_grouped(Menu):
@@ -995,6 +1199,55 @@ class CLIP_MT_tracking_specials(Menu):
         props.action = 'UNLOCK'
 
 
+class CLIP_MT_mask(Menu):
+    bl_label = "Mask"
+
+    def draw(self, context):
+        layout = self.layout
+
+        layout.operator("mask.delete")
+
+        layout.separator()
+        layout.operator("mask.cyclic_toggle")
+        layout.operator("mask.switch_direction")
+
+        layout.separator()
+        layout.operator("mask.parent_clear")
+        layout.operator("mask.parent_set")
+
+        layout.separator()
+        layout.operator("mask.shape_key_clear")
+        layout.operator("mask.shape_key_insert")
+
+        layout.separator()
+        layout.menu("CLIP_MT_mask_visibility")
+        layout.menu("CLIP_MT_mask_transform")
+
+
+class CLIP_MT_mask_visibility(Menu):
+    bl_label = "Show/Hide"
+
+    def draw(self, context):
+        layout = self.layout
+
+        layout.operator("mask.hide_view_clear", text="Show Hidden")
+        layout.operator("mask.hide_view_set", text="Hide Selected")
+
+        props = layout.operator("mask.hide_view_set", text="Hide Unselected")
+        props.unselected = True
+
+
+class CLIP_MT_mask_transform(Menu):
+    bl_label = "Transform"
+
+    def draw(self, context):
+        layout = self.layout
+
+        layout.operator("transform.translate")
+        layout.operator("transform.rotate")
+        layout.operator("transform.resize")
+
+
 class CLIP_MT_camera_presets(Menu):
     """Predefined tracking camera intrinsics"""
     bl_label = "Camera Presets"
index ed1308d41ba7b733d0bfc9f1171308ee4de525d0..a0d840b5de6362f6978ee3cbe2a4fb69bb811a55 100644 (file)
@@ -86,6 +86,7 @@ set(SRC_DNA_INC
        ${CMAKE_CURRENT_SOURCE_DIR}/makesdna/DNA_world_types.h
        ${CMAKE_CURRENT_SOURCE_DIR}/makesdna/DNA_movieclip_types.h
        ${CMAKE_CURRENT_SOURCE_DIR}/makesdna/DNA_tracking_types.h
+       ${CMAKE_CURRENT_SOURCE_DIR}/makesdna/DNA_mask_types.h
 )
 
 add_subdirectory(editors)
index 23df246b430b9e1d6ddc07e685b33814cc62c6d4..7a1172335d8188fee5cb58864ad84eb3923687f0 100644 (file)
@@ -260,6 +260,7 @@ struct Image *CTX_data_edit_image(const bContext *C);
 
 struct Text *CTX_data_edit_text(const bContext *C);
 struct MovieClip *CTX_data_edit_movieclip(const bContext *C);
+struct Mask *CTX_data_edit_mask(const bContext *C);
 
 int CTX_data_selected_nodes(const bContext *C, ListBase *list);
 
index 3a19d6c9007e9cb3c982a29d44ccd8dcce4be443..3248944dae8f668a09d45192dc61a42b0452f3a7 100644 (file)
@@ -66,7 +66,7 @@ void id_clear_lib_data(struct Main *bmain, struct ID *id);
 
 struct ListBase *which_libbase(struct Main *mainlib, short type);
 
-#define MAX_LIBARRAY    40
+#define MAX_LIBARRAY    41
 int set_listbasepointers(struct Main *main, struct ListBase **lb);
 
 void BKE_libblock_free(struct ListBase *lb, void *idv);
index 09c91a59ac502fe45ec4819116730354ffd28818..3074e1c0e63d43a27baabc7cac9e46a2e02416b1 100644 (file)
@@ -86,6 +86,7 @@ typedef struct Main {
        ListBase wm;
        ListBase gpencil;
        ListBase movieclip;
+       ListBase mask;
 
        char id_tag_update[256];
 } Main;
index d093c9108b6be059ffdb765efdbce48ec3028b77..b9d0076c7c89057745105d47e881073655b08260 100644 (file)
@@ -658,6 +658,7 @@ void                        ntreeGPUMaterialNodes(struct bNodeTree *ntree, struct GPUMaterial *mat);
 #define CMP_NODE_MOVIEDISTORTION       265
 #define CMP_NODE_DOUBLEEDGEMASK    266
 #define CMP_NODE_OUTPUT_MULTI_FILE__DEPRECATED 267     /* DEPRECATED multi file node has been merged into regular CMP_NODE_OUTPUT_FILE */
+#define CMP_NODE_MASK          268
 
 #define CMP_NODE_GLARE         301
 #define CMP_NODE_TONEMAP       302
index d207a08c6cb84d86c94254a4c79abe3ed074e062..056a6bf586690b9e9757d077d8a1ed48994a19ff 100644 (file)
@@ -43,6 +43,7 @@ set(INC
        ../../../intern/memutil
        ../../../intern/mikktspace
        ../../../intern/opennl/extern
+       ../../../intern/raskter
 
        # XXX - BAD LEVEL CALL WM_api.h
        ../windowmanager
@@ -100,6 +101,7 @@ set(SRC
        intern/lamp.c
        intern/lattice.c
        intern/library.c
+       intern/mask.c
        intern/material.c
        intern/mball.c
        intern/mesh.c
@@ -187,6 +189,7 @@ set(SRC
        BKE_lamp.h
        BKE_lattice.h
        BKE_library.h
+       BKE_mask.h
        BKE_main.h
        BKE_material.h
        BKE_mball.h
index ee9e6bc7739ca513df8cd9b204765f64d6297f94..64544adb26dbff14d16f26010d2b2edf6e8b0e3d 100644 (file)
@@ -17,6 +17,7 @@ incs += ' #/intern/smoke/extern'
 incs += ' #/intern/mikktspace'
 incs += ' #/intern/audaspace/intern'
 incs += ' #/intern/ffmpeg'
+incs += ' #/intern/raskter'
 
 incs += ' ' + env['BF_OPENGL_INC']
 incs += ' ' + env['BF_ZLIB_INC']
index 1358c2e34a8dc2269b6d1772b5beaeb5845f16b2..7fc805297533195b07a10ccb1f6ce8f18d471eb4 100644 (file)
@@ -90,6 +90,7 @@ short id_type_can_have_animdata(ID *id)
                case ID_SPK:
                case ID_SCE:
                case ID_MC:
+               case ID_MSK:
                {
                        return 1;
                }
@@ -802,10 +803,13 @@ void BKE_animdata_main_cb(Main *mainptr, ID_AnimData_Edit_Callback func, void *u
 
        /* objects */
        ANIMDATA_IDS_CB(mainptr->object.first);
+
+       /* masks */
+       ANIMDATA_IDS_CB(mainptr->mask.first);
        
        /* worlds */
        ANIMDATA_IDS_CB(mainptr->world.first);
-       
+
        /* scenes */
        ANIMDATA_NODETREE_IDS_CB(mainptr->scene.first, Scene);
 }
@@ -886,6 +890,9 @@ void BKE_all_animdata_fix_paths_rename(ID *ref_id, const char *prefix, const cha
 
        /* objects */
        RENAMEFIX_ANIM_IDS(mainptr->object.first); 
+
+       /* masks */
+       RENAMEFIX_ANIM_IDS(mainptr->mask.first);
        
        /* worlds */
        RENAMEFIX_ANIM_IDS(mainptr->world.first);
@@ -2350,6 +2357,9 @@ void BKE_animsys_evaluate_all_animation(Main *main, Scene *scene, float ctime)
         * linked from other (not-visible) scenes will not need their data calculated.
         */
        EVAL_ANIM_IDS(main->object.first, 0); 
+
+       /* masks */
+       EVAL_ANIM_IDS(main->mask.first, ADT_RECALC_ANIM);
        
        /* worlds */
        EVAL_ANIM_NODETREE_IDS(main->world.first, World, ADT_RECALC_ANIM);
index 3c8f29d84409719e9363953d35a34da01a28a0d2..ff2dd27e0c95eadf876321e7bfce21781161d9f0 100644 (file)
@@ -973,6 +973,11 @@ struct MovieClip *CTX_data_edit_movieclip(const bContext *C)
        return ctx_data_pointer_get(C, "edit_movieclip");
 }
 
+struct Mask *CTX_data_edit_mask(const bContext *C)
+{
+       return ctx_data_pointer_get(C, "edit_mask");
+}
+
 struct EditBone *CTX_data_active_bone(const bContext *C)
 {
        return ctx_data_pointer_get(C, "active_bone");
index a6ce5daf24749e795591de3b3d888433e11155b2..53bc9c4cb7ee530f4e610eed462423c401b17ddc 100644 (file)
@@ -2611,6 +2611,18 @@ static void dag_id_flush_update(Scene *sce, ID *id)
                        }
                }
 
+               if (idtype == ID_MSK) {
+                       if (sce->nodetree) {
+                               bNode *node;
+
+                               for (node = sce->nodetree->nodes.first; node; node = node->next) {
+                                       if (node->id == id) {
+                                               nodeUpdate(sce->nodetree, node);
+                                       }
+                               }
+                       }
+               }
+
                /* camera's matrix is used to orient reconstructed stuff,
                 * so it should happen tracking-related constraints recalculation
                 * when camera is changing (sergey) */
index ca10f39246cf3a109e9c502c62f0d7ec412b7526..30427a81c4b23acd167d547b81e54c40338e992c 100644 (file)
@@ -79,6 +79,7 @@ static IDType idtypes[] = {
        { ID_WO,        "World",    "worlds",       IDTYPE_FLAGS_ISLINKABLE},
        { ID_WM,        "WindowManager", "window_managers", 0},
        { ID_MC,        "MovieClip", "movieclips",  IDTYPE_FLAGS_ISLINKABLE},
+       { ID_MSK,        "Mask",     "masks",       IDTYPE_FLAGS_ISLINKABLE},
 };
 static int nidtypes = sizeof(idtypes) / sizeof(idtypes[0]);
 
index de67119d85024339ceefefa4d3bd5f90770bf6f0..0abeb48374543848d825202c5001d2e510a0fd8a 100644 (file)
@@ -66,6 +66,7 @@
 #include "DNA_world_types.h"
 #include "DNA_gpencil_types.h"
 #include "DNA_movieclip_types.h"
+#include "DNA_mask_types.h"
 
 #include "BLI_blenlib.h"
 #include "BLI_dynstr.h"
 #include "BKE_speaker.h"
 #include "BKE_utildefines.h"
 #include "BKE_movieclip.h"
+#include "BKE_mask.h"
 
 #include "RNA_access.h"
 
@@ -486,6 +488,8 @@ ListBase *which_libbase(Main *mainlib, short type)
                        return &(mainlib->gpencil);
                case ID_MC:
                        return &(mainlib->movieclip);
+               case ID_MSK:
+                       return &(mainlib->mask);
        }
        return NULL;
 }
@@ -569,6 +573,7 @@ int set_listbasepointers(Main *main, ListBase **lb)
        lb[a++] = &(main->library);
        lb[a++] = &(main->wm);
        lb[a++] = &(main->movieclip);
+       lb[a++] = &(main->mask);
        
        lb[a] = NULL;
 
@@ -680,6 +685,9 @@ static ID *alloc_libblock_notest(short type)
                case ID_MC:
                        id = MEM_callocN(sizeof(MovieClip), "Movie Clip");
                        break;
+               case ID_MSK:
+                       id = MEM_callocN(sizeof(Mask), "Mask");
+                       break;
        }
        return id;
 }
@@ -888,6 +896,9 @@ void BKE_libblock_free(ListBase *lb, void *idv)
                case ID_MC:
                        BKE_movieclip_free((MovieClip *)id);
                        break;
+               case ID_MSK:
+                       BKE_mask_free((Mask *)id);
+                       break;
        }
 
        if (id->properties) {
index 22286e57c0a29904fd5fda9d317beb2d0380947f..86a1f715c3c0aea150cc8457383c7f7e43b9c987 100644 (file)
@@ -1910,6 +1910,8 @@ static void registerCompositNodes(bNodeTreeType *ttype)
        register_node_type_cmp_bokehimage(ttype);
        register_node_type_cmp_bokehblur(ttype);
        register_node_type_cmp_switch(ttype);
+
+       register_node_type_cmp_mask(ttype);
 }
 
 static void registerShaderNodes(bNodeTreeType *ttype) 
index 62d5459336bd67efa8976a8641045746f567dda1..d9f1a6372ee6e7d8ed6d1909b22d9151ce28d2eb 100644 (file)
@@ -63,6 +63,7 @@
 #include "BKE_idprop.h"
 #include "BKE_library.h"
 #include "BKE_main.h"
+#include "BKE_mask.h"
 #include "BKE_node.h"
 #include "BKE_object.h"
 #include "BKE_paint.h"
@@ -1004,6 +1005,9 @@ static void scene_update_tagged_recursive(Main *bmain, Scene *scene, Scene *scen
 
        /* update sound system animation */
        sound_update_scene(scene);
+
+       /* update masking curves */
+       BKE_mask_update_scene(bmain, scene, FALSE);
 }
 
 /* this is called in main loop, doing tagged updates before redraw */
@@ -1074,6 +1078,8 @@ void BKE_scene_update_for_newframe(Main *bmain, Scene *sce, unsigned int lay)
         * so don't call within 'scene_update_tagged_recursive' */
        DAG_scene_update_flags(bmain, sce, lay, TRUE);   // only stuff that moves or needs display still
 
+       BKE_mask_evaluate_all_masks(bmain, ctime, TRUE);
+
        /* All 'standard' (i.e. without any dependencies) animation is handled here,
         * with an 'local' to 'macro' order of evaluation. This should ensure that
         * settings stored nestled within a hierarchy (i.e. settings in a Texture block
index e41e9ba18a1b8074026bb5b0240c805edb0b146f..826d9d196b86017616a9ce776bcd84e8dffde39c 100644 (file)
@@ -95,6 +95,7 @@
 #include "DNA_vfont_types.h"
 #include "DNA_world_types.h"
 #include "DNA_movieclip_types.h"
+#include "DNA_mask_types.h"
 
 #include "MEM_guardedalloc.h"
 
@@ -5353,9 +5354,10 @@ static void lib_link_screen(FileData *fd, Main *main)
                                        }
                                        else if (sl->spacetype == SPACE_CLIP) {
                                                SpaceClip *sclip = (SpaceClip *)sl;
-                                               
+
                                                sclip->clip = newlibadr_us(fd, sc->id.lib, sclip->clip);
-                                               
+                                               sclip->mask = newlibadr_us(fd, sc->id.lib, sclip->mask);
+
                                                sclip->scopes.track_preview = NULL;
                                                sclip->draw_context = NULL;
                                                sclip->scopes.ok = 0;
@@ -5616,9 +5618,10 @@ void lib_link_screen_restore(Main *newmain, bScreen *curscreen, Scene *curscene)
                                }
                                else if (sl->spacetype == SPACE_CLIP) {
                                        SpaceClip *sclip = (SpaceClip *)sl;
-                                       
+
                                        sclip->clip = restore_pointer_by_name(newmain, (ID *)sclip->clip, 1);
-                                       
+                                       sclip->mask = restore_pointer_by_name(newmain, (ID *)sclip->mask, 1);
+
                                        sclip->scopes.ok = 0;
                                }
                        }
@@ -6173,6 +6176,88 @@ static void lib_link_movieclip(FileData *fd, Main *main)
        }
 }
 
+/* ***************** READ MOVIECLIP *************** */
+
+static void direct_link_mask(FileData *fd, Mask *mask)
+{
+       MaskLayer *masklay;
+
+       mask->adt = newdataadr(fd, mask->adt);
+
+       link_list(fd, &mask->masklayers);
+
+       for (masklay = mask->masklayers.first; masklay; masklay = masklay->next) {
+               MaskSpline *spline;
+               MaskLayerShape *masklay_shape;
+
+               link_list(fd, &masklay->splines);
+
+               for (spline = masklay->splines.first; spline; spline = spline->next) {
+                       int i;
+
+                       spline->points = newdataadr(fd, spline->points);
+
+                       for (i = 0; i < spline->tot_point; i++) {
+                               MaskSplinePoint *point = &spline->points[i];
+
+                               if (point->tot_uw)
+                                       point->uw = newdataadr(fd, point->uw);
+                       }
+               }
+
+               link_list(fd, &masklay->splines_shapes);
+
+               for (masklay_shape = masklay->splines_shapes.first; masklay_shape; masklay_shape = masklay_shape->next) {
+                       masklay_shape->data = newdataadr(fd, masklay_shape->data);
+               }
+
+               masklay->act_spline = newdataadr(fd, masklay->act_spline);
+               masklay->act_point = newdataadr(fd, masklay->act_point);
+       }
+}
+
+static void lib_link_mask_parent(FileData *fd, Mask *mask, MaskParent *parent)
+{
+       parent->id = newlibadr_us(fd, mask->id.lib, parent->id);
+}
+
+static void lib_link_mask(FileData *fd, Main *main)
+{
+       Mask *mask;
+
+       mask = main->mask.first;
+       while (mask) {
+               if(mask->id.flag & LIB_NEEDLINK) {
+                       MaskLayer *masklay;
+
+                       if (mask->adt)
+                               lib_link_animdata(fd, &mask->id, mask->adt);
+
+                       for (masklay = mask->masklayers.first; masklay; masklay = masklay->next) {
+                               MaskSpline *spline;
+
+                               spline = masklay->splines.first;
+                               while (spline) {
+                                       int i;
+
+                                       for (i = 0; i < spline->tot_point; i++) {
+                                               MaskSplinePoint *point = &spline->points[i];
+
+                                               lib_link_mask_parent(fd, mask, &point->parent);
+                                       }
+
+                                       lib_link_mask_parent(fd, mask, &spline->parent);
+
+                                       spline = spline->next;
+                               }
+                       }
+
+                       mask->id.flag -= LIB_NEEDLINK;
+               }
+               mask = mask->id.next;
+       }
+}
+
 /* ************** GENERAL & MAIN ******************** */
 
 
@@ -6378,6 +6463,9 @@ static BHead *read_libblock(FileData *fd, Main *main, BHead *bhead, int flag, ID
                case ID_MC:
                        direct_link_movieclip(fd, (MovieClip *)id);
                        break;
+               case ID_MSK:
+                       direct_link_mask(fd, (Mask *)id);
+                       break;
        }
        
        /*link direct data of ID properties*/
@@ -7506,7 +7594,7 @@ static void do_versions(FileData *fd, Library *lib, Main *main)
                        }
                }
        }
-       
+
        if (main->versionfile < 263 || (main->versionfile == 263 && main->subversionfile < 8))
        {
                /* set new deactivation values for game settings */
@@ -7533,7 +7621,29 @@ static void do_versions(FileData *fd, Library *lib, Main *main)
                        }
                }
        }
-       
+
+       {
+               bScreen *sc;
+
+               for (sc = main->screen.first; sc; sc = sc->id.next) {
+                       ScrArea *sa;
+
+                       for (sa = sc->areabase.first; sa; sa = sa->next) {
+                               SpaceLink *sl;
+
+                               for (sl = sa->spacedata.first; sl; sl = sl->next) {
+                                       if (sl->spacetype == SPACE_CLIP) {
+                                               SpaceClip *sclip = (SpaceClip *)sl;
+
+                                               if (sclip->around == 0) {
+                                                       sclip->around = V3D_CENTROID;
+                                               }
+                                       }
+                               }
+                       }
+               }
+       }
+
        /* don't forget to set version number in blender.c! */
 }
 
@@ -7576,7 +7686,8 @@ static void lib_link_all(FileData *fd, Main *main)
        lib_link_brush(fd, main);
        lib_link_particlesettings(fd, main);
        lib_link_movieclip(fd, main);
-       
+       lib_link_mask(fd, main);
+
        lib_link_mesh(fd, main);                /* as last: tpage images with users at zero */
        
        lib_link_library(fd, main);             /* only init users */
index 4f75e8e5fbf5629fdcd584a8da465fe3d68f0f78..655adf97b048fac0e35245efbc06274415dd1e97 100644 (file)
@@ -133,6 +133,7 @@ Any case: direct data is ALWAYS after the lib block
 #include "DNA_world_types.h"
 #include "DNA_windowmanager_types.h"
 #include "DNA_movieclip_types.h"
+#include "DNA_mask_types.h"
 
 #include "MEM_guardedalloc.h" // MEM_freeN
 #include "BLI_bitmap.h"
@@ -2752,6 +2753,59 @@ static void write_movieclips(WriteData *wd, ListBase *idbase)
        mywrite(wd, MYWRITE_FLUSH, 0);
 }
 
+static void write_masks(WriteData *wd, ListBase *idbase)
+{
+       Mask *mask;
+
+       mask = idbase->first;
+       while (mask) {
+               if (mask->id.us > 0 || wd->current) {
+                       MaskLayer *masklay;
+
+                       writestruct(wd, ID_MSK, "Mask", 1, mask);
+
+                       if (mask->adt)
+                               write_animdata(wd, mask->adt);
+
+                       for (masklay = mask->masklayers.first; masklay; masklay = masklay->next) {
+                               MaskSpline *spline;
+                               MaskLayerShape *masklay_shape;
+
+                               writestruct(wd, DATA, "MaskLayer", 1, masklay);
+
+                               for (spline = masklay->splines.first; spline; spline = spline->next) {
+                                       int i;
+
+                                       void *points_deform = spline->points_deform;
+                                       spline->points_deform = NULL;
+
+                                       writestruct(wd, DATA, "MaskSpline", 1, spline);
+                                       writestruct(wd, DATA, "MaskSplinePoint", spline->tot_point, spline->points);
+
+                                       spline->points_deform = points_deform;
+
+                                       for (i = 0; i < spline->tot_point; i++) {
+                                               MaskSplinePoint *point = &spline->points[i];
+
+                                               if (point->tot_uw)
+                                                       writestruct(wd, DATA, "MaskSplinePointUW", point->tot_uw, point->uw);
+                                       }
+                               }
+
+                               for (masklay_shape = masklay->splines_shapes.first; masklay_shape; masklay_shape = masklay_shape->next) {
+                                       writestruct(wd, DATA, "MaskLayerShape", 1, masklay_shape);
+                                       writedata(wd, DATA, masklay_shape->tot_vert * sizeof(float) * MASK_OBJECT_SHAPE_ELEM_SIZE, masklay_shape->data);
+                               }
+                       }
+               }
+
+               mask = mask->id.next;
+       }
+
+       /* flush helps the compression for undo-save */
+       mywrite(wd, MYWRITE_FLUSH, 0);
+}
+
 /* context is usually defined by WM, two cases where no WM is available:
  * - for forward compatibility, curscreen has to be saved
  * - for undofile, curscene needs to be saved */
@@ -2836,6 +2890,7 @@ static int write_file_handle(Main *mainvar, int handle, MemFile *compare, MemFil
                write_screens  (wd, &mainvar->screen);
        }
        write_movieclips (wd, &mainvar->movieclip);
+       write_masks    (wd, &mainvar->mask);
        write_scenes   (wd, &mainvar->scene);
        write_curves   (wd, &mainvar->curve);
        write_mballs   (wd, &mainvar->mball);
index dc28328e867f727250af0c221515af3bd5c0ff44..27bf7df81424dc796a16f49591cd93f2445ea960 100644 (file)
@@ -129,6 +129,8 @@ set(SRC
        nodes/COM_MovieClipNode.h
        nodes/COM_OutputFileNode.cpp
        nodes/COM_OutputFileNode.h
+       nodes/COM_MaskNode.cpp
+       nodes/COM_MaskNode.h
 
 # output nodes
        nodes/COM_CompositorNode.cpp
@@ -594,6 +596,9 @@ operations/COM_ConvertDepthToRadiusOperation.cpp
 
        operations/COM_AntiAliasOperation.cpp
        operations/COM_AntiAliasOperation.h
+
+       operations/COM_MaskOperation.cpp
+       operations/COM_MaskOperation.h
 )
 
 blender_add_lib(bf_compositor "${SRC}" "${INC}" "${INC_SYS}")
index 3cb297801caa65ed4cd8c58724f80c97af2f6b1c..dc6409e7b8657b7f89a118f285a9c4ab0d97b1d9 100644 (file)
 #include "COM_DefocusNode.h"
 #include "COM_DoubleEdgeMaskNode.h"
 #include "COM_CropNode.h"
+#include "COM_MaskNode.h"
 
 Node *Converter::convert(bNode *bNode)
 {
@@ -347,6 +348,9 @@ case CMP_NODE_OUTPUT_FILE:
        case CMP_NODE_CROP:
                node = new CropNode(bNode);
                break;
+       case CMP_NODE_MASK:
+               node = new MaskNode(bNode);
+               break;
        /* not inplemented yet */
        default:
                node = new MuteNode(bNode);
index 088376b20ef32ed189000de794843ed379022b1d..67ed77bcc4b25c2254d283280d28ebb72cb1c91d 100644 (file)
@@ -24,6 +24,7 @@ if(WITH_BLENDER)
        add_subdirectory(curve)
        add_subdirectory(gpencil)
        add_subdirectory(interface)
+       add_subdirectory(mask)
        add_subdirectory(mesh)
        add_subdirectory(metaball)
        add_subdirectory(object)
index ed66a76a324cd773bac01d385634c88a416f195b..d08b496f0efcdecfb214412d07f62d14f8a250b6 100644 (file)
@@ -8,6 +8,7 @@ SConscript(['datafiles/SConscript',
             'interface/SConscript',
             'animation/SConscript',
             'armature/SConscript',
+            'mask/SConscript',
             'mesh/SConscript',
             'metaball/SConscript',
             'object/SConscript',
index cb7dc7ac2063bb8d38d96f5980b1679571820f03..cee8d15a80767460b5f762bd614c1f4d76d63148 100644 (file)
@@ -60,6 +60,7 @@
 #include "DNA_speaker_types.h"
 #include "DNA_world_types.h"
 #include "DNA_gpencil_types.h"
+#include "DNA_mask_types.h"
 
 #include "BKE_key.h"
 #include "BKE_material.h"
@@ -184,6 +185,50 @@ static void nupdate_ak_gpframe(void *node, void *data)
        ak->modified += 1;
 }
 
+/* ......... */
+
+/* Comparator callback used for ActKeyColumns and GPencil frame */
+static short compare_ak_masklayshape(void *node, void *data)
+{
+       ActKeyColumn *ak = (ActKeyColumn *)node;
+       MaskLayerShape *masklay_shape = (MaskLayerShape *)data;
+
+       if (masklay_shape->frame < ak->cfra)
+               return -1;
+       else if (masklay_shape->frame > ak->cfra)
+               return 1;
+       else
+               return 0;
+}
+
+/* New node callback used for building ActKeyColumns from GPencil frames */
+static DLRBT_Node *nalloc_ak_masklayshape(void *data)
+{
+       ActKeyColumn *ak = MEM_callocN(sizeof(ActKeyColumn), "ActKeyColumnGPF");
+       MaskLayerShape *masklay_shape = (MaskLayerShape *)data;
+
+       /* store settings based on state of BezTriple */
+       ak->cfra = masklay_shape->frame;
+       ak->sel = (masklay_shape->flag & SELECT) ? SELECT : 0;
+
+       /* set 'modified', since this is used to identify long keyframes */
+       ak->modified = 1;
+
+       return (DLRBT_Node *)ak;
+}
+
+/* Node updater callback used for building ActKeyColumns from GPencil frames */
+static void nupdate_ak_masklayshape(void *node, void *data)
+{
+       ActKeyColumn *ak = (ActKeyColumn *)node;
+       MaskLayerShape *masklay_shape = (MaskLayerShape *)data;
+
+       /* set selection status and 'touched' status */
+       if (masklay_shape->flag & SELECT) ak->sel = SELECT;
+       ak->modified += 1;
+}
+
+
 /* --------------- */
 
 /* Add the given BezTriple to the given 'list' of Keyframes */
@@ -204,6 +249,15 @@ static void add_gpframe_to_keycolumns_list(DLRBT_Tree *keys, bGPDframe *gpf)
                BLI_dlrbTree_add(keys, compare_ak_gpframe, nalloc_ak_gpframe, nupdate_ak_gpframe, gpf);
 }
 
+/* Add the given MaskLayerShape Frame to the given 'list' of Keyframes */
+static void add_masklay_to_keycolumns_list(DLRBT_Tree *keys, MaskLayerShape *masklay_shape)
+{
+       if (ELEM(NULL, keys, masklay_shape))
+               return;
+       else
+               BLI_dlrbTree_add(keys, compare_ak_masklayshape, nalloc_ak_masklayshape, nupdate_ak_masklayshape, masklay_shape);
+}
+
 /* ActBeztColumns (Helpers for Long Keyframes) ------------------------------ */
 
 /* maximum size of default buffer for BezTriple columns */
@@ -940,3 +994,17 @@ void gpl_to_keylist(bDopeSheet *UNUSED(ads), bGPDlayer *gpl, DLRBT_Tree *keys)
        }
 }
 
+void mask_to_keylist(bDopeSheet *UNUSED(ads), MaskLayer *masklay, DLRBT_Tree *keys)
+{
+       MaskLayerShape *masklay_shape;
+
+       if (masklay && keys) {
+               for (masklay_shape = masklay->splines_shapes.first;
+                    masklay_shape;
+                    masklay_shape = masklay_shape->next)
+               {
+                       add_masklay_to_keycolumns_list(keys, masklay_shape);
+               }
+       }
+}
+
index 7943a17c377dad0e0acee71a24193c6aa4085f10..7e1505b652f27822f48d09088a80608eb659099b 100644 (file)
@@ -36,6 +36,7 @@ struct bContext;
 struct bScreen;
 struct ImBuf;
 struct Main;
+struct Mask;
 struct MovieClip;
 struct SpaceClip;
 struct wmEvent;
@@ -48,12 +49,19 @@ int ED_space_clip_view_clip_poll(struct bContext *C);
 int ED_space_clip_tracking_poll(struct bContext *C);
 int ED_space_clip_tracking_size_poll(struct bContext *C);
 int ED_space_clip_tracking_frame_poll(struct bContext *C);
+int ED_space_clip_maskediting_poll(struct bContext *C);
+int ED_space_clip_maskediting_mask_poll(bContext *C);
 
 void ED_space_clip_set(struct bContext *C, struct bScreen *screen, struct SpaceClip *sc, struct MovieClip *clip);
 struct MovieClip *ED_space_clip(struct SpaceClip *sc);
+struct Mask *ED_space_clip_mask(struct SpaceClip *sc);
 void ED_space_clip_size(struct SpaceClip *sc, int *width, int *height);
 void ED_space_clip_zoom(struct SpaceClip *sc, ARegion *ar, float *zoomx, float *zoomy);
 void ED_space_clip_aspect(struct SpaceClip *sc, float *aspx, float *aspy);
+void ED_space_clip_aspect_dimension_aware(struct SpaceClip *sc, float *aspx, float *aspy);
+
+void ED_space_clip_mask_size(struct SpaceClip *sc, int *width, int *height);
+void ED_space_clip_mask_aspect(struct SpaceClip *sc, float *aspx, float *aspy);
 
 struct ImBuf *ED_space_clip_get_buffer(struct SpaceClip *sc);
 struct ImBuf *ED_space_clip_get_stable_buffer(struct SpaceClip *sc, float loc[2], float *scale, float *angle);
@@ -72,6 +80,8 @@ void ED_space_clip_unload_movieclip_buffer(struct SpaceClip *sc);
 void ED_space_clip_free_texture_buffer(struct SpaceClip *sc);
 
 int ED_space_clip_show_trackedit(struct SpaceClip *sc);
+int ED_space_clip_show_maskedit(struct SpaceClip *sc);
+void ED_space_clip_set_mask(struct bContext *C, struct SpaceClip *sc, struct Mask *mask);
 
 /* clip_ops.c */
 void ED_operatormacros_clip(void);
index cd64427de7886f21cb06042da9c8e0a7a5a6be87..e24c21bc1331e334cf05445b6fdbc4b2d611b6a2 100644 (file)
@@ -42,6 +42,7 @@ struct bActionGroup;
 struct Object;
 struct ListBase;
 struct bGPDlayer;
+struct MaskLayer;
 struct Scene;
 struct View2D;
 struct DLRBT_Tree;
@@ -139,6 +140,9 @@ void summary_to_keylist(struct bAnimContext *ac, struct DLRBT_Tree *keys, struct
 /* Grease Pencil Layer */
 // XXX not restored
 void gpl_to_keylist(struct bDopeSheet *ads, struct bGPDlayer *gpl, struct DLRBT_Tree *keys);
+/* Mask */
+// XXX not restored
+void mask_to_keylist(struct bDopeSheet *UNUSED(ads), struct MaskLayer *masklay, struct DLRBT_Tree *keys);
 
 /* ActKeyColumn API ---------------- */
 /* Comparator callback used for ActKeyColumns and cframe float-value pointer */
index 8dc83df297712fa246ea28d5376f53d171a4618e..9c10a270ef8fd432d927f52c690cd98be5f115fe 100644 (file)
@@ -90,6 +90,7 @@ struct Base *ED_object_scene_link(struct Scene *scene, struct Object *ob);
 
 void ED_keymap_proportional_cycle(struct wmKeyConfig *keyconf, struct wmKeyMap *keymap);
 void ED_keymap_proportional_obmode(struct wmKeyConfig *keyconf, struct wmKeyMap *keymap);
+void ED_keymap_proportional_maskmode(struct wmKeyConfig *keyconf, struct wmKeyMap *keymap);
 void ED_keymap_proportional_editmode(struct wmKeyConfig *keyconf, struct wmKeyMap *keymap,
                                      const short do_connected);
 
index 464f2db30a26b0dc61d2db66a5a17b091b29e800..4faf82eec36f65e50acd0689b854aa9bf9e5926a 100644 (file)
@@ -170,6 +170,7 @@ int     ED_operator_editmball(struct bContext *C);
 int     ED_operator_uvedit(struct bContext *C);
 int     ED_operator_uvmap(struct bContext *C);
 int     ED_operator_posemode(struct bContext *C);
+int     ED_operator_mask(struct bContext *C);
 
 
 /* default keymaps, bitflags */
index 3bef1f566559f9b1e3e5a06813eda30a2323a230..d867532b2734721bc4514ae2e4687bd29b0f7aa9 100644 (file)
@@ -96,6 +96,7 @@ enum {
 #define CTX_BMESH           64
 #define CTX_NDOF            128
 #define CTX_MOVIECLIP       256
+#define CTX_MASK            512
 
 /* Standalone call to get the transformation center corresponding to the current situation
  * returns 1 if successful, 0 otherwise (usually means there's no selection)
index 59ef0c00283d08f04feb3a0bb87d3fcbfa86b2d4..daba096696c7da6bfda440194c6978b81e547c64 100644 (file)
@@ -579,8 +579,10 @@ void uiTemplateAnyID(uiLayout *layout, PointerRNA *ptr, const char *propname, co
        row = uiLayoutRow(layout, 1);
        
        /* Label - either use the provided text, or will become "ID-Block:" */
-       if (text)
-               uiItemL(row, text, ICON_NONE);
+       if (text) {
+               if (text[0])
+                       uiItemL(row, text, ICON_NONE);
+       }
        else
                uiItemL(row, "ID-Block:", ICON_NONE);
        
@@ -2239,6 +2241,20 @@ static void list_item_row(bContext *C, uiLayout *layout, PointerRNA *ptr, Pointe
                        uiItemL(split, name, ICON_OBJECT_DATA);
                }
        }
+       else if (itemptr->type == &RNA_MaskLayer) {
+               split = uiLayoutSplit(sub, 0.66f, 0);
+
+               uiItemL(split, name, icon);
+
+               uiBlockSetEmboss(block, UI_EMBOSSN);
+               row = uiLayoutRow(split, 1);
+               // uiItemR(row, itemptr, "alpha", 0, "", ICON_NONE); // enable when used
+               uiItemR(row, itemptr, "hide", 0, "", 0);
+               uiItemR(row, itemptr, "hide_select", 0, "", 0);
+               uiItemR(row, itemptr, "hide_render", 0, "", 0);
+
+               uiBlockSetEmboss(block, UI_EMBOSS);
+       }
 
        /* There is a last chance to display custom controls (in addition to the name/label):
         * If the given item property group features a string property named as prop_list,
index 6e653eff57c1d4e140031585b02efe9ea2f08496..d0a93302b7fdb28b500eb82f19869e7faf994769 100644 (file)
@@ -441,6 +441,14 @@ void ED_keymap_proportional_obmode(struct wmKeyConfig *UNUSED(keyconf), struct w
        RNA_string_set(kmi->ptr, "data_path", "tool_settings.use_proportional_edit_objects");
 }
 
+void ED_keymap_proportional_maskmode(struct wmKeyConfig *UNUSED(keyconf), struct wmKeyMap *keymap)
+{
+       wmKeyMapItem *kmi;
+
+       kmi = WM_keymap_add_item(keymap, "WM_OT_context_toggle", OKEY, KM_PRESS, 0, 0);
+       RNA_string_set(kmi->ptr, "data_path", "tool_settings.use_proportional_edit_mask");
+}
+
 void ED_keymap_proportional_editmode(struct wmKeyConfig *UNUSED(keyconf), struct wmKeyMap *keymap,
                                      const short do_connected)
 {
index 8baca2535193ea970349d488f98325a667381790..89c7896d53c97f18e7b8eb8512d961f274bc14b8 100644 (file)
@@ -46,6 +46,7 @@
 #include "DNA_scene_types.h"
 #include "DNA_meta_types.h"
 #include "DNA_mesh_types.h"
+#include "DNA_mask_types.h"
 #include "DNA_userdef_types.h"
 
 #include "BKE_context.h"
@@ -59,6 +60,7 @@
 #include "BKE_screen.h"
 #include "BKE_tessmesh.h"
 #include "BKE_sound.h"
+#include "BKE_mask.h"
 
 #include "WM_api.h"
 #include "WM_types.h"
@@ -71,6 +73,7 @@
 #include "ED_screen_types.h"
 #include "ED_keyframes_draw.h"
 #include "ED_view3d.h"
+#include "ED_clip.h"
 
 #include "RNA_access.h"
 #include "RNA_define.h"
@@ -453,6 +456,13 @@ int ED_operator_editmball(bContext *C)
        return 0;
 }
 
+int ED_operator_mask(bContext *C)
+{
+       SpaceClip *sc= CTX_wm_space_clip(C);
+
+       return ED_space_clip_show_maskedit(sc);
+}
+
 /* *************************** action zone operator ************************** */
 
 /* operator state vars used:  
@@ -1937,7 +1947,17 @@ static int keyframe_jump_exec(bContext *C, wmOperator *op)
 
        if (ob)
                ob_to_keylist(&ads, ob, &keys, NULL);
-       
+
+       {
+               SpaceClip *sc = CTX_wm_space_clip(C);
+               if (sc) {
+                       if ((sc->mode == SC_MODE_MASKEDITING) && sc->mask) {
+                               MaskLayer *masklay = BKE_mask_layer_active(sc->mask);
+                               mask_to_keylist(&ads, masklay, &keys);
+                       }
+               }
+       }
+
        /* build linked-list for searching */
        BLI_dlrbTree_linkedlist_sync(&keys);
        
index 956aee84fd34f7a45c3e2c29e9dbb1815ee456e4..fa77249a7a180cad1813f6fab4ef598ca9a34f22 100644 (file)
@@ -62,6 +62,7 @@
 #include "ED_mball.h"
 #include "ED_logic.h"
 #include "ED_clip.h"
+#include "ED_mask.h"
 
 /* only call once on startup, storage is global in BKE kernel listbase */
 void ED_spacetypes_init(void)
@@ -111,6 +112,7 @@ void ED_spacetypes_init(void)
        ED_operatortypes_sound();
        ED_operatortypes_render();
        ED_operatortypes_logic();
+       ED_operatortypes_mask();
        
        UI_view2d_operatortypes();
        UI_buttons_operatortypes();
@@ -133,6 +135,7 @@ void ED_spacetypes_init(void)
        ED_operatormacros_action();
        ED_operatormacros_clip();
        ED_operatormacros_curve();
+       ED_operatormacros_mask();
        
        /* register dropboxes (can use macros) */
        spacetypes = BKE_spacetypes_list();
@@ -164,6 +167,7 @@ void ED_spacetypes_keymap(wmKeyConfig *keyconf)
        ED_keymap_physics(keyconf);
        ED_keymap_metaball(keyconf);
        ED_keymap_paint(keyconf);
+       ED_keymap_mask(keyconf);
        ED_marker_keymap(keyconf);
 
        UI_view2d_keymap(keyconf);
index c00359f0f323953707c55eb02e5e27ce46341a19..6ac5ec597429d0e6494627728a78ec4e89a2d928 100644 (file)
 #include "DNA_movieclip_types.h"
 #include "DNA_scene_types.h"
 #include "DNA_object_types.h"  /* SELECT */
+#include "DNA_mask_types.h"
 
 #include "MEM_guardedalloc.h"
 
 #include "BKE_context.h"
 #include "BKE_movieclip.h"
 #include "BKE_tracking.h"
+#include "BKE_mask.h"
 
 #include "IMB_imbuf_types.h"
 #include "IMB_imbuf.h"
@@ -194,6 +196,32 @@ static void draw_movieclip_cache(SpaceClip *sc, ARegion *ar, MovieClip *clip, Sc
        glRecti(x, 0, x + framelen, 8);
 
        clip_draw_curfra_label(sc, x, 8.0f);
+
+       /* movie clip animation */
+       if ((sc->mode == SC_MODE_MASKEDITING) && sc->mask) {
+               MaskLayer *masklay = BKE_mask_layer_active(sc->mask);
+               if (masklay) {
+                       MaskLayerShape *masklay_shape;
+
+                       glColor4ub(255, 175, 0, 255);
+                       glBegin(GL_LINES);
+
+                       for (masklay_shape = masklay->splines_shapes.first;
+                            masklay_shape;
+                            masklay_shape = masklay_shape->next)
+                       {
+                               i = masklay_shape->frame;
+
+                               /* glRecti((i - sfra) * framelen, 0, (i - sfra + 1) * framelen, 4); */
+
+                               /* use a line so we always see the keyframes */
+                               glVertex2i((i - sfra) * framelen, 0);
+                               glVertex2i((i - sfra) * framelen, (i == CFRA) ? 22 : 10);
+                       }
+
+                       glEnd();
+               }
+       }
 }
 
 static void draw_movieclip_notes(SpaceClip *sc, ARegion *ar)
index a477a7435fd249caac134400825a55e11a84c52b..f16ef21b707f9c7ffef72d86c79da725b57cc53b 100644 (file)
 #include "MEM_guardedalloc.h"
 
 #include "BKE_main.h"
+#include "BKE_mask.h"
 #include "BKE_movieclip.h"
 #include "BKE_context.h"
 #include "BKE_tracking.h"
 
+#include "DNA_mask_types.h"
 #include "DNA_object_types.h"  /* SELECT */
 
 #include "BLI_utildefines.h"
@@ -127,6 +129,32 @@ int ED_space_clip_tracking_frame_poll(bContext *C)
        return FALSE;
 }
 
+int ED_space_clip_maskediting_poll(bContext *C)
+{
+       SpaceClip *sc = CTX_wm_space_clip(C);
+
+       if (sc && sc->clip) {
+               return ED_space_clip_show_maskedit(sc);
+       }
+
+       return FALSE;
+}
+
+int ED_space_clip_maskediting_mask_poll(bContext *C)
+{
+       if (ED_space_clip_maskediting_poll(C)) {
+               MovieClip *clip = CTX_data_edit_movieclip(C);
+
+               if (clip) {
+                       SpaceClip *sc= CTX_wm_space_clip(C);
+
+                       return sc->mask != NULL;
+               }
+       }
+
+       return FALSE;
+}
+
 /* ******** editing functions ******** */
 
 void ED_space_clip_set(bContext *C, bScreen *screen, SpaceClip *sc, MovieClip *clip)
@@ -170,6 +198,11 @@ MovieClip *ED_space_clip(SpaceClip *sc)
        return sc->clip;
 }
 
+Mask *ED_space_clip_mask(SpaceClip *sc)
+{
+       return sc->mask;
+}
+
 ImBuf *ED_space_clip_get_buffer(SpaceClip *sc)
 {
        if (sc->clip) {
@@ -214,6 +247,51 @@ void ED_space_clip_size(SpaceClip *sc, int *width, int *height)
        }
 }
 
+void ED_space_clip_mask_size(SpaceClip *sc, int *width, int *height)
+{
+       /* quite the same as ED_space_clip_size, but it also runs aspect correction on output resolution
+        * this is needed because mask should be rasterized with exactly the same resolution as
+        * currently displaying frame and it doesn't have access to aspect correction currently
+        * used for display. (sergey)
+        */
+
+       if (!sc->mask) {
+               *width = 0;
+               *height = 0;
+       } else {
+               float aspx, aspy;
+
+               ED_space_clip_size(sc, width, height);
+               ED_space_clip_aspect(sc, &aspx, &aspy);
+
+               *width *= aspx;
+               *height *= aspy;
+       }
+}
+
+void ED_space_clip_mask_aspect(SpaceClip *sc, float *aspx, float *aspy)
+{
+       int w, h;
+
+       ED_space_clip_aspect(sc, aspx, aspy);
+       ED_space_clip_size(sc, &w, &h);
+
+       /* now this is not accounted for! */
+#if 0
+       *aspx *= (float)w;
+       *aspy *= (float)h;
+#endif
+
+       if(*aspx < *aspy) {
+               *aspy= *aspy / *aspx;
+               *aspx= 1.0f;
+       }
+       else {
+               *aspx= *aspx / *aspy;
+               *aspy= 1.0f;
+       }
+}
+
 void ED_space_clip_zoom(SpaceClip *sc, ARegion *ar, float *zoomx, float *zoomy)
 {
        int width, height;
@@ -234,6 +312,33 @@ void ED_space_clip_aspect(SpaceClip *sc, float *aspx, float *aspy)
                *aspx = *aspy = 1.0f;
 }
 
+void ED_space_clip_aspect_dimension_aware(SpaceClip *sc, float *aspx, float *aspy)
+{
+       int w, h;
+
+       /* most of tools does not require aspect to be returned with dimensions correction
+        * due to they're invariant to this stuff, but some transformation tools like rotation
+        * should be aware of aspect correction caused by different resolution in different
+        * directions.
+        * mainly this is sued for transformation stuff
+        */
+
+       ED_space_clip_aspect(sc, aspx, aspy);
+       ED_space_clip_size(sc, &w, &h);
+
+       *aspx *= (float)w;
+       *aspy *= (float)h;
+
+       if(*aspx < *aspy) {
+               *aspy= *aspy / *aspx;
+               *aspx= 1.0f;
+       }
+       else {
+               *aspx= *aspx / *aspy;
+               *aspy= 1.0f;
+       }
+}
+
 void ED_clip_update_frame(const Main *mainp, int cfra)
 {
        wmWindowManager *wm;
@@ -562,6 +667,8 @@ void ED_space_clip_free_texture_buffer(SpaceClip *sc)
        }
 }
 
+/* ******** masking editing related functions ******** */
+
 int ED_space_clip_show_trackedit(SpaceClip *sc)
 {
        if (sc) {
@@ -570,3 +677,23 @@ int ED_space_clip_show_trackedit(SpaceClip *sc)
 
        return FALSE;
 }
+
+int ED_space_clip_show_maskedit(SpaceClip *sc)
+{
+       if (sc) {
+               return sc->mode == SC_MODE_MASKEDITING;
+       }
+
+       return FALSE;
+}
+
+void ED_space_clip_set_mask(bContext *C, SpaceClip *sc, Mask *mask)
+{
+       sc->mask = mask;
+
+       if(sc->mask && sc->mask->id.us==0)
+               sc->clip->id.us = 1;
+
+       if(C)
+               WM_event_add_notifier(C, NC_MASK|NA_SELECTED, mask);
+}
index a6fda200ff4e5de0b7f6be067f9c0021ab7dd1c1..5e04d5c99cd3a9aeae766c4d423ae508de4a1556 100644 (file)
@@ -33,7 +33,9 @@
 #include <stdio.h>
 
 #include "DNA_scene_types.h"
+#include "DNA_mask_types.h"
 #include "DNA_movieclip_types.h"
+#include "DNA_view3d_types.h"  /* for pivot point */
 
 #include "MEM_guardedalloc.h"
 
@@ -49,6 +51,8 @@
 
 #include "IMB_imbuf_types.h"
 
+#include "ED_mask.h"
+#include "ED_space_api.h"
 #include "ED_screen.h"
 #include "ED_clip.h"
 #include "ED_transform.h"
@@ -237,6 +241,7 @@ static SpaceLink *clip_new(const bContext *C)
        sc->zoom = 1.0f;
        sc->path_length = 20;
        sc->scopes.track_preview_height = 120;
+       sc->around = V3D_LOCAL;
 
        /* header */
        ar = MEM_callocN(sizeof(ARegion), "header for clip");
@@ -361,6 +366,24 @@ static void clip_listener(ScrArea *sa, wmNotifier *wmn)
                                        break;
                        }
                        break;
+               case NC_MASK:
+                       switch(wmn->data) {
+                               case ND_SELECT:
+                               case ND_DATA:
+                               case ND_DRAW:
+                                       ED_area_tag_redraw(sa);
+                                       break;
+                       }
+                       switch(wmn->action) {
+                               case NA_SELECTED:
+                                       clip_scopes_tag_refresh(sa);
+                                       ED_area_tag_redraw(sa);
+                                       break;
+                               case NA_EDITED:
+                                       ED_area_tag_redraw(sa);
+                                       break;
+                       }
+                       break;
                case NC_GEOM:
                        switch (wmn->data) {
                                case ND_SELECT:
@@ -532,7 +555,7 @@ static void clip_keymap(struct wmKeyConfig *keyconf)
        /* ******** Hotkeys avalaible for main region only ******** */
 
        keymap = WM_keymap_find(keyconf, "Clip Editor", SPACE_CLIP, 0);
-
+//     keymap->poll = ED_space_clip_tracking_poll;
        /* ** View/navigation ** */
 
        WM_keymap_add_item(keymap, "CLIP_OT_view_pan", MIDDLEMOUSE, KM_PRESS, 0, 0);
@@ -715,7 +738,7 @@ static void clip_keymap(struct wmKeyConfig *keyconf)
        RNA_boolean_set(kmi->ptr, "extend", TRUE);      /* toggle */
 }
 
-const char *clip_context_dir[] = {"edit_movieclip", NULL};
+const char *clip_context_dir[] = {"edit_movieclip", "edit_mask", NULL};
 
 static int clip_context(const bContext *C, const char *member, bContextDataResult *result)
 {
@@ -729,7 +752,11 @@ static int clip_context(const bContext *C, const char *member, bContextDataResul
        else if (CTX_data_equals(member, "edit_movieclip")) {
                if (sc->clip)
                        CTX_data_id_pointer_set(result, &sc->clip->id);
-
+               return TRUE;
+       }
+       else if (CTX_data_equals(member, "edit_mask")) {
+               if (sc->mask)
+                       CTX_data_id_pointer_set(result, &sc->mask->id);
                return TRUE;
        }
 
@@ -1020,6 +1047,9 @@ static void clip_main_area_init(wmWindowManager *wm, ARegion *ar)
        UI_view2d_region_reinit(&ar->v2d, V2D_COMMONVIEW_STANDARD, ar->winx, ar->winy);
 
        /* own keymap */
+       keymap= WM_keymap_find(wm->defaultconf, "Mask Editor", 0, 0);
+       WM_event_add_keymap_handler_bb(&ar->handlers, keymap, &ar->v2d.mask, &ar->winrct);
+
        keymap = WM_keymap_find(wm->defaultconf, "Clip", SPACE_CLIP, 0);
        WM_event_add_keymap_handler_bb(&ar->handlers, keymap, &ar->v2d.mask, &ar->winrct);
 
@@ -1067,6 +1097,49 @@ static void clip_main_area_draw(const bContext *C, ARegion *ar)
        /* Grease Pencil */
        clip_draw_grease_pencil((bContext *)C, 1);
 
+       if(sc->mode == SC_MODE_MASKEDITING) {
+               int x, y;
+               int width, height;
+               float zoomx, zoomy, aspx, aspy;
+
+               /* 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);
+
+               ED_space_clip_size(sc, &width, &height);
+               ED_space_clip_zoom(sc, ar, &zoomx, &zoomy);
+               ED_space_clip_aspect(sc, &aspx, &aspy);
+
+               /* 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);
+               glMultMatrixf(sc->stabmat);
+
+               ED_mask_draw((bContext *)C, sc->mask_draw_flag, sc->mask_draw_type);
+
+               ED_region_draw_cb_draw(C, ar, REGION_DRAW_POST_VIEW);
+
+               glPopMatrix();
+       }
+
        /* reset view matrix */
        UI_view2d_view_restore(C);
 
@@ -1241,6 +1314,26 @@ static void clip_header_area_draw(const bContext *C, ARegion *ar)
        ED_region_header(C, ar);
 }
 
+static void clip_header_area_listener(ARegion *ar, wmNotifier *wmn)
+{
+       /* context changes */
+       switch (wmn->category) {
+               case NC_SCENE:
+                       switch (wmn->data) {
+                               /* for proportional editmode only */
+                               case ND_TOOLSETTINGS:
+                                       /* TODO - should do this when in mask mode only but no datas available */
+                                       // if(sc->mode == SC_MODE_MASKEDITING)
+                                       {
+                                               ED_region_tag_redraw(ar);
+                                       }
+                                       break;
+                       }
+                       break;
+       }
+}
+
+
 /****************** tools region ******************/
 
 /* add handlers, stuff you only do once or on area/region changes */
@@ -1402,6 +1495,7 @@ void ED_spacetype_clip(void)
 
        art->init = clip_header_area_init;
        art->draw = clip_header_area_draw;
+       art->listener = clip_header_area_listener;
 
        BLI_addhead(&st->regiontypes, art);
 
index 73ca90976100805c6ceea3929e54653e7af52b5e..5a8bc5da324cbeffc3afafec8389c61606e48f3d 100644 (file)
@@ -2400,6 +2400,11 @@ static void node_composit_buts_viewer_but(uiLayout *layout, bContext *UNUSED(C),
        }
 }
 
+static void node_composit_buts_mask(uiLayout *layout, bContext *C, PointerRNA *ptr)
+{
+       uiTemplateID(layout, C, ptr, "mask", NULL, NULL, NULL);
+}
+
 /* only once called */
 static void node_composit_set_butfunc(bNodeType *ntype)
 {
@@ -2589,7 +2594,9 @@ static void node_composit_set_butfunc(bNodeType *ntype)
                        ntype->uifuncbut = node_composit_buts_viewer_but;
                        ntype->uibackdropfunc = node_composit_backdrop_viewer;
                        break;
-
+               case CMP_NODE_MASK:
+                       ntype->uifunc= node_composit_buts_mask;
+                       break;
                default:
                        ntype->uifunc = NULL;
        }
index 520a9f1cd226079d78a75b129ec8dd5181a9d8fd..66919935d48a3da3af1a02a3b81edf4a1db47006 100644 (file)
@@ -245,6 +245,13 @@ static void node_area_listener(ScrArea *sa, wmNotifier *wmn)
                                        break;
                        }
                        break;
+               case NC_MASK:
+                       if (wmn->action == NA_EDITED) {
+                               if (type==NTREE_COMPOSIT) {
+                                       ED_area_tag_refresh(sa);
+                               }
+                       }
+                       break;
 
                case NC_IMAGE:
                        if (wmn->action == NA_EDITED) {
index e955dae017894f681a08dd53b399d9197d338da0..157fe1aa710cf256d3be67a7cbc2091150e4b8aa 100644 (file)
@@ -49,6 +49,7 @@
 #include "DNA_constraint_types.h"
 #include "DNA_mesh_types.h"
 #include "DNA_meshdata_types.h"
+#include "DNA_mask_types.h"
 #include "DNA_movieclip_types.h"
 #include "DNA_scene_types.h"           /* PET modes                    */
 
@@ -162,13 +163,35 @@ void convertViewVec(TransInfo *t, float r_vec[3], int dx, int dy)
        else if (t->spacetype==SPACE_CLIP) {
                View2D *v2d = t->view;
                float divx, divy;
+               float mulx, muly;
+               float aspx = 1.0f, aspy = 1.0f;
 
                divx = v2d->mask.xmax-v2d->mask.xmin;
                divy = v2d->mask.ymax-v2d->mask.ymin;
 
-               r_vec[0] = (v2d->cur.xmax-v2d->cur.xmin)*(dx)/divx;
-               r_vec[1] = (v2d->cur.ymax-v2d->cur.ymin)*(dy)/divy;
+               mulx = (v2d->cur.xmax-v2d->cur.xmin);
+               muly = (v2d->cur.ymax-v2d->cur.ymin);
+
+               if (t->options & CTX_MASK) {
+                       /* clamp w/h, mask only */
+                       divx = divy = maxf(divx, divy);
+                       mulx = muly = minf(mulx, muly);
+               }
+
+               r_vec[0] = mulx * (dx) / divx;
+               r_vec[1] = muly * (dy) / divy;
                r_vec[2] = 0.0f;
+
+               if (t->options & CTX_MOVIECLIP) {
+                       ED_space_clip_aspect_dimension_aware(t->sa->spacedata.first, &aspx, &aspy);
+               }
+               else if (t->options & CTX_MASK) {
+                       /* TODO - NOT WORKING, this isnt so bad since its only display aspect */
+                       ED_space_clip_mask_aspect(t->sa->spacedata.first, &aspx, &aspy);
+               }
+
+               r_vec[0] *= aspx;
+               r_vec[1] *= aspy;
        }
        else {
                printf("%s: called in an invalid context\n", __func__);
@@ -226,9 +249,18 @@ void projectIntView(TransInfo *t, const float vec[3], int adr[2])
        }
        else if (t->spacetype==SPACE_CLIP) {
                float v[2];
+               float aspx = 1.0f, aspy = 1.0f;
 
                copy_v2_v2(v, vec);
 
+               if (t->options & CTX_MOVIECLIP)
+                       ED_space_clip_aspect_dimension_aware(t->sa->spacedata.first, &aspx, &aspy);
+               else if (t->options & CTX_MASK)
+                       ED_space_clip_mask_aspect(t->sa->spacedata.first, &aspx, &aspy);
+
+               v[0] /= aspx;
+               v[1] /= aspy;
+
                UI_view2d_to_region_no_clip(t->view, v[0], v[1], adr, adr+1);
        }
 }
@@ -279,16 +311,23 @@ void applyAspectRatio(TransInfo *t, float vec[2])
                vec[1] /= aspy;
        }
        else if ((t->spacetype==SPACE_CLIP) && (t->mode==TFM_TRANSLATION)) {
-               if (t->options & CTX_MOVIECLIP) {
+               if (t->options & (CTX_MOVIECLIP | CTX_MASK)) {
                        SpaceClip *sc = t->sa->spacedata.first;
                        float aspx, aspy;
-                       int width, height;
 
-                       ED_space_clip_size(sc, &width, &height);
-                       ED_space_clip_aspect(sc, &aspx, &aspy);
 
-                       vec[0] *= width / aspx;
-                       vec[1] *= height / aspy;
+                       if (t->options & CTX_MOVIECLIP) {
+                               ED_space_clip_aspect_dimension_aware(sc, &aspx, &aspy);
+
+                               vec[0] /= aspx;
+                               vec[1] /= aspy;
+                       }
+                       else if (t->options & CTX_MASK) {
+                               ED_space_clip_mask_aspect(sc, &aspx, &aspy);
+
+                               vec[0] /= aspx;
+                               vec[1] /= aspy;
+                       }
                }
        }
 }
@@ -312,16 +351,19 @@ void removeAspectRatio(TransInfo *t, float vec[2])
                vec[1] *= aspy;
        }
        else if ((t->spacetype==SPACE_CLIP) && (t->mode==TFM_TRANSLATION)) {
-               if (t->options & CTX_MOVIECLIP) {
+               if (t->options & (CTX_MOVIECLIP | CTX_MASK)) {
                        SpaceClip *sc = t->sa->spacedata.first;
-                       float aspx, aspy;
-                       int width, height;
+                       float aspx = 1.0f, aspy = 1.0f;
 
-                       ED_space_clip_size(sc, &width, &height);
-                       ED_space_clip_aspect(sc, &aspx, &aspy);
+                       if (t->options & CTX_MOVIECLIP) {
+                               ED_space_clip_aspect_dimension_aware(sc, &aspx, &aspy);
+                       }
+                       else if (t->options & CTX_MASK) {
+                               ED_space_clip_mask_aspect(sc, &aspx, &aspy);
+                       }
 
-                       vec[0] *= aspx / width;
-                       vec[1] *= aspy / height;
+                       vec[0] *= aspx;
+                       vec[1] *= aspy;
                }
        }
 }
@@ -367,12 +409,20 @@ static void viewRedrawForce(const bContext *C, TransInfo *t)
        }
        else if (t->spacetype==SPACE_CLIP) {
                SpaceClip *sc = (SpaceClip*)t->sa->spacedata.first;
-               MovieClip *clip = ED_space_clip(sc);
 
-               /* objects could be parented to tracking data, so send this for viewport refresh */
-               WM_event_add_notifier(C, NC_OBJECT|ND_TRANSFORM, NULL);
+               if (ED_space_clip_show_trackedit(sc)) {
+                       MovieClip *clip = ED_space_clip(sc);
+
+                       /* objects could be parented to tracking data, so send this for viewport refresh */
+                       WM_event_add_notifier(C, NC_OBJECT|ND_TRANSFORM, NULL);
 
-               WM_event_add_notifier(C, NC_MOVIECLIP|NA_EDITED, clip);
+                       WM_event_add_notifier(C, NC_MOVIECLIP|NA_EDITED, clip);
+               }
+               else if (ED_space_clip_show_maskedit(sc)) {
+                       Mask *mask = ED_space_clip_mask(sc);
+
+                       WM_event_add_notifier(C, NC_MASK|NA_EDITED, mask);
+               }
        }
 }
 
@@ -728,7 +778,7 @@ int transformEvent(TransInfo *t, wmEvent *event)
                                        t->redraw |= TREDRAW_HARD;
                                }
                                else if (t->mode == TFM_TRANSLATION) {
-                                       if (t->options & CTX_MOVIECLIP) {
+                                       if (t->options & (CTX_MOVIECLIP | CTX_MASK)) {
                                                restoreTransObjects(t);
 
                                                t->flag ^= T_ALT_TRANSFORM;
@@ -738,7 +788,7 @@ int transformEvent(TransInfo *t, wmEvent *event)
                                break;
                        case TFM_MODAL_ROTATE:
                                /* only switch when... */
-                               if (!(t->options & CTX_TEXTURE) && !(t->options & CTX_MOVIECLIP)) {
+                               if (!(t->options & CTX_TEXTURE) && !(t->options & (CTX_MOVIECLIP | CTX_MASK))) {
                                        if ( ELEM4(t->mode, TFM_ROTATION, TFM_RESIZE, TFM_TRACKBALL, TFM_TRANSLATION) ) {
                                                
                                                resetTransRestrictions(t);
@@ -997,7 +1047,7 @@ int transformEvent(TransInfo *t, wmEvent *event)
                        break;
                case RKEY:
                        /* only switch when... */
-                       if (!(t->options & CTX_TEXTURE) && !(t->options & CTX_MOVIECLIP)) {
+                       if (!(t->options & CTX_TEXTURE)) {
                                if ( ELEM4(t->mode, TFM_ROTATION, TFM_RESIZE, TFM_TRACKBALL, TFM_TRANSLATION) ) {
 
                                        resetTransRestrictions(t);
@@ -1459,6 +1509,8 @@ void saveTransform(bContext *C, TransInfo *t, wmOperator *op)
                {
                        if (t->obedit)
                                ts->proportional = proportional;
+                       else if (t->options & CTX_MASK)
+                               ts->proportional_mask = (proportional != PROP_EDIT_OFF);
                        else
                                ts->proportional_objects = (proportional != PROP_EDIT_OFF);
                }
index 6051fd2577bf226354dc3c69041f54c0ecbd9bbc..59688f1436e0744cc902e0394ea57b7bcb76f718 100644 (file)
@@ -561,6 +561,7 @@ int clipUVTransform(TransInfo *t, float *vec, int resize);
 void flushTransNodes(TransInfo *t);
 void flushTransSeq(TransInfo *t);
 void flushTransTracking(TransInfo *t);
+void flushTransMasking(TransInfo *t);
 
 /*********************** exported from transform_manipulator.c ********** */
 int gimbal_axis(struct Object *ob, float gmat[][3]); /* return 0 when no gimbal for selection */
index a069194d8681673dc3e4a8fbc8c32200bd5261ca..9c6d7e49c08de6d2d28c675a32e4bf0c79a8e010 100644 (file)
@@ -53,6 +53,7 @@
 #include "DNA_meshdata_types.h"
 #include "DNA_gpencil_types.h"
 #include "DNA_movieclip_types.h"
+#include "DNA_mask_types.h"
 
 #include "MEM_guardedalloc.h"
 
@@ -87,6 +88,7 @@
 #include "BKE_sequencer.h"
 #include "BKE_tessmesh.h"
 #include "BKE_tracking.h"
+#include "BKE_mask.h"
 
 
 #include "ED_anim_api.h"
 #include "ED_types.h"
 #include "ED_uvedit.h"
 #include "ED_clip.h"
+#include "ED_mask.h"
 #include "ED_util.h"  /* for crazyspace correction */
 
 #include "WM_api.h"            /* for WM_event_add_notifier to deal with stabilization nodes */
@@ -4897,6 +4900,24 @@ void special_aftertrans_update(bContext *C, TransInfo *t)
                                WM_event_add_notifier(C, NC_SCENE|ND_NODES, NULL);
                        }
                }
+               else if (t->options & CTX_MASK) {
+                       SpaceClip *sc = t->sa->spacedata.first;
+                       Mask *mask = ED_space_clip_mask(sc);
+
+                       if (t->scene->nodetree) {
+                               /* tracks can be used for stabilization nodes,
+                                * flush update for such nodes */
+                               nodeUpdateID(t->scene->nodetree, &mask->id);
+                               WM_event_add_notifier(C, NC_SCENE|ND_NODES, NULL);
+                       }
+
+                       /* TODO - dont key all masks... */
+                       if (IS_AUTOKEY_ON(t->scene)) {
+                               Scene *scene = t->scene;
+
+                               ED_mask_layer_shape_auto_key_all(mask, CFRA);
+                       }
+               }
        }
        else if (t->spacetype == SPACE_ACTION) {
                SpaceAction *saction= (SpaceAction *)t->sa->spacedata.first;
@@ -5823,6 +5844,206 @@ void flushTransTracking(TransInfo *t)
        }
 }
 
+/* * masking * */
+
+typedef struct TransDataMasking{
+       int   is_handle;
+
+       float handle[2], orig_handle[2];
+       float vec[3][3];
+       MaskSplinePoint *point;
+} TransDataMasking;
+
+static void MaskPointToTransData(SpaceClip *sc, MaskSplinePoint *point,
+                                 TransData *td, TransData2D *td2d, TransDataMasking *tdm, int propmode)
+{
+       BezTriple *bezt = &point->bezt;
+       float aspx, aspy;
+       short is_sel_point = MASKPOINT_ISSEL_KNOT(point);
+       short is_sel_any = MASKPOINT_ISSEL_ANY(point);
+
+       tdm->point = point;
+       copy_m3_m3(tdm->vec, bezt->vec);
+
+       ED_space_clip_mask_aspect(sc, &aspx, &aspy);
+
+       if (propmode || is_sel_point) {
+               int i;
+               for (i = 0; i < 3; i++) {
+                       /* CV coords are scaled by aspects. this is needed for rotations and
+                        * proportional editing to be consistent with the stretched CV coords
+                        * that are displayed. this also means that for display and numinput,
+                        * and when the the CV coords are flushed, these are converted each time */
+                       td2d->loc[0] = bezt->vec[i][0]*aspx;
+                       td2d->loc[1] = bezt->vec[i][1]*aspy;
+                       td2d->loc[2] = 0.0f;
+                       td2d->loc2d = bezt->vec[i];
+
+                       td->flag = 0;
+                       td->loc = td2d->loc;
+                       copy_v3_v3(td->center, td->loc);
+                       copy_v3_v3(td->iloc, td->loc);
+
+                       memset(td->axismtx, 0, sizeof(td->axismtx));
+                       td->axismtx[2][2] = 1.0f;
+
+                       td->ext= NULL;
+                       td->val= NULL;
+
+                       if (is_sel_any) {
+                               td->flag |= TD_SELECTED;
+                       }
+                       td->dist= 0.0;
+
+                       unit_m3(td->mtx);
+                       unit_m3(td->smtx);
+
+                       td++;
+                       td2d++;
+               }
+       }
+       else {
+               tdm->is_handle = TRUE;
+
+               BKE_mask_point_handle(point, tdm->handle);
+
+               copy_v2_v2(tdm->orig_handle, tdm->handle);
+
+               td2d->loc[0] = tdm->handle[0]*aspx;
+               td2d->loc[1] = tdm->handle[1]*aspy;
+               td2d->loc[2] = 0.0f;
+               td2d->loc2d = tdm->handle;
+
+               td->flag = 0;
+               td->loc = td2d->loc;
+               copy_v3_v3(td->center, td->loc);
+               copy_v3_v3(td->iloc, td->loc);
+
+               memset(td->axismtx, 0, sizeof(td->axismtx));
+               td->axismtx[2][2] = 1.0f;
+
+               td->ext= NULL;
+               td->val= NULL;
+
+               if (is_sel_any) {
+                       td->flag |= TD_SELECTED;
+               }
+
+               td->dist= 0.0;
+
+               unit_m3(td->mtx);
+               unit_m3(td->smtx);
+
+               td++;
+               td2d++;
+       }
+}
+
+static void createTransMaskingData(bContext *C, TransInfo *t)
+{
+       SpaceClip *sc = CTX_wm_space_clip(C);
+       Mask *mask = CTX_data_edit_mask(C);
+       MaskLayer *masklay;
+       TransData *td = NULL;
+       TransData2D *td2d = NULL;
+       TransDataMasking *tdm = NULL;
+       int count = 0, countsel = 0;
+       int propmode = t->flag & T_PROP_EDIT;
+
+       /* count */
+       for (masklay = mask->masklayers.first; masklay; masklay = masklay->next) {
+               MaskSpline *spline = masklay->splines.first;
+
+               if (masklay->restrictflag & (MASK_RESTRICT_VIEW | MASK_RESTRICT_SELECT)) {
+                       continue;
+               }
+
+               for (spline = masklay->splines.first; spline; spline = spline->next) {
+                       int i;
+
+                       for (i = 0; i < spline->tot_point; i++) {
+                               MaskSplinePoint *point = &spline->points[i];
+
+                               if (MASKPOINT_ISSEL_ANY(point)) {
+                                       if (MASKPOINT_ISSEL_KNOT(point))
+                                               countsel += 3;
+                                       else
+                                               countsel += 1;
+                               }
+
+                               if (propmode)
+                                       count += 3;
+                       }
+               }
+       }
+
+       /* note: in prop mode we need at least 1 selected */
+       if (countsel == 0) return;
+
+       t->total = (propmode) ? count: countsel;
+       td = t->data = MEM_callocN(t->total*sizeof(TransData), "TransObData(Mask Editing)");
+       /* for each 2d uv coord a 3d vector is allocated, so that they can be
+        * treated just as if they were 3d verts */
+       td2d = t->data2d = MEM_callocN(t->total*sizeof(TransData2D), "TransObData2D(Mask Editing)");
+       tdm = t->customData = MEM_callocN(t->total*sizeof(TransDataMasking), "TransDataMasking(Mask Editing)");
+
+       t->flag |= T_FREE_CUSTOMDATA;
+
+       /* create data */
+       for (masklay = mask->masklayers.first; masklay; masklay = masklay->next) {
+               MaskSpline *spline = masklay->splines.first;
+
+               if (masklay->restrictflag & (MASK_RESTRICT_VIEW | MASK_RESTRICT_SELECT)) {
+                       continue;
+               }
+
+               for (spline = masklay->splines.first; spline; spline = spline->next) {
+                       int i;
+
+                       for (i = 0; i < spline->tot_point; i++) {
+                               MaskSplinePoint *point = &spline->points[i];
+
+                               if (propmode || MASKPOINT_ISSEL_ANY(point)) {
+                                       MaskPointToTransData(sc, point, td, td2d, tdm, propmode);
+
+                                       if (propmode || MASKPOINT_ISSEL_KNOT(point)) {
+                                               td += 3;
+                                               td2d += 3;
+                                               tdm += 3;
+                                       }
+                                       else {
+                                               td++;
+                                               td2d++;
+                                               tdm++;
+                                       }
+                               }
+                       }
+               }
+       }
+}
+
+void flushTransMasking(TransInfo *t)
+{
+       SpaceClip *sc = t->sa->spacedata.first;
+       TransData2D *td;
+       TransDataMasking *tdm;
+       int a;
+       float aspx, aspy, invx, invy;
+
+       ED_space_clip_mask_aspect(sc, &aspx, &aspy);
+       invx = 1.0f/aspx;
+       invy = 1.0f/aspy;
+
+       /* flush to 2d vector from internally used 3d vector */
+       for(a=0, td = t->data2d, tdm = t->customData; a<t->total; a++, td++, tdm++) {
+               td->loc2d[0]= td->loc[0]*invx;
+               td->loc2d[1]= td->loc[1]*invy;
+
+               if (tdm->is_handle)
+                       BKE_mask_point_set_handle(tdm->point, td->loc2d, t->flag & T_ALT_TRANSFORM, tdm->orig_handle, tdm->vec);
+       }
+}
+
 void createTransData(bContext *C, TransInfo *t)
 {
        Scene *scene = t->scene;
@@ -5892,6 +6113,15 @@ void createTransData(bContext *C, TransInfo *t)
                t->flag |= T_POINTS|T_2D_EDIT;
                if (t->options & CTX_MOVIECLIP)
                        createTransTrackingData(C, t);
+               else if (t->options & CTX_MASK) {
+                       createTransMaskingData(C, t);
+
+                       if (t->data && (t->flag & T_PROP_EDIT)) {
+                               sort_trans_data(t);     // makes selected become first in array
+                               set_prop_dist(t, TRUE);
+                               sort_trans_data_dist(t);
+                       }
+               }
        }
        else if (t->obedit) {
                t->ext = NULL;
index 0f742458ed3d0f3916b2e8fb2e99fc1f154d3cca..3195fb0299d3d525e766c6a92f51d268c5627f53 100644 (file)
@@ -49,6 +49,7 @@
 #include "DNA_view3d_types.h"
 #include "DNA_modifier_types.h"
 #include "DNA_movieclip_types.h"
+#include "DNA_mask_types.h"
 
 #include "BLI_math.h"
 #include "BLI_blenlib.h"
@@ -638,33 +639,42 @@ static void recalcData_spaceclip(TransInfo *t)
 {
        SpaceClip *sc = t->sa->spacedata.first;
 
-       MovieClip *clip = ED_space_clip(sc);
-       ListBase *tracksbase = BKE_tracking_get_tracks(&clip->tracking);
-       MovieTrackingTrack *track;
-
-       flushTransTracking(t);
-
-       track = tracksbase->first;
-       while (track) {
-               if (TRACK_VIEW_SELECTED(sc, track) && (track->flag & TRACK_LOCKED)==0) {
-                       if (t->mode == TFM_TRANSLATION) {
-                               if (TRACK_AREA_SELECTED(track, TRACK_AREA_PAT))
-                                       BKE_tracking_clamp_track(track, CLAMP_PAT_POS);
-                               if (TRACK_AREA_SELECTED(track, TRACK_AREA_SEARCH))
-                                       BKE_tracking_clamp_track(track, CLAMP_SEARCH_POS);
-                       }
-                       else if (t->mode == TFM_RESIZE) {
-                               if (TRACK_AREA_SELECTED(track, TRACK_AREA_PAT))
-                                       BKE_tracking_clamp_track(track, CLAMP_PAT_DIM);
-                               if (TRACK_AREA_SELECTED(track, TRACK_AREA_SEARCH))
-                                       BKE_tracking_clamp_track(track, CLAMP_SEARCH_DIM);
+       if (ED_space_clip_show_trackedit(sc)) {
+               MovieClip *clip = ED_space_clip(sc);
+               ListBase *tracksbase = BKE_tracking_get_tracks(&clip->tracking);
+               MovieTrackingTrack *track;
+
+               flushTransTracking(t);
+
+               track = tracksbase->first;
+               while (track) {
+                       if (TRACK_VIEW_SELECTED(sc, track) && (track->flag & TRACK_LOCKED)==0) {
+                               if (t->mode == TFM_TRANSLATION) {
+                                       if (TRACK_AREA_SELECTED(track, TRACK_AREA_PAT))
+                                               BKE_tracking_clamp_track(track, CLAMP_PAT_POS);
+                                       if (TRACK_AREA_SELECTED(track, TRACK_AREA_SEARCH))
+                                               BKE_tracking_clamp_track(track, CLAMP_SEARCH_POS);
+                               }
+                               else if (t->mode == TFM_RESIZE) {
+                                       if (TRACK_AREA_SELECTED(track, TRACK_AREA_PAT))
+                                               BKE_tracking_clamp_track(track, CLAMP_PAT_DIM);
+                                       if (TRACK_AREA_SELECTED(track, TRACK_AREA_SEARCH))
+                                               BKE_tracking_clamp_track(track, CLAMP_SEARCH_DIM);
+                               }
                        }
+
+                       track = track->next;
                }
 
-               track = track->next;
+               DAG_id_tag_update(&clip->id, 0);
        }
+       else if (ED_space_clip_show_maskedit(sc)) {
+               Mask *mask = ED_space_clip_mask(sc);
 
-       DAG_id_tag_update(&clip->id, 0);
+               flushTransMasking(t);
+
+               DAG_id_tag_update(&mask->id, 0);
+       }
 }
 
 /* helper for recalcData() - for 3d-view transforms */
@@ -1109,9 +1119,12 @@ int initTransInfo(bContext *C, TransInfo *t, wmOperator *op, wmEvent *event)
        else if (t->spacetype==SPACE_CLIP) {
                SpaceClip *sclip = sa->spacedata.first;
                t->view = &ar->v2d;
+               t->around = sclip->around;
 
                if (ED_space_clip_show_trackedit(sclip))
                        t->options |= CTX_MOVIECLIP;
+               else if (ED_space_clip_show_maskedit(sclip))
+                       t->options |= CTX_MASK;
        }
        else {
                if (ar) {
@@ -1174,6 +1187,15 @@ int initTransInfo(bContext *C, TransInfo *t, wmOperator *op, wmEvent *event)
                                                        t->flag |= T_PROP_CONNECTED;
                                                }
                                        }
+                                       else if (t->options & CTX_MASK) {
+                                               if (ts->proportional_mask) {
+                                                       t->flag |= T_PROP_EDIT;
+
+                                                       if (ts->proportional == PROP_EDIT_CONNECTED) {
+                                                               t->flag |= T_PROP_CONNECTED;
+                                                       }
+                                               }
+                                       }
                                        else if (t->obedit == NULL && ts->proportional_objects) {
                                                t->flag |= T_PROP_EDIT;
                                        }
index 777fcc2af0cfe965cbb0d4ab1ed5567fb0b50385..b6fc4f58bd7c45a915ee9045d5b98d1cfeec46eb 100644 (file)
@@ -206,6 +206,7 @@ typedef struct PreviewImage {
 #define ID_GD          MAKE_ID2('G', 'D') /* GreasePencil */
 #define ID_WM          MAKE_ID2('W', 'M') /* WindowManager */
 #define ID_MC          MAKE_ID2('M', 'C') /* MovieClip */
+#define ID_MSK         MAKE_ID2('M', 'S') /* Mask */
 
        /* NOTE! Fake IDs, needed for g.sipo->blocktype or outliner */
 #define ID_SEQ         MAKE_ID2('S', 'Q')
index 198b6a9bf8093bae8ec63bdcbdb8d897e1cebd32..75b0b18879ddf59c3121b618fa8857b3cbb51c78 100644 (file)
@@ -999,7 +999,8 @@ typedef struct ToolSettings {
        short snap_flag, snap_target;
        short proportional, prop_mode;
        char proportional_objects; /* proportional edit, object mode */
-       char pad[5];
+       char proportional_mask; /* proportional edit, object mode */
+       char pad[4];
 
        char auto_normalize; /*auto normalizing mode in wpaint*/
        char multipaint; /* paint multiple bones in wpaint */
index 8f3062655b79e15ab94612e3fe65254b25c28258..e83f1b4495adcb4311375bab72182ec21eb11d59 100644 (file)
@@ -67,6 +67,7 @@ struct wmOperator;
 struct wmTimer;
 struct MovieClip;
 struct MovieClipScopes;
+struct Mask;
 
 
 /* SpaceLink (Base) ==================================== */
@@ -1006,7 +1007,14 @@ typedef struct SpaceClip {
        short dope_sort;                /* sort order in dopesheet view */
        short dope_flag;                /* dopsheet view flags */
 
-       int pad3;
+       int around;                     /* pivot point for transforms */
+
+       /* **** mask editing **** */
+       struct Mask *mask;
+       /* draw options */
+       char mask_draw_flag;
+       char mask_draw_type;
+       char pad3[6];
 } SpaceClip;
 
 /* SpaceClip->flag */
@@ -1037,6 +1045,7 @@ typedef enum eSpaceClip_Mode {
        SC_MODE_TRACKING = 0,
        SC_MODE_RECONSTRUCTION,
        SC_MODE_DISTORTION,
+       SC_MODE_MASKEDITING,
 } eSpaceClip_Mode;
 
 /* SpaceClip->view */
index 0191847706abd26cfd862c6f93371d4f942bf914..b0f8f02ae9fa5a174d7b0cbdc7333d20a1f5ccb8 100644 (file)
@@ -132,6 +132,7 @@ static const char *includefiles[] = {
        "DNA_movieclip_types.h",
        "DNA_tracking_types.h",
        "DNA_dynamicpaint_types.h",
+       "DNA_mask_types.h",
 
        // empty string to indicate end of includefiles
        ""
@@ -1241,4 +1242,5 @@ int main(int argc, char **argv)
 #include "DNA_movieclip_types.h"
 #include "DNA_tracking_types.h"
 #include "DNA_dynamicpaint_types.h"
+#include "DNA_mask_types.h"
 /* end of list */
index 821fcfb90e679aa1c44de142ea64a50fed60cb12..c9914a35a1431a05e06a352465b4e525e85a1f03 100644 (file)
@@ -145,6 +145,7 @@ extern StructRNA RNA_CompositorNodeLumaMatte;
 extern StructRNA RNA_CompositorNodeMapUV;
 extern StructRNA RNA_CompositorNodeMapValue;
 extern StructRNA RNA_CompositorNodeMath;
+extern StructRNA RNA_CompositorNodeMask;
 extern StructRNA RNA_CompositorNodeMixRGB;
 extern StructRNA RNA_CompositorNodeNormal;
 extern StructRNA RNA_CompositorNodeNormalize;
@@ -304,6 +305,8 @@ extern StructRNA RNA_MaterialStrand;
 extern StructRNA RNA_MaterialSubsurfaceScattering;
 extern StructRNA RNA_MaterialTextureSlot;
 extern StructRNA RNA_MaterialVolume;
+extern StructRNA RNA_Mask;
+extern StructRNA RNA_MaskLayer;
 extern StructRNA RNA_Menu;
 extern StructRNA RNA_Mesh;
 extern StructRNA RNA_MeshColor;
index 0c136a9444a5fd0fbee6da4840c491a7c6f4c06d..e7f9977d04063ff0423c9de43f57d18f4ea369d9 100644 (file)
@@ -55,6 +55,7 @@ set(DEFSRC
        rna_lamp.c
        rna_lattice.c
        rna_main.c
+       rna_mask.c
        rna_material.c
        rna_mesh.c
        rna_meta.c
index 9661a60f7798aa4f66e6110697a165a2db637191..3741d53c3783e2e53389cae9ea70fd92a3bf8265 100644 (file)
@@ -2681,6 +2681,7 @@ static RNAProcessItem PROCESS_ITEMS[] = {
        {"rna_world.c", NULL, RNA_def_world},
        {"rna_movieclip.c", NULL, RNA_def_movieclip},
        {"rna_tracking.c", NULL, RNA_def_tracking},
+       {"rna_mask.c", NULL, RNA_def_mask},
        {NULL, NULL}
 };
 
index 6a54c04b44daaae172b3bb3b8ecf75813f283ff0..7f851c939d295dd20d2c7ac9045db2eb7b77e842 100644 (file)
@@ -147,6 +147,7 @@ short RNA_type_to_ID_code(StructRNA *type)
        if (RNA_struct_is_a(type, &RNA_World)) return ID_WO;
        if (RNA_struct_is_a(type, &RNA_WindowManager)) return ID_WM;
        if (RNA_struct_is_a(type, &RNA_MovieClip)) return ID_MC;
+       if (RNA_struct_is_a(type, &RNA_Mask)) return ID_MSK;
 
        return 0;
 }
@@ -182,6 +183,7 @@ StructRNA *ID_code_to_RNA_type(short idcode)
                case ID_WO: return &RNA_World;
                case ID_WM: return &RNA_WindowManager;
                case ID_MC: return &RNA_MovieClip;
+               case ID_MSK: return &RNA_Mask;
                default: return &RNA_ID;
        }
 }
index cb90211eff997c293e45c8ff36ac088aa482eb29..e8e40d307fb99c413187d34a1cca5bedf0d16e0f 100644 (file)
@@ -179,6 +179,7 @@ void RNA_def_wm(struct BlenderRNA *brna);
 void RNA_def_world(struct BlenderRNA *brna);
 void RNA_def_movieclip(struct BlenderRNA *brna);
 void RNA_def_tracking(struct BlenderRNA *brna);
+void RNA_def_mask(struct BlenderRNA *brna);
 
 /* Common Define functions */
 
@@ -301,6 +302,7 @@ void RNA_def_main_actions(BlenderRNA *brna, PropertyRNA *cprop);
 void RNA_def_main_particles(BlenderRNA *brna, PropertyRNA *cprop);
 void RNA_def_main_gpencil(BlenderRNA *brna, PropertyRNA *cprop);
 void RNA_def_main_movieclips(BlenderRNA *brna, PropertyRNA *cprop);
+void RNA_def_main_masks(BlenderRNA *brna, PropertyRNA *cprop);
 
 /* ID Properties */
 
index b0981c1983536b3c0d64eb6292c36c21dcd5c0a7..6ac032e5d999f6cfc03d749e152354a72687a529 100644 (file)
@@ -253,6 +253,12 @@ static void rna_Main_movieclips_begin(CollectionPropertyIterator *iter, PointerR
        rna_iterator_listbase_begin(iter, &bmain->movieclip, NULL);
 }
 
+static void rna_Main_masks_begin(CollectionPropertyIterator *iter, PointerRNA *ptr)
+{
+       Main *bmain= (Main*)ptr->data;
+       rna_iterator_listbase_begin(iter, &bmain->mask, NULL);
+}
+
 #ifdef UNIT_TEST
 
 static PointerRNA rna_Test_test_get(PointerRNA *ptr)
@@ -316,6 +322,7 @@ void RNA_def_main(BlenderRNA *brna)
                {"particles", "ParticleSettings", "rna_Main_particle_begin", "Particles", "Particle datablocks", RNA_def_main_particles},
                {"grease_pencil", "GreasePencil", "rna_Main_gpencil_begin", "Grease Pencil", "Grease Pencil datablocks", RNA_def_main_gpencil},
                {"movieclips", "MovieClip", "rna_Main_movieclips_begin", "Movie Clips", "Movie Clip datablocks", RNA_def_main_movieclips},
+               {"masks", "Mask", "rna_Main_masks_begin", "Masks", "Masks datablocks", RNA_def_main_masks},
                {NULL, NULL, NULL, NULL, NULL, NULL}
        };
 
index 024265c3d18e7127200219f692695c3ab337cf59..98b3c0ab9f4323157a1fd191a14860023f05f2c7 100644 (file)
@@ -33,6 +33,8 @@
 #include <stdio.h>
 #include <errno.h>
 
+#include "DNA_ID.h"
+
 #include "RNA_define.h"
 #include "RNA_access.h"
 #include "RNA_enum_types.h"
@@ -67,6 +69,7 @@
 #include "BKE_depsgraph.h"
 #include "BKE_speaker.h"
 #include "BKE_movieclip.h"
+#include "BKE_mask.h"
 
 #include "DNA_armature_types.h"
 #include "DNA_camera_types.h"
@@ -87,6 +90,7 @@
 #include "DNA_vfont_types.h"
 #include "DNA_node_types.h"
 #include "DNA_movieclip_types.h"
+#include "DNA_mask_types.h"
 
 #include "ED_screen.h"
 
@@ -539,6 +543,22 @@ void rna_Main_movieclips_remove(Main *bmain, MovieClip *clip)
        /* XXX python now has invalid pointer? */
 }
 
+Mask *rna_Main_mask_new(Main *UNUSED(bmain), const char *name)
+{
+       Mask *mask;
+
+       mask = BKE_mask_new("Mask");
+
+       return mask;
+}
+
+void rna_Main_masks_remove(Main *bmain, Mask *mask)
+{
+       BKE_mask_unlink(bmain, mask);
+       BKE_libblock_free(&bmain->mask, mask);
+       /* XXX python now has invalid pointer? */
+}
+
 /* tag functions, all the same */
 void rna_Main_cameras_tag(Main *bmain, int value) { tag_main_lb(&bmain->camera, value); }
 void rna_Main_scenes_tag(Main *bmain, int value) { tag_main_lb(&bmain->scene, value); }
@@ -569,6 +589,7 @@ void rna_Main_actions_tag(Main *bmain, int value) { tag_main_lb(&bmain->action,
 void rna_Main_particles_tag(Main *bmain, int value) { tag_main_lb(&bmain->particle, value); }
 void rna_Main_gpencil_tag(Main *bmain, int value) { tag_main_lb(&bmain->gpencil, value); }
 void rna_Main_movieclips_tag(Main *bmain, int value) { tag_main_lb(&bmain->movieclip, value); }
+void rna_Main_masks_tag(Main *bmain, int value) { tag_main_lb(&bmain->mask, value); }
 
 static int rna_Main_cameras_is_updated_get(PointerRNA *ptr) { return DAG_id_type_tagged(ptr->data, ID_CA); }
 static int rna_Main_scenes_is_updated_get(PointerRNA *ptr) { return DAG_id_type_tagged(ptr->data, ID_SCE); }
@@ -1520,4 +1541,34 @@ void RNA_def_main_movieclips(BlenderRNA *brna, PropertyRNA *cprop)
        RNA_def_function_return(func, parm);
 }
 
+void RNA_def_main_masks(BlenderRNA *brna, PropertyRNA *cprop)
+{
+       StructRNA *srna;
+       FunctionRNA *func;
+       PropertyRNA *parm;
+
+       RNA_def_property_srna(cprop, "BlendDataMasks");
+       srna= RNA_def_struct(brna, "BlendDataMasks", NULL);
+       RNA_def_struct_sdna(srna, "Main");
+       RNA_def_struct_ui_text(srna, "Main Masks", "Collection of masks");
+
+       func= RNA_def_function(srna, "tag", "rna_Main_masks_tag");
+       parm= RNA_def_boolean(func, "value", 0, "Value", "");
+       RNA_def_property_flag(parm, PROP_REQUIRED);
+
+       /* new func */
+       func = RNA_def_function(srna, "new", "rna_Main_mask_new");
+       RNA_def_function_ui_description(func, "Add a new mask with a given name to the main database");
+       parm = RNA_def_string_file_path(func, "name", "", MAX_ID_NAME - 2, "Mask", "Name of new mask datablock");
+       /* return type */
+       parm = RNA_def_pointer(func, "mask", "Mask", "", "New mask datablock");
+       RNA_def_function_return(func, parm);
+
+       /* remove func */
+       func= RNA_def_function(srna, "remove", "rna_Main_masks_remove");
+       RNA_def_function_ui_description(func, "Remove a masks from the current blendfile.");
+       parm= RNA_def_pointer(func, "mask", "Mask", "", "Mask to remove");
+       RNA_def_property_flag(parm, PROP_REQUIRED|PROP_NEVER_NULL);
+}
+
 #endif
index 466a9b80c505ece63e74d1db360e00694e3a608f..30c705fb7fa31945be67de4c5ff2f644f0191204 100644 (file)
@@ -3030,6 +3030,18 @@ static void def_cmp_moviedistortion(StructRNA *srna)
        RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
 }
 
+static void def_cmp_mask(StructRNA *srna)
+{
+       PropertyRNA *prop;
+
+       prop = RNA_def_property(srna, "mask", PROP_POINTER, PROP_NONE);
+       RNA_def_property_pointer_sdna(prop, NULL, "id");
+       RNA_def_property_struct_type(prop, "Mask");
+       RNA_def_property_flag(prop, PROP_EDITABLE);
+       RNA_def_property_ui_text(prop, "Mask", "");
+}
+
+
 static void dev_cmd_transform(StructRNA *srna)
 {
        PropertyRNA *prop;
index 351c6d935144334ef0a5ba657f2e2590d7e386a7..d5b33f0d01b990e1b9aa4ca311cc7cd11729ecbf 100644 (file)
@@ -165,6 +165,7 @@ DefNode( CompositorNode, CMP_NODE_MASK_ELLIPSE,   def_cmp_ellipsemask,    "ELLIP
 DefNode( CompositorNode, CMP_NODE_BOKEHIMAGE,     def_cmp_bokehimage,     "BOKEHIMAGE"     ,BokehImage,       "Bokeh image",       ""              )
 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",              ""              )
                                                                                                                                                    
 DefNode( TextureNode,    TEX_NODE_OUTPUT,         def_tex_output,         "OUTPUT",         Output,           "Output",            ""              )
 DefNode( TextureNode,    TEX_NODE_CHECKER,        0,                      "CHECKER",        Checker,          "Checker",           ""              )
index 25f2bd7132c49a9c0dba3761b2fb0304a2fe155a..9eb313204f7c782dce317ac8a850daf3d4f97b8c 100644 (file)
@@ -1565,6 +1565,12 @@ static void rna_def_tool_settings(BlenderRNA  *brna)
        RNA_def_property_ui_icon(prop, ICON_PROP_OFF, 1);
        RNA_def_property_update(prop, NC_SCENE | ND_TOOLSETTINGS, NULL); /* header redraw */
 
+       prop = RNA_def_property(srna, "use_proportional_edit_mask", PROP_BOOLEAN, PROP_NONE);
+       RNA_def_property_boolean_sdna(prop, NULL, "proportional_mask", 0);
+       RNA_def_property_ui_text(prop, "Proportional Editing Objects", "Proportional editing mask mode");
+       RNA_def_property_ui_icon(prop, ICON_PROP_OFF, 1);
+       RNA_def_property_update(prop, NC_SCENE | ND_TOOLSETTINGS, NULL); /* header redraw */
+
        prop = RNA_def_property(srna, "proportional_edit_falloff", PROP_ENUM, PROP_NONE);
        RNA_def_property_enum_sdna(prop, NULL, "prop_mode");
        RNA_def_property_enum_items(prop, proportional_falloff_items);
index 9b4dcd03c79679e99fc6cedc430208bf364620b8..8fe33f3e80f1a6c3467f78063a6bf6129bd70631 100644 (file)
@@ -45,6 +45,7 @@
 #include "DNA_object_types.h"
 #include "DNA_space_types.h"
 #include "DNA_sequence_types.h"
+#include "DNA_mask_types.h"
 #include "DNA_view3d_types.h"
 
 #include "WM_api.h"
@@ -120,6 +121,7 @@ EnumPropertyItem viewport_shade_items[] = {
 #ifdef RNA_RUNTIME
 
 #include "DNA_anim_types.h"
+#include "DNA_mask_types.h"
 #include "DNA_scene_types.h"
 #include "DNA_screen_types.h"
 
@@ -1037,6 +1039,13 @@ static void rna_SpaceClipEditor_clip_set(PointerRNA *ptr, PointerRNA value)
        ED_space_clip_set(NULL, screen, sc, (MovieClip *)value.data);
 }
 
+static void rna_SpaceClipEditor_mask_set(PointerRNA *ptr, PointerRNA value)
+{
+       SpaceClip *sc= (SpaceClip*)(ptr->data);
+
+       ED_space_clip_set_mask(NULL, sc, (Mask*)value.data);
+}
+
 static void rna_SpaceClipEditor_clip_mode_update(Main *UNUSED(bmain), Scene *UNUSED(scene), PointerRNA *ptr)
 {
        SpaceClip *sc = (SpaceClip *)(ptr->data);
@@ -1060,6 +1069,14 @@ static void rna_SpaceClipEditor_view_type_update(Main *UNUSED(bmain), Scene *UNU
 
 #else
 
+static EnumPropertyItem dt_uv_items[] = {
+       {SI_UVDT_OUTLINE, "OUTLINE", 0, "Outline", "Draw white edges with black outline"},
+       {SI_UVDT_DASH, "DASH", 0, "Dash", "Draw dashed black-white edges"},
+       {SI_UVDT_BLACK, "BLACK", 0, "Black", "Draw black edges"},
+       {SI_UVDT_WHITE, "WHITE", 0, "White", "Draw white edges"},
+       {0, NULL, 0, NULL, NULL}
+};
+
 static void rna_def_space(BlenderRNA *brna)
 {
        StructRNA *srna;
@@ -1091,14 +1108,6 @@ static void rna_def_space_image_uv(BlenderRNA *brna)
                {0, NULL, 0, NULL, NULL}
        };
 
-       static EnumPropertyItem dt_uv_items[] = {
-               {SI_UVDT_OUTLINE, "OUTLINE", 0, "Outline", "Draw white edges with black outline"},
-               {SI_UVDT_DASH, "DASH", 0, "Dash", "Draw dashed black-white edges"},
-               {SI_UVDT_BLACK, "BLACK", 0, "Black", "Draw black edges"},
-               {SI_UVDT_WHITE, "WHITE", 0, "White", "Draw white edges"},
-               {0, NULL, 0, NULL, NULL}
-       };
-
        static EnumPropertyItem dt_uvstretch_items[] = {
                {SI_UVDT_STRETCH_ANGLE, "ANGLE", 0, "Angle", "Angular distortion between UV and 3D angles"},
                {SI_UVDT_STRETCH_AREA, "AREA", 0, "Area", "Area distortion between UV and 3D faces"},
@@ -2974,6 +2983,7 @@ static void rna_def_space_clip(BlenderRNA *brna)
                {SC_MODE_RECONSTRUCTION, "RECONSTRUCTION", ICON_SNAP_FACE, "Reconstruction",
                                         "Show tracking/reconstruction tools"},
                {SC_MODE_DISTORTION, "DISTORTION", ICON_GRID, "Distortion", "Show distortion tools"},
+               {SC_MODE_MASKEDITING, "MASKEDITING", ICON_MOD_MASK, "Mask editing", "Show mask editing tools"},
                {0, NULL, 0, NULL, NULL}
        };
 
@@ -2991,6 +3001,16 @@ static void rna_def_space_clip(BlenderRNA *brna)
                {0, NULL, 0, NULL, NULL}
        };
 
+       static EnumPropertyItem pivot_items[] = {
+               {V3D_CENTER, "BOUNDING_BOX_CENTER", ICON_ROTATE, "Bounding Box Center",
+                            "Pivot around bounding box center of selected object(s)"},
+               {V3D_LOCAL, "INDIVIDUAL_ORIGINS", ICON_ROTATECOLLECTION,
+                           "Individual Origins", "Pivot around each object's own origin"},
+               {V3D_CENTROID, "MEDIAN_POINT", ICON_ROTATECENTER, "Median Point",
+                              "Pivot around the median point of selected objects"},
+               {0, NULL, 0, NULL, NULL}
+       };
+
        srna = RNA_def_struct(brna, "SpaceClipEditor", "Space");
        RNA_def_struct_sdna(srna, "SpaceClip");
        RNA_def_struct_ui_text(srna, "Space Clip Editor", "Clip editor space data");
@@ -3011,6 +3031,26 @@ static void rna_def_space_clip(BlenderRNA *brna)
                                 "Parameters defining which frame of the movie clip is displayed");
        RNA_def_property_update(prop, NC_SPACE | ND_SPACE_CLIP, NULL);
 
+       /* mask */
+       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 displayed and edited in this space");
+       RNA_def_property_pointer_funcs(prop, NULL, "rna_SpaceClipEditor_mask_set", NULL, NULL);
+       RNA_def_property_update(prop, NC_SPACE|ND_SPACE_CLIP, NULL);
+
+       /* mask drawing */
+       prop = RNA_def_property(srna, "mask_draw_type", PROP_ENUM, PROP_NONE);
+       RNA_def_property_enum_sdna(prop, NULL, "mask_draw_type");
+       RNA_def_property_enum_items(prop, dt_uv_items);
+       RNA_def_property_ui_text(prop, "Edge Draw Type", "Draw type for mask splines");
+       RNA_def_property_update(prop, NC_SPACE|ND_SPACE_CLIP, NULL);
+
+       prop = RNA_def_property(srna, "show_mask_smooth", PROP_BOOLEAN, PROP_NONE);
+       RNA_def_property_boolean_sdna(prop, NULL, "mask_draw_flag", MASK_DRAWFLAG_SMOOTH);
+       RNA_def_property_ui_text(prop, "Draw Smooth Splines", "");
+       RNA_def_property_update(prop, NC_SPACE|ND_SPACE_CLIP, NULL);
+
+
        /* mode */
        prop = RNA_def_property(srna, "mode", PROP_ENUM, PROP_NONE);
        RNA_def_property_enum_sdna(prop, NULL, "mode");
@@ -3170,6 +3210,13 @@ static void rna_def_space_clip(BlenderRNA *brna)
        RNA_def_property_ui_text(prop, "Show Seconds", "Show timing in seconds not frames");
        RNA_def_property_update(prop, NC_MOVIECLIP | ND_DISPLAY, NULL);
 
+       /* pivot point */
+       prop = RNA_def_property(srna, "pivot_point", PROP_ENUM, PROP_NONE);
+       RNA_def_property_enum_sdna(prop, NULL, "around");
+       RNA_def_property_enum_items(prop, pivot_items);
+       RNA_def_property_ui_text(prop, "Pivot Point", "Pivot center for rotation/scaling");
+       RNA_def_property_update(prop, NC_SPACE | ND_SPACE_CLIP, NULL);
+
        /* ** dopesheet ** */
 
        /* dopesheet sort */
index 6bae6cdd473e4bcaedf15b5cd4b17d1a1cb34326..c637e3606f1a08300d895d0364684064f005a96b 100644 (file)
@@ -82,6 +82,7 @@ set(SRC
        composite/nodes/node_composite_mapUV.c
        composite/nodes/node_composite_mapValue.c
        composite/nodes/node_composite_math.c
+       composite/nodes/node_composite_mask.c
        composite/nodes/node_composite_mixrgb.c
        composite/nodes/node_composite_movieclip.c
        composite/nodes/node_composite_moviedistortion.c
index ca925c82afdf10407483f225b5a22c886f989ff4..f850ea91f12aace81486115dbd3e145a9a8ece5d 100644 (file)
@@ -50,6 +50,7 @@ void register_node_type_cmp_value(struct bNodeTreeType *ttype);
 void register_node_type_cmp_rgb(struct bNodeTreeType *ttype);
 void register_node_type_cmp_curve_time(struct bNodeTreeType *ttype);
 void register_node_type_cmp_movieclip(struct bNodeTreeType *ttype);
+void register_node_type_cmp_usermask(struct bNodeTreeType *ttype);
 
 void register_node_type_cmp_composite(struct bNodeTreeType *ttype);
 void register_node_type_cmp_viewer(struct bNodeTreeType *ttype);
@@ -115,6 +116,7 @@ void register_node_type_cmp_mapuv(struct bNodeTreeType *ttype);
 void register_node_type_cmp_transform(struct bNodeTreeType *ttype);
 void register_node_type_cmp_stabilize2d(struct bNodeTreeType *ttype);
 void register_node_type_cmp_moviedistortion(struct bNodeTreeType *ttype);
+void register_node_type_cmp_mask(struct bNodeTreeType *ttype);
 
 void register_node_type_cmp_glare(struct bNodeTreeType *ttype);
 void register_node_type_cmp_tonemap(struct bNodeTreeType *ttype);
index 8f8f702e8aeb1105d1c537e76327c480d29b35a4..457322929b037c354ba51c5721c33a2afd60b7e2 100644 (file)
@@ -890,6 +890,10 @@ int ntreeCompositTagAnimated(bNodeTree *ntree)
                        nodeUpdate(ntree, node);
                        tagged= 1;
                }
+               else if (node->type==CMP_NODE_MASK) {
+                       nodeUpdate(ntree, node);
+                       tagged= 1;
+               }
        }
        
        return tagged;
index 3806cf4543aa20a63469f82b776471dc291a0a08..ff223ac83cf7a07d111df6b9f3a9f84a0750363c 100644 (file)
@@ -568,6 +568,22 @@ CompBuf *valbuf_from_rgbabuf(CompBuf *cbuf, int channel)
        return valbuf;
 }
 
+void valbuf_to_rgbabuf(CompBuf *valbuf, CompBuf *cbuf, int channel)
+{
+       float *valf, *rectf;
+       int tot;
+
+       valf= valbuf->rect;
+
+       /* defaults to returning alpha channel */
+       if ((channel < CHAN_R) || (channel > CHAN_A)) channel = CHAN_A;
+
+       rectf = cbuf->rect + channel;
+
+       for (tot= cbuf->x*cbuf->y; tot>0; tot--, valf++, rectf+=4)
+               *rectf = *valf;
+}
+
 static CompBuf *generate_procedural_preview(CompBuf *cbuf, int newx, int newy)
 {
        CompBuf *outbuf;
index 8f42a9bbe4732fde8bf5ad9428fdd9165b0c1da5..cab60caaae79f4c39d5e556b6f79e5f4a9baccd8 100644 (file)
@@ -157,6 +157,7 @@ void composit4_pixel_processor(bNode *node, CompBuf *out, CompBuf *src1_buf, flo
                                                                          int src1_type, int fac1_type, int src2_type, int fac2_type);
 
 CompBuf *valbuf_from_rgbabuf(CompBuf *cbuf, int channel);
+void valbuf_to_rgbabuf(CompBuf *valbuf, CompBuf *cbuf, int channel);
 void generate_preview(void *data, bNode *node, CompBuf *stackbuf);
 
 void do_copy_rgba(bNode *node, float *out, float *in);
index 7cbeab6a02ebe7fd71f5371cdbacc86966fab42c..25abc171057b5f8de247a8d72210f8138db21453 100644 (file)
@@ -167,6 +167,7 @@ typedef struct wmNotifier {
 #define NC_ID                          (18<<24)
 #define NC_LOGIC                       (19<<24)
 #define NC_MOVIECLIP                   (20<<24)
+#define NC_MASK                                (21<<24)
 
 /* data type, 256 entries is enough, it can overlap */
 #define NOTE_DATA                      0x00FF0000
index 42787be8e021411342486d18f35b48320a8c8bc0..d7d55885f374f0f42a4505b8bb6937800351b089 100644 (file)
@@ -3853,6 +3853,7 @@ static void gesture_circle_modal_keymap(wmKeyConfig *keyconf)
        WM_modalkeymap_assign(keymap, "VIEW3D_OT_select_circle");
        WM_modalkeymap_assign(keymap, "UV_OT_circle_select");
        WM_modalkeymap_assign(keymap, "CLIP_OT_select_circle");
+       WM_modalkeymap_assign(keymap, "MASK_OT_select_circle");
 
 }
 
@@ -3936,6 +3937,7 @@ static void gesture_border_modal_keymap(wmKeyConfig *keyconf)
        WM_modalkeymap_assign(keymap, "UV_OT_select_border");
        WM_modalkeymap_assign(keymap, "CLIP_OT_select_border");
        WM_modalkeymap_assign(keymap, "CLIP_OT_graph_select_border");
+       WM_modalkeymap_assign(keymap, "MASK_OT_select_border");
        WM_modalkeymap_assign(keymap, "VIEW2D_OT_zoom_border");
        WM_modalkeymap_assign(keymap, "VIEW3D_OT_clip_border");
        WM_modalkeymap_assign(keymap, "VIEW3D_OT_render_border");
index 674d5540c8ba83d2b2aa1c6f8fbc05ba91e2eddf..9fb0c103f1df876cf5c66cd3a3ffe87505372b66 100644 (file)
@@ -152,6 +152,7 @@ endif()
                bf_blenkernel # duplicate for linking
                bf_intern_mikktspace
                extern_recastnavigation
+               bf_intern_raskter
        )
 
        if(WITH_MOD_CLOTH_ELTOPO)
index 86567873256281f5e7dd4e13e1ea6dc6f4c708ac..4c45099808c3b829b5ad388bc9cec74c483bde21 100644 (file)
@@ -228,6 +228,7 @@ void ED_space_image_uv_sculpt_update(struct wmWindowManager *wm, struct ToolSett
 
 void ED_screen_set_scene(struct bContext *C, struct Scene *scene) {}
 void ED_space_clip_set(struct bContext *C, struct SpaceClip *sc, struct MovieClip *clip) {}
+void ED_space_clip_set_mask(struct bContext *C, struct SpaceClip *sc, struct Mask *mask){}
 
 void ED_area_tag_redraw_regiontype(struct ScrArea *sa, int regiontype) {}
 void ED_render_engine_changed(struct Main *bmain) {}
index 74ccda8ce0ed26e7c7981679c890bff06764253f..ac52acc3043df666286776378274dd65c76c78f0 100644 (file)
@@ -823,6 +823,7 @@ endif()
                bf_editor_sound
                bf_editor_animation
                bf_editor_datafiles
+               bf_editor_mask
 
                bf_render
                bf_intern_opennl
@@ -894,6 +895,7 @@ endif()
                cycles_subd
                bf_compositor #added for opencl compositor
                bf_opencl #added for opencl compositor
+               bf_intern_raskter
        )
 
        if(WITH_LIBMV)