svn merge ^/trunk/blender -r49890:49917
authorCampbell Barton <ideasman42@gmail.com>
Wed, 15 Aug 2012 10:36:31 +0000 (10:36 +0000)
committerCampbell Barton <ideasman42@gmail.com>
Wed, 15 Aug 2012 10:36:31 +0000 (10:36 +0000)
31 files changed:
CMakeLists.txt
release/scripts/startup/bl_operators/node.py
release/scripts/startup/bl_ui/properties_data_modifier.py
release/scripts/startup/bl_ui/space_node.py
source/blender/compositor/intern/COM_Converter.cpp
source/blender/compositor/nodes/COM_BlurNode.cpp
source/blender/compositor/nodes/COM_BokehBlurNode.cpp
source/blender/editors/interface/interface_templates.c
source/blender/editors/object/object_bake.c
source/blender/editors/object/object_modifier.c
source/blender/editors/physics/physics_fluid.c
source/blender/editors/render/render_internal.c
source/blender/editors/render/render_opengl.c
source/blender/editors/render/render_preview.c
source/blender/editors/screen/screendump.c
source/blender/editors/sculpt_paint/paint_image.c
source/blender/editors/space_clip/clip_ops.c
source/blender/editors/space_clip/tracking_ops.c
source/blender/editors/space_file/filelist.c
source/blender/editors/space_node/drawnode.c
source/blender/editors/space_node/node_edit.c
source/blender/editors/space_sequencer/sequencer_edit.c
source/blender/editors/space_view3d/drawmesh.c
source/blender/editors/util/undo.c
source/blender/makesdna/DNA_node_types.h
source/blender/makesrna/intern/rna_nodetree.c
source/blender/modifiers/intern/MOD_displace.c
source/blender/windowmanager/WM_api.h
source/blender/windowmanager/intern/wm_init_exit.c
source/blender/windowmanager/intern/wm_jobs.c
source/blender/windowmanager/intern/wm_operators.c

index 1500181800cfee7df915c0a0b2ae78ccc9433c54..3ac95833b4efec0225973ac6e086b8a1cbc5ed8d 100644 (file)
@@ -995,9 +995,10 @@ elseif(WIN32)
                        # normally cached but not since we include them with blender
                        set(PYTHON_VERSION 3.2) # CACHE STRING)
                        set_lib_path(PYTHON "python")
-                       set(PYTHON_INCLUDE_DIR ${PYTHON}/include/python${PYTHON_VERSION})
                        set(PYTHON_LIBRARY ${PYTHON}/lib/python32.lib) #CACHE FILEPATH
-                       
+                       #Shared includes for both vc2008 and vc2010
+                       set(PYTHON_INCLUDE_DIR ${LIBDIR}/python/include/python${PYTHON_VERSION})
+
                        # uncached vars
                        set(PYTHON_INCLUDE_DIRS "${PYTHON_INCLUDE_DIR}")
                        set(PYTHON_LIBRARIES  "${PYTHON_LIBRARY}")
@@ -1007,7 +1008,7 @@ elseif(WIN32)
                        set(BOOST ${LIBDIR}/boost)
                        set(BOOST_INCLUDE_DIR ${BOOST}/include)
                        if(MSVC10)
-                               set(BOOST_LIBPATH ${BOOST}/lib/vc_10)
+                               set(BOOST_LIBPATH ${BOOST}/vc2010/lib)
                                set(BOOST_POSTFIX "vc100-mt-s-1_49.lib")
                                set(BOOST_DEBUG_POSTFIX "vc100-mt-sgd-1_49.lib")
                        else()
index 2f7fc359864bc5b0c7aec7c482d83551a42522c1..8a6874b43d1188d4818f1bf81f9e6e2899ca1aaa 100644 (file)
@@ -36,6 +36,7 @@ node_type_items_dict = {}
 node_type_prefix = 'NODE_'
 node_group_prefix = 'GROUP_'
 
+
 # Generate a list of enum items for a given node class
 # Copy existing type enum, adding a prefix to distinguish from node groups
 # Skip the base node group type, node groups will be added below for all existing group trees
@@ -43,13 +44,15 @@ def node_type_items(node_class):
     return [(node_type_prefix + item.identifier, item.name, item.description)
                     for item in node_class.bl_rna.properties['type'].enum_items if item.identifier != 'GROUP']
 
+
 # Generate items for node group types
-# Filter by the given tree_type 
+# Filter by the given tree_type
 # Node group trees don't have a description property yet (could add this as a custom property though)
 def node_group_items(tree_type):
     return [(node_group_prefix + group.name, group.name, '')
                     for group in bpy.data.node_groups if group.type == tree_type]
 
+
 # Returns the enum item list for the edited tree in the context
 def node_type_items_cb(self, context):
     snode = context.space_data
@@ -59,7 +62,7 @@ def node_type_items_cb(self, context):
     if not tree:
         return []
 
-    # Lists of basic node types for each 
+    # Lists of basic node types for each
     if not node_type_items_dict:
         node_type_items_dict.update({
             'SHADER': node_type_items(bpy.types.ShaderNode),
@@ -119,7 +122,7 @@ class NODE_OT_add_search(Operator):
     def poll(cls, context):
         space = context.space_data
         # needs active node editor and a tree to add nodes to
-        return space.type == 'NODE_EDITOR' and space.edit_tree
+        return (space.type == 'NODE_EDITOR' and space.edit_tree)
 
     def execute(self, context):
         self.create_node(context)
@@ -134,3 +137,33 @@ class NODE_OT_add_search(Operator):
 
         context.window_manager.invoke_search_popup(self)
         return {'CANCELLED'}
+
+
+class NODE_OT_collapse_hide_unused_toggle(Operator):
+    '''Toggle collapsed nodes and hide unused sockets'''
+    bl_idname = "node.collapse_hide_unused_toggle"
+    bl_label = "Collapse and Hide Unused Sockets"
+    bl_options = {'REGISTER', 'UNDO'}
+
+    @classmethod
+    def poll(cls, context):
+        space = context.space_data
+        # needs active node editor and a tree
+        return (space.type == 'NODE_EDITOR' and space.edit_tree)
+
+    def execute(self, context):
+        space = context.space_data
+        tree = space.edit_tree
+
+        for node in tree.nodes:
+            if node.select:
+                hide = (not node.hide)
+
+                node.hide = hide
+                # Note: connected sockets are ignored internally
+                for socket in node.inputs:
+                    socket.hide = hide
+                for socket in node.outputs:
+                    socket.hide = hide
+
+        return {'FINISHED'}
index 7485e532bd48bc985978329c7f72cc89bf4a2a1c..ae0c4d4161cc55cf39ca8fa45f2d29e1414718e7 100644 (file)
@@ -215,6 +215,8 @@ class DATA_PT_modifiers(ModifierButtonsPanel, Panel):
         layout.label(text="Face Count" + ": %d" % md.face_count)
 
     def DISPLACE(self, layout, ob, md):
+        has_texture = (md.texture is not None)
+        
         split = layout.split()
 
         col = split.column()
@@ -226,12 +228,18 @@ class DATA_PT_modifiers(ModifierButtonsPanel, Panel):
         col = split.column()
         col.label(text="Direction:")
         col.prop(md, "direction", text="")
-        col.label(text="Texture Coordinates:")
-        col.prop(md, "texture_coords", text="")
+        colsub = col.column()
+        colsub.active = has_texture
+        colsub.label(text="Texture Coordinates:")
+        colsub.prop(md, "texture_coords", text="")
         if md.texture_coords == 'OBJECT':
-            layout.prop(md, "texture_coords_object", text="Object")
+            row = layout.row()
+            row.active = has_texture
+            row.prop(md, "texture_coords_object", text="Object")
         elif md.texture_coords == 'UV' and ob.type == 'MESH':
-            layout.prop_search(md, "uv_layer", ob.data, "uv_textures")
+            row = layout.row()
+            row.active = has_texture
+            row.prop_search(md, "uv_layer", ob.data, "uv_textures")
 
         layout.separator()
 
index 7ea48d77cf0ddb686901d2e6f7f7fcf066886694..3a0f64e66dee11588be10395e572c921b8028ed3 100644 (file)
@@ -182,6 +182,7 @@ class NODE_MT_node(Menu):
         layout.operator("node.preview_toggle")
         layout.operator("node.hide_socket_toggle")
         layout.operator("node.options_toggle")
+        layout.operator("node.collapse_hide_unused_toggle")
 
         layout.separator()
 
index 24c3c36b79e347cbe2a8cced0b867733041967f8..37b53c44ef745308ec61fcea301a7bbe712099e7 100644 (file)
@@ -129,16 +129,16 @@ Node *Converter::convert(bNode *b_node, bool fast)
        }
        if (fast) {
                if (b_node->type == CMP_NODE_BLUR ||
-                       b_node->type == CMP_NODE_VECBLUR ||
-                       b_node->type == CMP_NODE_BILATERALBLUR ||
-                       b_node->type == CMP_NODE_DEFOCUS ||
-                       b_node->type == CMP_NODE_BOKEHBLUR ||
-                       b_node->type == CMP_NODE_GLARE ||
-                       b_node->type == CMP_NODE_DBLUR ||
-                       b_node->type == CMP_NODE_MOVIEDISTORTION ||
-                       b_node->type == CMP_NODE_LENSDIST ||
-                       b_node->type == CMP_NODE_DOUBLEEDGEMASK ||
-                       b_node->type == CMP_NODE_DILATEERODE) 
+                   b_node->type == CMP_NODE_VECBLUR ||
+                   b_node->type == CMP_NODE_BILATERALBLUR ||
+                   b_node->type == CMP_NODE_DEFOCUS ||
+                   b_node->type == CMP_NODE_BOKEHBLUR ||
+                   b_node->type == CMP_NODE_GLARE ||
+                   b_node->type == CMP_NODE_DBLUR ||
+                   b_node->type == CMP_NODE_MOVIEDISTORTION ||
+                   b_node->type == CMP_NODE_LENSDIST ||
+                   b_node->type == CMP_NODE_DOUBLEEDGEMASK ||
+                   b_node->type == CMP_NODE_DILATEERODE)
                {
                        return new MuteNode(b_node);
                }
index 059b01e2c05cf8b2f0e03ee372e9c1b78d63ad04..93ef002c8d7456b3c9053ab7a3c3f7cbb2a62f1f 100644 (file)
@@ -59,7 +59,7 @@ void BlurNode::convertToOperations(ExecutionSystem *graph, CompositorContext *co
                graph->addOperation(operationfgb);
                addPreviewOperation(graph, operationfgb->getOutputSocket());
        }
-       else if (editorNode->custom1 & CMP_NODEFLAG_BLUR_REFERENCE) {
+       else if (editorNode->custom1 & CMP_NODEFLAG_BLUR_VARIABLE_SIZE) {
                MathAddOperation *clamp = new MathAddOperation();
                SetValueOperation *zero = new SetValueOperation();
                addLink(graph, zero->getOutputSocket(), clamp->getInputSocket(1));
index 434fcf2a6089ff1e0300f501702e41b0e5444fc5..9abf97aa16f4945de36a2737825ad7f7bc5322b1 100644 (file)
@@ -36,10 +36,9 @@ BokehBlurNode::BokehBlurNode(bNode *editorNode) : Node(editorNode)
 
 void BokehBlurNode::convertToOperations(ExecutionSystem *graph, CompositorContext *context)
 {
-       InputSocket *inputSizeSocket = this->getInputSocket(2);
-       bool connectedSizeSocket = inputSizeSocket->isConnected();
+       bNode *b_node = this->getbNode();
 
-       if (connectedSizeSocket) {
+       if (b_node->custom1 & CMP_NODEFLAG_BLUR_VARIABLE_SIZE) {
                VariableSizeBokehBlurOperation *operation = new VariableSizeBokehBlurOperation();
 
                this->getInputSocket(0)->relinkConnections(operation->getInputSocket(0), 0, graph);
@@ -51,13 +50,14 @@ void BokehBlurNode::convertToOperations(ExecutionSystem *graph, CompositorContex
                this->getOutputSocket(0)->relinkConnections(operation->getOutputSocket());
 
                operation->setThreshold(0.0f);
-
-               /* TODO, we need to know the max input pixel of the input, this value is arbitrary! */
-               operation->setMaxBlur(100.0f);
+               operation->setMaxBlur(b_node->custom4);
                operation->setDoScaleSize(true);
        }
        else {
                BokehBlurOperation *operation = new BokehBlurOperation();
+               InputSocket *inputSizeSocket = this->getInputSocket(2);
+
+               bool connectedSizeSocket = inputSizeSocket->isConnected();
 
                const bNodeSocket *sock = this->getInputSocket(2)->getbNodeSocket();
                const float size = ((const bNodeSocketValueFloat *)sock->default_value)->value;
@@ -72,6 +72,8 @@ void BokehBlurNode::convertToOperations(ExecutionSystem *graph, CompositorContex
                graph->addOperation(operation);
                this->getOutputSocket(0)->relinkConnections(operation->getOutputSocket());
 
-               operation->setSize(size);
+               if (!connectedSizeSocket) {
+                       operation->setSize(size);
+               }
        }
 }
index 5997bd77699e25b422d340a009e85c23c7d5661b..450c4c8920e7b14f2284943fa539007d09ce4bf6 100644 (file)
@@ -2595,7 +2595,7 @@ static void do_running_jobs(bContext *C, void *UNUSED(arg), int event)
                        WM_operator_name_call(C, "SCREEN_OT_animation_play", WM_OP_INVOKE_SCREEN, NULL);
                        break;
                case B_STOPCOMPO:
-                       WM_jobs_stop(CTX_wm_manager(C), CTX_wm_area(C), NULL);
+                       WM_jobs_stop(CTX_wm_manager(C), CTX_data_scene(C), NULL);
                        break;
                case B_STOPSEQ:
                        WM_jobs_stop(CTX_wm_manager(C), CTX_wm_area(C), NULL);
@@ -2620,29 +2620,30 @@ void uiTemplateRunningJobs(uiLayout *layout, bContext *C)
 
        uiBlockSetHandleFunc(block, do_running_jobs, NULL);
 
-       if (sa->spacetype == SPACE_NODE) {
-               if (WM_jobs_test(wm, sa))
-                       owner = sa;
-               handle_event = B_STOPCOMPO;
-       }
-       else if (sa->spacetype == SPACE_SEQ) {
-               if (WM_jobs_test(wm, sa))
+       if (sa->spacetype == SPACE_SEQ) {
+               if (WM_jobs_test(wm, sa, WM_JOB_TYPE_ANY))
                        owner = sa;
                handle_event = B_STOPSEQ;
        }
        else if (sa->spacetype == SPACE_CLIP) {
-               if (WM_jobs_test(wm, sa))
+               if (WM_jobs_test(wm, sa, WM_JOB_TYPE_ANY))
                        owner = sa;
                handle_event = B_STOPCLIP;
        }
        else {
                Scene *scene;
                /* another scene can be rendering too, for example via compositor */
-               for (scene = CTX_data_main(C)->scene.first; scene; scene = scene->id.next)
-                       if (WM_jobs_test(wm, scene))
+               for (scene = CTX_data_main(C)->scene.first; scene; scene = scene->id.next) {
+                       if (WM_jobs_test(wm, scene, WM_JOB_TYPE_RENDER)) {
+                               handle_event = B_STOPRENDER;
                                break;
+                       }
+                       else if (WM_jobs_test(wm, scene, WM_JOB_TYPE_COMPOSITE)) {
+                               handle_event = B_STOPCOMPO;
+                               break;
+                       }
+               }
                owner = scene;
-               handle_event = B_STOPRENDER;
        }
 
        if (owner) {
@@ -2658,7 +2659,7 @@ void uiTemplateRunningJobs(uiLayout *layout, bContext *C)
                
                uiLayoutRow(layout, FALSE);
        }
-       if (WM_jobs_test(wm, screen))
+       if (WM_jobs_test(wm, screen, WM_JOB_TYPE_SCREENCAST))
                uiDefIconTextBut(block, BUT, B_STOPCAST, ICON_CANCEL, IFACE_("Capture"), 0, 0, 85, UI_UNIT_Y, NULL, 0.0f, 0.0f, 0, 0,
                                 TIP_("Stop screencast"));
        if (screen->animtimer)
index c3093259fd84b885187210c9d04ad433d4f1e214..59cc782f3ebe1bae4e850c953e8ede5f4b79e40f 100644 (file)
@@ -1241,7 +1241,7 @@ static int multiresbake_image_exec(bContext *C, wmOperator *op)
 {
        Scene *scene = CTX_data_scene(C);
        MultiresBakeJob *bkr;
-       wmJob *steve;
+       wmJob *wm_job;
 
        if (!multiresbake_check(C, op))
                return OPERATOR_CANCELLED;
@@ -1255,14 +1255,15 @@ static int multiresbake_image_exec(bContext *C, wmOperator *op)
        }
 
        /* setup job */
-       steve = WM_jobs_get(CTX_wm_manager(C), CTX_wm_window(C), scene, "Multires Bake", WM_JOB_EXCL_RENDER | WM_JOB_PRIORITY | WM_JOB_PROGRESS);
-       WM_jobs_customdata_set(steve, bkr, multiresbake_freejob);
-       WM_jobs_timer(steve, 0.2, NC_IMAGE, 0); /* TODO - only draw bake image, can we enforce this */
-       WM_jobs_callbacks(steve, multiresbake_startjob, NULL, NULL, NULL);
+       wm_job = WM_jobs_get(CTX_wm_manager(C), CTX_wm_window(C), scene, "Multires Bake",
+                            WM_JOB_EXCL_RENDER | WM_JOB_PRIORITY | WM_JOB_PROGRESS, WM_JOB_TYPE_OBJECT_BAKE_TEXTURE);
+       WM_jobs_customdata_set(wm_job, bkr, multiresbake_freejob);
+       WM_jobs_timer(wm_job, 0.2, NC_IMAGE, 0); /* TODO - only draw bake image, can we enforce this */
+       WM_jobs_callbacks(wm_job, multiresbake_startjob, NULL, NULL, NULL);
 
        G.is_break = FALSE;
 
-       WM_jobs_start(CTX_wm_manager(C), steve);
+       WM_jobs_start(CTX_wm_manager(C), wm_job);
        WM_cursor_wait(0);
 
        /* add modal handler for ESC */
@@ -1438,7 +1439,7 @@ static void bake_freejob(void *bkv)
 static int objects_bake_render_modal(bContext *C, wmOperator *UNUSED(op), wmEvent *event)
 {
        /* no running blender, remove handler and pass through */
-       if (0 == WM_jobs_test(CTX_wm_manager(C), CTX_data_scene(C)))
+       if (0 == WM_jobs_test(CTX_wm_manager(C), CTX_data_scene(C), WM_JOB_TYPE_OBJECT_BAKE_TEXTURE))
                return OPERATOR_FINISHED | OPERATOR_PASS_THROUGH;
 
        /* running render */
@@ -1468,7 +1469,7 @@ static int objects_bake_render_invoke(bContext *C, wmOperator *op, wmEvent *UNUS
        }
        else {
                /* only one render job at a time */
-               if (WM_jobs_test(CTX_wm_manager(C), scene))
+               if (WM_jobs_test(CTX_wm_manager(C), scene, WM_JOB_TYPE_OBJECT_BAKE_TEXTURE))
                        return OPERATOR_CANCELLED;
 
                if (test_bake_internal(C, op->reports) == 0) {
@@ -1476,21 +1477,22 @@ static int objects_bake_render_invoke(bContext *C, wmOperator *op, wmEvent *UNUS
                }
                else {
                        BakeRender *bkr = MEM_callocN(sizeof(BakeRender), "render bake");
-                       wmJob *steve;
+                       wmJob *wm_job;
 
                        init_bake_internal(bkr, C);
                        bkr->reports = op->reports;
 
                        /* setup job */
-                       steve = WM_jobs_get(CTX_wm_manager(C), CTX_wm_window(C), scene, "Texture Bake", WM_JOB_EXCL_RENDER | WM_JOB_PRIORITY | WM_JOB_PROGRESS);
-                       WM_jobs_customdata_set(steve, bkr, bake_freejob);
-                       WM_jobs_timer(steve, 0.2, NC_IMAGE, 0); /* TODO - only draw bake image, can we enforce this */
-                       WM_jobs_callbacks(steve, bake_startjob, NULL, bake_update, NULL);
+                       wm_job = WM_jobs_get(CTX_wm_manager(C), CTX_wm_window(C), scene, "Texture Bake",
+                                            WM_JOB_EXCL_RENDER | WM_JOB_PRIORITY | WM_JOB_PROGRESS, WM_JOB_TYPE_OBJECT_BAKE_TEXTURE);
+                       WM_jobs_customdata_set(wm_job, bkr, bake_freejob);
+                       WM_jobs_timer(wm_job, 0.2, NC_IMAGE, 0); /* TODO - only draw bake image, can we enforce this */
+                       WM_jobs_callbacks(wm_job, bake_startjob, NULL, bake_update, NULL);
 
                        G.is_break = FALSE;
                        G.is_rendering = TRUE;
 
-                       WM_jobs_start(CTX_wm_manager(C), steve);
+                       WM_jobs_start(CTX_wm_manager(C), wm_job);
 
                        WM_cursor_wait(0);
 
index 2bace9c30d49ad52fea2ac8265777c5f85f929cd..47f5a28537471614857ceef2e468756d10cea329 100644 (file)
@@ -2114,7 +2114,7 @@ static int ocean_bake_exec(bContext *C, wmOperator *op)
        int f, cfra, i = 0;
        int free = RNA_boolean_get(op->ptr, "free");
        
-       wmJob *steve;
+       wmJob *wm_job;
        OceanBakeJob *oj;
        
        if (!omd)
@@ -2181,17 +2181,18 @@ static int ocean_bake_exec(bContext *C, wmOperator *op)
        scene->r.cfra = cfra;
        
        /* setup job */
-       steve = WM_jobs_get(CTX_wm_manager(C), CTX_wm_window(C), scene, "Ocean Simulation", WM_JOB_PROGRESS);
+       wm_job = WM_jobs_get(CTX_wm_manager(C), CTX_wm_window(C), scene, "Ocean Simulation",
+                            WM_JOB_PROGRESS, WM_JOB_TYPE_OBJECT_SIM_OCEAN);
        oj = MEM_callocN(sizeof(OceanBakeJob), "ocean bake job");
        oj->ocean = ocean;
        oj->och = och;
        oj->omd = omd;
        
-       WM_jobs_customdata_set(steve, oj, oceanbake_free);
-       WM_jobs_timer(steve, 0.1, NC_OBJECT | ND_MODIFIER, NC_OBJECT | ND_MODIFIER);
-       WM_jobs_callbacks(steve, oceanbake_startjob, NULL, NULL, oceanbake_endjob);
+       WM_jobs_customdata_set(wm_job, oj, oceanbake_free);
+       WM_jobs_timer(wm_job, 0.1, NC_OBJECT | ND_MODIFIER, NC_OBJECT | ND_MODIFIER);
+       WM_jobs_callbacks(wm_job, oceanbake_startjob, NULL, NULL, oceanbake_endjob);
        
-       WM_jobs_start(CTX_wm_manager(C), steve);
+       WM_jobs_start(CTX_wm_manager(C), wm_job);
        
        
        
index 621d06a7bd86444be0ab7a84ae9980910b75765a..2f91652968fa46980c2128af590e23153e538911 100644 (file)
@@ -1068,14 +1068,15 @@ static int fluidsimBake(bContext *C, ReportList *reports, Object *fsDomain, shor
        fb->settings = fsset;
        
        if (do_job) {
-               wmJob *steve= WM_jobs_get(CTX_wm_manager(C), CTX_wm_window(C), scene, "Fluid Simulation", WM_JOB_PROGRESS);
+               wmJob *wm_job = WM_jobs_get(CTX_wm_manager(C), CTX_wm_window(C), scene, "Fluid Simulation",
+                                           WM_JOB_PROGRESS, WM_JOB_TYPE_OBJECT_SIM_FLUID);
 
                /* setup job */
-               WM_jobs_customdata_set(steve, fb, fluidbake_free);
-               WM_jobs_timer(steve, 0.1, NC_SCENE|ND_FRAME, NC_SCENE|ND_FRAME);
-               WM_jobs_callbacks(steve, fluidbake_startjob, NULL, NULL, fluidbake_endjob);
+               WM_jobs_customdata_set(wm_job, fb, fluidbake_free);
+               WM_jobs_timer(wm_job, 0.1, NC_SCENE|ND_FRAME, NC_SCENE|ND_FRAME);
+               WM_jobs_callbacks(wm_job, fluidbake_startjob, NULL, NULL, fluidbake_endjob);
 
-               WM_jobs_start(CTX_wm_manager(C), steve);
+               WM_jobs_start(CTX_wm_manager(C), wm_job);
        }
        else {
                short dummy_stop, dummy_do_update;
@@ -1130,7 +1131,7 @@ static int fluidsimBake(bContext *UNUSED(C), ReportList *UNUSED(reports), Object
 static int fluid_bake_invoke(bContext *C, wmOperator *op, wmEvent *UNUSED(event))
 {
        /* only one bake job at a time */
-       if (WM_jobs_test(CTX_wm_manager(C), CTX_data_scene(C)))
+       if (WM_jobs_test(CTX_wm_manager(C), CTX_data_scene(C), WM_JOB_TYPE_OBJECT_SIM_FLUID))
                return OPERATOR_CANCELLED;
 
        if (!fluidsimBake(C, op->reports, CTX_data_active_object(C), TRUE))
index 031ad017c79764fe79c0e05c387801c2c953064d..96e2b3f1c3a537c6df2a3b93a9c13eb10beed8e4 100644 (file)
@@ -461,7 +461,7 @@ static int screen_render_modal(bContext *C, wmOperator *op, wmEvent *event)
        Scene *scene = (Scene *) op->customdata;
 
        /* no running blender, remove handler and pass through */
-       if (0 == WM_jobs_test(CTX_wm_manager(C), scene)) {
+       if (0 == WM_jobs_test(CTX_wm_manager(C), scene, WM_JOB_TYPE_RENDER)) {
                return OPERATOR_FINISHED | OPERATOR_PASS_THROUGH;
        }
 
@@ -483,7 +483,7 @@ static int screen_render_invoke(bContext *C, wmOperator *op, wmEvent *event)
        SceneRenderLayer *srl = NULL;
        View3D *v3d = CTX_wm_view3d(C);
        Render *re;
-       wmJob *steve;
+       wmJob *wm_job;
        RenderJob *rj;
        Image *ima;
        int jobflag;
@@ -493,7 +493,7 @@ static int screen_render_invoke(bContext *C, wmOperator *op, wmEvent *event)
        const char *name;
        
        /* only one render job at a time */
-       if (WM_jobs_test(CTX_wm_manager(C), scene))
+       if (WM_jobs_test(CTX_wm_manager(C), scene, WM_JOB_TYPE_RENDER))
                return OPERATOR_CANCELLED;
 
        if (!RE_is_rendering_allowed(scene, camera_override, op->reports)) {
@@ -568,10 +568,10 @@ static int screen_render_invoke(bContext *C, wmOperator *op, wmEvent *event)
        if (RE_seq_render_active(scene, &scene->r)) name = "Sequence Render";
        else name = "Render";
 
-       steve = WM_jobs_get(CTX_wm_manager(C), CTX_wm_window(C), scene, name, jobflag);
-       WM_jobs_customdata_set(steve, rj, render_freejob);
-       WM_jobs_timer(steve, 0.2, NC_SCENE | ND_RENDER_RESULT, 0);
-       WM_jobs_callbacks(steve, render_startjob, NULL, NULL, render_endjob);
+       wm_job = WM_jobs_get(CTX_wm_manager(C), CTX_wm_window(C), scene, name, jobflag, WM_JOB_TYPE_RENDER);
+       WM_jobs_customdata_set(wm_job, rj, render_freejob);
+       WM_jobs_timer(wm_job, 0.2, NC_SCENE | ND_RENDER_RESULT, 0);
+       WM_jobs_callbacks(wm_job, render_startjob, NULL, NULL, render_endjob);
 
        /* get a render result image, and make sure it is empty */
        ima = BKE_image_verify_viewer(IMA_TYPE_R_RESULT, "Render Result");
@@ -596,7 +596,7 @@ static int screen_render_invoke(bContext *C, wmOperator *op, wmEvent *event)
         */
        op->customdata = scene;
 
-       WM_jobs_start(CTX_wm_manager(C), steve);
+       WM_jobs_start(CTX_wm_manager(C), wm_job);
 
        WM_cursor_wait(0);
        WM_event_add_notifier(C, NC_SCENE | ND_RENDER_RESULT, scene);
index d705799b1d83b9d76d6d80ec058957f829c5aaf5..55df1caf3eb2e24e37fcd660ef22f719c6e9e127 100644 (file)
@@ -309,7 +309,7 @@ static int screen_opengl_render_init(bContext *C, wmOperator *op)
        }
 
        /* only one render job at a time */
-       if (WM_jobs_test(CTX_wm_manager(C), scene))
+       if (WM_jobs_test(CTX_wm_manager(C), scene, WM_JOB_TYPE_RENDER))
                return 0;
        
        if (!is_view_context && scene->camera == NULL) {
index 03906c99c7463055920b3efa03a4dfab71ffc4f1..4f62974a3e1806cb3b87bfc9ffdf21259a6cabf2 100644 (file)
@@ -1022,16 +1022,17 @@ static void icon_preview_free(void *customdata)
 
 void ED_preview_icon_job(const bContext *C, void *owner, ID *id, unsigned int *rect, int sizex, int sizey)
 {
-       wmJob *steve;
+       wmJob *wm_job;
        IconPreview *ip, *old_ip;
        
        /* suspended start means it starts after 1 timer step, see WM_jobs_timer below */
-       steve = WM_jobs_get(CTX_wm_manager(C), CTX_wm_window(C), owner, "Icon Preview", WM_JOB_EXCL_RENDER | WM_JOB_SUSPEND);
+       wm_job = WM_jobs_get(CTX_wm_manager(C), CTX_wm_window(C), owner, "Icon Preview",
+                            WM_JOB_EXCL_RENDER | WM_JOB_SUSPEND, WM_JOB_TYPE_RENDER_PREVIEW);
 
        ip = MEM_callocN(sizeof(IconPreview), "icon preview");
 
        /* render all resolutions from suspended job too */
-       old_ip = WM_jobs_customdata_get(steve);
+       old_ip = WM_jobs_customdata_get(wm_job);
        if (old_ip)
                BLI_movelisttolist(&ip->sizes, &old_ip->sizes);
 
@@ -1043,20 +1044,21 @@ void ED_preview_icon_job(const bContext *C, void *owner, ID *id, unsigned int *r
        icon_preview_add_size(ip, rect, sizex, sizey);
 
        /* setup job */
-       WM_jobs_customdata_set(steve, ip, icon_preview_free);
-       WM_jobs_timer(steve, 0.25, NC_MATERIAL, NC_MATERIAL);
-       WM_jobs_callbacks(steve, icon_preview_startjob_all_sizes, NULL, NULL, icon_preview_endjob);
+       WM_jobs_customdata_set(wm_job, ip, icon_preview_free);
+       WM_jobs_timer(wm_job, 0.25, NC_MATERIAL, NC_MATERIAL);
+       WM_jobs_callbacks(wm_job, icon_preview_startjob_all_sizes, NULL, NULL, icon_preview_endjob);
 
-       WM_jobs_start(CTX_wm_manager(C), steve);
+       WM_jobs_start(CTX_wm_manager(C), wm_job);
 }
 
 void ED_preview_shader_job(const bContext *C, void *owner, ID *id, ID *parent, MTex *slot, int sizex, int sizey, int method)
 {
        Object *ob = CTX_data_active_object(C);
-       wmJob *steve;
+       wmJob *wm_job;
        ShaderPreview *sp;
 
-       steve = WM_jobs_get(CTX_wm_manager(C), CTX_wm_window(C), owner, "Shader Preview", WM_JOB_EXCL_RENDER);
+       wm_job = WM_jobs_get(CTX_wm_manager(C), CTX_wm_window(C), owner, "Shader Preview",
+                           WM_JOB_EXCL_RENDER, WM_JOB_TYPE_RENDER_PREVIEW);
        sp = MEM_callocN(sizeof(ShaderPreview), "shader preview");
 
        /* customdata for preview thread */
@@ -1072,11 +1074,11 @@ void ED_preview_shader_job(const bContext *C, void *owner, ID *id, ID *parent, M
        else sp->col[0] = sp->col[1] = sp->col[2] = sp->col[3] = 1.0f;
        
        /* setup job */
-       WM_jobs_customdata_set(steve, sp, shader_preview_free);
-       WM_jobs_timer(steve, 0.1, NC_MATERIAL, NC_MATERIAL);
-       WM_jobs_callbacks(steve, common_preview_startjob, NULL, shader_preview_updatejob, NULL);
+       WM_jobs_customdata_set(wm_job, sp, shader_preview_free);
+       WM_jobs_timer(wm_job, 0.1, NC_MATERIAL, NC_MATERIAL);
+       WM_jobs_callbacks(wm_job, common_preview_startjob, NULL, shader_preview_updatejob, NULL);
        
-       WM_jobs_start(CTX_wm_manager(C), steve);
+       WM_jobs_start(CTX_wm_manager(C), wm_job);
 }
 
 void ED_preview_kill_jobs(const struct bContext *C)
index 166a4943db0281e11800b9e427a22cb5b25939da..41e2f0b16a437d15c06d5b0a654de5b2636946d2 100644 (file)
@@ -396,7 +396,7 @@ static void screenshot_startjob(void *sjv, short *stop, short *do_update, float
 static int screencast_exec(bContext *C, wmOperator *op)
 {
        bScreen *screen = CTX_wm_screen(C);
-       wmJob *steve = WM_jobs_get(CTX_wm_manager(C), CTX_wm_window(C), screen, "Screencast", 0);
+       wmJob *wm_job = WM_jobs_get(CTX_wm_manager(C), CTX_wm_window(C), screen, "Screencast", 0, WM_JOB_TYPE_SCREENCAST);
        ScreenshotJob *sj = MEM_callocN(sizeof(ScreenshotJob), "screenshot job");
 
        /* setup sj */
@@ -420,11 +420,11 @@ static int screencast_exec(bContext *C, wmOperator *op)
        BKE_reports_init(&sj->reports, RPT_PRINT);
 
        /* setup job */
-       WM_jobs_customdata_set(steve, sj, screenshot_freejob);
-       WM_jobs_timer(steve, 0.1, 0, NC_SCREEN | ND_SCREENCAST);
-       WM_jobs_callbacks(steve, screenshot_startjob, NULL, screenshot_updatejob, NULL);
+       WM_jobs_customdata_set(wm_job, sj, screenshot_freejob);
+       WM_jobs_timer(wm_job, 0.1, 0, NC_SCREEN | ND_SCREENCAST);
+       WM_jobs_callbacks(wm_job, screenshot_startjob, NULL, screenshot_updatejob, NULL);
        
-       WM_jobs_start(CTX_wm_manager(C), steve);
+       WM_jobs_start(CTX_wm_manager(C), wm_job);
        
        WM_event_add_notifier(C, NC_SCREEN | ND_SCREENCAST, screen);
        
index 05cc958aa4333eb5f6bf204dc79315922afcdba2..76e4a75ea8b7a9a5d44c9d5efa82f9e6e920cf65 100644 (file)
@@ -3713,7 +3713,7 @@ static void blend_color_mix_float(float *cp, const float *cp1, const float *cp2,
        cp[3] = mfac * cp1[3] + fac * cp2[3];
 }
 
-static void blend_color_mix_accum(unsigned char *cp, const unsigned char *cp1, const unsigned char *cp2, const int fac)
+static void blend_color_mix_accum(unsigned char cp[4], const unsigned char cp1[4], const unsigned char cp2[4], const int fac)
 {
        /* this and other blending modes previously used >>8 instead of /255. both
         * are not equivalent (>>8 is /256), and the former results in rounding
@@ -3726,6 +3726,17 @@ static void blend_color_mix_accum(unsigned char *cp, const unsigned char *cp1, c
        cp[2] = (mfac * cp1[2] + fac * cp2[2]) / 255;
        cp[3] = alpha > 255 ? 255 : alpha;
 }
+static void blend_color_mix_accum_float(float cp[4], const float cp1[4], const unsigned char cp2[4], const float fac)
+{
+       const float mfac = 1.0f - fac;
+       const float alpha = cp1[3] + (fac * (cp2[3] / 255.0f));
+
+       cp[0] = (mfac * cp1[0] + (fac * (cp2[0] / 255.0f)));
+       cp[1] = (mfac * cp1[1] + (fac * (cp2[1] / 255.0f)));
+       cp[2] = (mfac * cp1[2] + (fac * (cp2[2] / 255.0f)));
+       cp[3] = alpha > 1.0f ? 1.0f : alpha;
+}
+
 
 static void do_projectpaint_clone(ProjPaintState *ps, ProjPixel *projPixel, float alpha, float mask)
 {
@@ -3886,7 +3897,7 @@ static void *do_projectpaint_thread(void *ph_v)
        
        /* printf("brush bounds %d %d %d %d\n", bucketMin[0], bucketMin[1], bucketMax[0], bucketMax[1]); */
        
-       while (project_bucket_iter_next(ps, &bucket_index, &bucket_bounds, pos)) {                              
+       while (project_bucket_iter_next(ps, &bucket_index, &bucket_bounds, pos)) {
                
                /* Check this bucket and its faces are initialized */
                if (ps->bucketFlags[bucket_index] == PROJ_BUCKET_NULL) {
@@ -3901,11 +3912,36 @@ static void *do_projectpaint_thread(void *ph_v)
                        for (node = ps->bucketRect[bucket_index]; node; node = node->next) {
                                projPixel = (ProjPixel *)node->link;
 
-                               bicubic_interpolation_color(ps->reproject_ibuf, projPixel->newColor.ch, NULL, projPixel->projCoSS[0], projPixel->projCoSS[1]);
-                               if (projPixel->newColor.ch[3]) {
-                                       mask = ((float)projPixel->mask) / 65535.0f;
-                                       blend_color_mix_accum(projPixel->pixel.ch_pt,  projPixel->origColor.ch, projPixel->newColor.ch, (int)(mask * projPixel->newColor.ch[3]));
+                               /* copy of code below */
+                               if (last_index != projPixel->image_index) {
+                                       last_index = projPixel->image_index;
+                                       last_projIma = projImages + last_index;
 
+                                       last_projIma->touch = 1;
+                                       is_floatbuf = last_projIma->ibuf->rect_float ? 1 : 0;
+                                       use_color_correction = (last_projIma->ibuf->profile == IB_PROFILE_LINEAR_RGB) ? 1 : 0;
+                               }
+                               /* end copy */
+
+                               if (is_floatbuf) {
+                                       /* re-project buffer is assumed byte - TODO, allow float */
+                                       bicubic_interpolation_color(ps->reproject_ibuf, projPixel->newColor.ch, NULL,
+                                                                   projPixel->projCoSS[0], projPixel->projCoSS[1]);
+                                       if (projPixel->newColor.ch[3]) {
+                                               mask = ((float)projPixel->mask) / 65535.0f;
+                                               blend_color_mix_accum_float(projPixel->pixel.f_pt,  projPixel->origColor.f,
+                                                                           projPixel->newColor.ch, (mask * (projPixel->newColor.ch[3] / 255.0f)));
+                                       }
+                               }
+                               else {
+                                       /* re-project buffer is assumed byte - TODO, allow float */
+                                       bicubic_interpolation_color(ps->reproject_ibuf, projPixel->newColor.ch, NULL,
+                                                                   projPixel->projCoSS[0], projPixel->projCoSS[1]);
+                                       if (projPixel->newColor.ch[3]) {
+                                               mask = ((float)projPixel->mask) / 65535.0f;
+                                               blend_color_mix_accum(projPixel->pixel.ch_pt,  projPixel->origColor.ch,
+                                                                     projPixel->newColor.ch, (int)(mask * projPixel->newColor.ch[3]));
+                                       }
                                }
                        }
                }
@@ -3959,6 +3995,7 @@ static void *do_projectpaint_thread(void *ph_v)
                                                
                                                if (alpha > 0.0f) {
 
+                                                       /* copy of code above */
                                                        if (last_index != projPixel->image_index) {
                                                                last_index = projPixel->image_index;
                                                                last_projIma = projImages + last_index;
@@ -3967,6 +4004,7 @@ static void *do_projectpaint_thread(void *ph_v)
                                                                is_floatbuf = last_projIma->ibuf->rect_float ? 1 : 0;
                                                                use_color_correction = (last_projIma->ibuf->profile == IB_PROFILE_LINEAR_RGB) ? 1 : 0;
                                                        }
+                                                       /* end copy */
 
                                                        last_partial_redraw_cell = last_projIma->partRedrawRect + projPixel->bb_cell_index;
                                                        last_partial_redraw_cell->x1 = MIN2(last_partial_redraw_cell->x1, projPixel->x_px);
index 9b4f3fcdd68ff650ab6e8b48428ffb11b06f61ed..36199b1908d48b4675383d70fd906db7ddb56470 100644 (file)
@@ -1031,7 +1031,7 @@ static void proxy_endjob(void *pjv)
 
 static int clip_rebuild_proxy_exec(bContext *C, wmOperator *UNUSED(op))
 {
-       wmJob * steve;
+       wmJob *wm_job;
        ProxyJob *pj;
        Scene *scene = CTX_data_scene(C);
        ScrArea *sa = CTX_wm_area(C);
@@ -1041,7 +1041,8 @@ static int clip_rebuild_proxy_exec(bContext *C, wmOperator *UNUSED(op))
        if ((clip->flag & MCLIP_USE_PROXY) == 0)
                return OPERATOR_CANCELLED;
 
-       steve = WM_jobs_get(CTX_wm_manager(C), CTX_wm_window(C), sa, "Building Proxies", WM_JOB_PROGRESS);
+       wm_job = WM_jobs_get(CTX_wm_manager(C), CTX_wm_window(C), sa, "Building Proxies",
+                            WM_JOB_PROGRESS, WM_JOB_TYPE_CLIP_BUILD_PROXY);
 
        pj = MEM_callocN(sizeof(ProxyJob), "proxy rebuild job");
        pj->scene = scene;
@@ -1054,12 +1055,12 @@ static int clip_rebuild_proxy_exec(bContext *C, wmOperator *UNUSED(op))
                                        clip->proxy.build_size_flag, clip->proxy.quality);
        }
 
-       WM_jobs_customdata_set(steve, pj, proxy_freejob);
-       WM_jobs_timer(steve, 0.2, NC_MOVIECLIP | ND_DISPLAY, 0);
-       WM_jobs_callbacks(steve, proxy_startjob, NULL, NULL, proxy_endjob);
+       WM_jobs_customdata_set(wm_job, pj, proxy_freejob);
+       WM_jobs_timer(wm_job, 0.2, NC_MOVIECLIP | ND_DISPLAY, 0);
+       WM_jobs_callbacks(wm_job, proxy_startjob, NULL, NULL, proxy_endjob);
 
        G.is_break = FALSE;
-       WM_jobs_start(CTX_wm_manager(C), steve);
+       WM_jobs_start(CTX_wm_manager(C), wm_job);
 
        ED_area_tag_redraw(CTX_wm_area(C));
 
index bf0a6617e2b1c5b3ea2a3163f784d96db1c65e0a..cbf050261521c7d28fc2c5bfe941fb6710c99e9e 100644 (file)
@@ -1235,11 +1235,11 @@ static int track_markers_invoke(bContext *C, wmOperator *op, wmEvent *UNUSED(eve
        ScrArea *sa = CTX_wm_area(C);
        SpaceClip *sc = CTX_wm_space_clip(C);
        MovieClip *clip = ED_space_clip_get_clip(sc);
-       wmJob *steve;
+       wmJob *wm_job;
        int backwards = RNA_boolean_get(op->ptr, "backwards");
        int sequence = RNA_boolean_get(op->ptr, "sequence");
 
-       if (WM_jobs_test(CTX_wm_manager(C), CTX_wm_area(C))) {
+       if (WM_jobs_test(CTX_wm_manager(C), CTX_wm_area(C), WM_JOB_TYPE_ANY)) {
                /* only one tracking is allowed at a time */
                return OPERATOR_CANCELLED;
        }
@@ -1261,23 +1261,24 @@ static int track_markers_invoke(bContext *C, wmOperator *op, wmEvent *UNUSED(eve
        }
 
        /* setup job */
-       steve = WM_jobs_get(CTX_wm_manager(C), CTX_wm_window(C), sa, "Track Markers", WM_JOB_PROGRESS);
-       WM_jobs_customdata_set(steve, tmj, track_markers_freejob);
+       wm_job = WM_jobs_get(CTX_wm_manager(C), CTX_wm_window(C), sa, "Track Markers",
+                            WM_JOB_PROGRESS, WM_JOB_TYPE_CLIP_TRACK_MARKERS);
+       WM_jobs_customdata_set(wm_job, tmj, track_markers_freejob);
 
        /* if there's delay set in tracking job, tracking should happen
         * with fixed FPS. To deal with editor refresh we have to synchronize
         * tracks from job and tracks in clip. Do this in timer callback
         * to prevent threading conflicts. */
        if (tmj->delay > 0)
-               WM_jobs_timer(steve, tmj->delay / 1000.0f, NC_MOVIECLIP | NA_EVALUATED, 0);
+               WM_jobs_timer(wm_job, tmj->delay / 1000.0f, NC_MOVIECLIP | NA_EVALUATED, 0);
        else
-               WM_jobs_timer(steve, 0.2, NC_MOVIECLIP | NA_EVALUATED, 0);
+               WM_jobs_timer(wm_job, 0.2, NC_MOVIECLIP | NA_EVALUATED, 0);
 
-       WM_jobs_callbacks(steve, track_markers_startjob, NULL, track_markers_updatejob, NULL);
+       WM_jobs_callbacks(wm_job, track_markers_startjob, NULL, track_markers_updatejob, NULL);
 
        G.is_break = FALSE;
 
-       WM_jobs_start(CTX_wm_manager(C), steve);
+       WM_jobs_start(CTX_wm_manager(C), wm_job);
        WM_cursor_wait(0);
 
        /* add modal handler for ESC */
@@ -1289,7 +1290,7 @@ static int track_markers_invoke(bContext *C, wmOperator *op, wmEvent *UNUSED(eve
 static int track_markers_modal(bContext *C, wmOperator *UNUSED(op), wmEvent *event)
 {
        /* no running tracking, remove handler and pass through */
-       if (0 == WM_jobs_test(CTX_wm_manager(C), CTX_wm_area(C)))
+       if (0 == WM_jobs_test(CTX_wm_manager(C), CTX_wm_area(C), WM_JOB_TYPE_ANY))
                return OPERATOR_FINISHED | OPERATOR_PASS_THROUGH;
 
        /* running tracking */
@@ -1467,10 +1468,10 @@ static int solve_camera_invoke(bContext *C, wmOperator *op, wmEvent *UNUSED(even
        MovieClip *clip = ED_space_clip_get_clip(sc);
        MovieTracking *tracking = &clip->tracking;
        MovieTrackingReconstruction *reconstruction = BKE_tracking_get_active_reconstruction(tracking);
-       wmJob *steve;
+       wmJob *wm_job;
        char error_msg[256] = "\0";
 
-       if (WM_jobs_test(CTX_wm_manager(C), CTX_wm_area(C))) {
+       if (WM_jobs_test(CTX_wm_manager(C), CTX_wm_area(C), WM_JOB_TYPE_ANY)) {
                /* only one solve is allowed at a time */
                return OPERATOR_CANCELLED;
        }
@@ -1492,14 +1493,15 @@ static int solve_camera_invoke(bContext *C, wmOperator *op, wmEvent *UNUSED(even
        WM_event_add_notifier(C, NC_MOVIECLIP | NA_EVALUATED, clip);
 
        /* setup job */
-       steve = WM_jobs_get(CTX_wm_manager(C), CTX_wm_window(C), sa, "Solve Camera", WM_JOB_PROGRESS);
-       WM_jobs_customdata_set(steve, scj, solve_camera_freejob);
-       WM_jobs_timer(steve, 0.1, NC_MOVIECLIP | NA_EVALUATED, 0);
-       WM_jobs_callbacks(steve, solve_camera_startjob, NULL, solve_camera_updatejob, NULL);
+       wm_job = WM_jobs_get(CTX_wm_manager(C), CTX_wm_window(C), sa, "Solve Camera",
+                            WM_JOB_PROGRESS, WM_JOB_TYPE_CLIP_SOLVE_CAMERA);
+       WM_jobs_customdata_set(wm_job, scj, solve_camera_freejob);
+       WM_jobs_timer(wm_job, 0.1, NC_MOVIECLIP | NA_EVALUATED, 0);
+       WM_jobs_callbacks(wm_job, solve_camera_startjob, NULL, solve_camera_updatejob, NULL);
 
        G.is_break = FALSE;
 
-       WM_jobs_start(CTX_wm_manager(C), steve);
+       WM_jobs_start(CTX_wm_manager(C), wm_job);
        WM_cursor_wait(0);
 
        /* add modal handler for ESC */
@@ -1511,7 +1513,7 @@ static int solve_camera_invoke(bContext *C, wmOperator *op, wmEvent *UNUSED(even
 static int solve_camera_modal(bContext *C, wmOperator *UNUSED(op), wmEvent *event)
 {
        /* no running solver, remove handler and pass through */
-       if (0 == WM_jobs_test(CTX_wm_manager(C), CTX_wm_area(C)))
+       if (0 == WM_jobs_test(CTX_wm_manager(C), CTX_wm_area(C), WM_JOB_TYPE_ANY))
                return OPERATOR_FINISHED | OPERATOR_PASS_THROUGH;
 
        /* running tracking */
index 27db7907e30834e5063cea7c3fa5ed7e45822bf3..337e13f778576a011df36fe3d0552065ca461d10 100644 (file)
@@ -1346,7 +1346,7 @@ static void thumbnails_free(void *tjv)
 
 void thumbnails_start(struct FileList *filelist, const struct bContext *C)
 {
-       wmJob *steve;
+       wmJob *wm_job;
        ThumbnailJob *tj;
        int idx;
        
@@ -1368,13 +1368,14 @@ void thumbnails_start(struct FileList *filelist, const struct bContext *C)
        BKE_reports_init(&tj->reports, RPT_PRINT);
 
        /* setup job */
-       steve = WM_jobs_get(CTX_wm_manager(C), CTX_wm_window(C), filelist, "Thumbnails", 0);
-       WM_jobs_customdata_set(steve, tj, thumbnails_free);
-       WM_jobs_timer(steve, 0.5, NC_WINDOW, NC_WINDOW);
-       WM_jobs_callbacks(steve, thumbnails_startjob, NULL, thumbnails_update, NULL);
+       wm_job = WM_jobs_get(CTX_wm_manager(C), CTX_wm_window(C), filelist, "Thumbnails",
+                            0, WM_JOB_TYPE_FILESEL_THUMBNAIL);
+       WM_jobs_customdata_set(wm_job, tj, thumbnails_free);
+       WM_jobs_timer(wm_job, 0.5, NC_WINDOW, NC_WINDOW);
+       WM_jobs_callbacks(wm_job, thumbnails_startjob, NULL, thumbnails_update, NULL);
 
        /* start the job */
-       WM_jobs_start(CTX_wm_manager(C), steve);
+       WM_jobs_start(CTX_wm_manager(C), wm_job);
 }
 
 void thumbnails_stop(struct FileList *filelist, const struct bContext *C)
@@ -1384,5 +1385,5 @@ void thumbnails_stop(struct FileList *filelist, const struct bContext *C)
 
 int thumbnails_running(struct FileList *filelist, const struct bContext *C)
 {
-       return WM_jobs_test(CTX_wm_manager(C), filelist);
+       return WM_jobs_test(CTX_wm_manager(C), filelist, WM_JOB_TYPE_FILESEL_THUMBNAIL);
 }
index c1d416fb219471e93b38a3b92da227e7b7c48e8e..cde7e494927766c2c74e989ba92737d14c3dd6d2 100644 (file)
@@ -1525,11 +1525,11 @@ static void node_composit_buts_blur(uiLayout *layout, bContext *UNUSED(C), Point
        
        col = uiLayoutColumn(layout, FALSE);
        filter = RNA_enum_get(ptr, "filter_type");
-       reference = RNA_boolean_get(ptr, "use_reference");
+       reference = RNA_boolean_get(ptr, "use_variable_size");
 
        uiItemR(col, ptr, "filter_type", 0, "", ICON_NONE);
        if (filter != R_FILTER_FAST_GAUSS) {
-               uiItemR(col, ptr, "use_reference", 0, NULL, ICON_NONE);
+               uiItemR(col, ptr, "use_variable_size", 0, NULL, ICON_NONE);
                if (!reference) {
                        uiItemR(col, ptr, "use_bokeh", 0, NULL, ICON_NONE);
                }
@@ -2356,6 +2356,13 @@ static void node_composit_buts_bokehimage(uiLayout *layout, bContext *UNUSED(C),
        uiItemR(layout, ptr, "shift", UI_ITEM_R_SLIDER, NULL, ICON_NONE);
 }
 
+static void node_composit_buts_bokehblur(uiLayout *layout, bContext *UNUSED(C), PointerRNA *ptr)
+{
+       uiItemR(layout, ptr, "use_variable_size", 0, NULL, ICON_NONE);
+       // uiItemR(layout, ptr, "f_stop", 0, NULL, ICON_NONE);  // UNUSED
+       uiItemR(layout, ptr, "blur_max", 0, NULL, ICON_NONE);
+}
+
 void node_composit_backdrop_viewer(SpaceNode *snode, ImBuf *backdrop, bNode *node, int x, int y)
 {
 //     node_composit_backdrop_canvas(snode, backdrop, node, x, y);
@@ -2769,6 +2776,9 @@ static void node_composit_set_butfunc(bNodeType *ntype)
                case CMP_NODE_BOKEHIMAGE:
                        ntype->uifunc = node_composit_buts_bokehimage;
                        break;
+               case CMP_NODE_BOKEHBLUR:
+                       ntype->uifunc = node_composit_buts_bokehblur;
+                       break;
                case CMP_NODE_VIEWER:
                        ntype->uifunc = NULL;
                        ntype->uifuncbut = node_composit_buts_viewer_but;
index 60375e9ab029001ce6e99f06240b50e97e2b50b4..d34c5f16afaae2f17d427bd546b74cc8aabcf671 100644 (file)
@@ -173,7 +173,7 @@ static void compo_startjob(void *cjv, short *stop, short *do_update, float *prog
  */
 void ED_node_composite_job(const bContext *C, struct bNodeTree *nodetree, Scene *scene_owner)
 {
-       wmJob *steve;
+       wmJob *wm_job;
        CompoJob *cj;
 
        /* to fix bug: [#32272] */
@@ -181,7 +181,8 @@ void ED_node_composite_job(const bContext *C, struct bNodeTree *nodetree, Scene
                return;
        }
 
-       steve = WM_jobs_get(CTX_wm_manager(C), CTX_wm_window(C), scene_owner, "Compositing", WM_JOB_EXCL_RENDER | WM_JOB_PROGRESS);
+       wm_job = WM_jobs_get(CTX_wm_manager(C), CTX_wm_window(C), scene_owner, "Compositing",
+                            WM_JOB_EXCL_RENDER | WM_JOB_PROGRESS, WM_JOB_TYPE_COMPOSITE);
        cj = MEM_callocN(sizeof(CompoJob), "compo job");
 
        /* customdata for preview thread */
@@ -189,11 +190,11 @@ void ED_node_composite_job(const bContext *C, struct bNodeTree *nodetree, Scene
        cj->ntree = nodetree;
 
        /* setup job */
-       WM_jobs_customdata_set(steve, cj, compo_freejob);
-       WM_jobs_timer(steve, 0.1, NC_SCENE, NC_SCENE | ND_COMPO_RESULT);
-       WM_jobs_callbacks(steve, compo_startjob, compo_initjob, compo_updatejob, NULL);
+       WM_jobs_customdata_set(wm_job, cj, compo_freejob);
+       WM_jobs_timer(wm_job, 0.1, NC_SCENE, NC_SCENE | ND_COMPO_RESULT);
+       WM_jobs_callbacks(wm_job, compo_startjob, compo_initjob, compo_updatejob, NULL);
 
-       WM_jobs_start(CTX_wm_manager(C), steve);
+       WM_jobs_start(CTX_wm_manager(C), wm_job);
 }
 
 /* ***************************************** */
index 9e730fff940f725dc3934f550b023e6bf2432207..5bb3f71013324465389679c75dc5ce72f2eaa731 100644 (file)
@@ -177,7 +177,7 @@ static void proxy_endjob(void *pjv)
 
 static void seq_proxy_build_job(const bContext *C)
 {
-       wmJob *steve;
+       wmJob *wm_job;
        ProxyJob *pj;
        Scene *scene = CTX_data_scene(C);
        Editing *ed = BKE_sequencer_editing_get(scene, FALSE);
@@ -186,9 +186,10 @@ static void seq_proxy_build_job(const bContext *C)
        LinkData *link;
        Sequence *seq;
 
-       steve = WM_jobs_get(CTX_wm_manager(C), CTX_wm_window(C), sa, "Building Proxies", WM_JOB_PROGRESS);
+       wm_job = WM_jobs_get(CTX_wm_manager(C), CTX_wm_window(C), sa, "Building Proxies",
+                            WM_JOB_PROGRESS, WM_JOB_TYPE_SEQ_BUILD_PROXY);
 
-       pj = WM_jobs_customdata_get(steve);
+       pj = WM_jobs_customdata_get(wm_job);
 
        if (!pj) {
                pj = MEM_callocN(sizeof(ProxyJob), "proxy rebuild job");
@@ -196,9 +197,9 @@ static void seq_proxy_build_job(const bContext *C)
                pj->scene = scene;
                pj->main = CTX_data_main(C);
 
-               WM_jobs_customdata_set(steve, pj, proxy_freejob);
-               WM_jobs_timer(steve, 0.1, NC_SCENE | ND_SEQUENCER, NC_SCENE | ND_SEQUENCER);
-               WM_jobs_callbacks(steve, proxy_startjob, NULL, NULL, proxy_endjob);
+               WM_jobs_customdata_set(wm_job, pj, proxy_freejob);
+               WM_jobs_timer(wm_job, 0.1, NC_SCENE | ND_SEQUENCER, NC_SCENE | ND_SEQUENCER);
+               WM_jobs_callbacks(wm_job, proxy_startjob, NULL, NULL, proxy_endjob);
        }
 
        SEQP_BEGIN (ed, seq)
@@ -211,9 +212,9 @@ static void seq_proxy_build_job(const bContext *C)
        }
        SEQ_END
 
-       if (!WM_jobs_is_running(steve)) {
+       if (!WM_jobs_is_running(wm_job)) {
                G.is_break = FALSE;
-               WM_jobs_start(CTX_wm_manager(C), steve);
+               WM_jobs_start(CTX_wm_manager(C), wm_job);
        }
 
        ED_area_tag_redraw(CTX_wm_area(C));
index 112f41278b774c8b4c0661b06166f8a7fc0ba3df..5069c4219c3934a4d0e8f79f2f0a296a3a753019 100644 (file)
@@ -344,6 +344,7 @@ static void draw_textured_begin(Scene *scene, View3D *v3d, RegionView3D *rv3d, O
 {
        unsigned char obcol[4];
        int is_tex, solidtex;
+       Mesh *me = ob->data;
 
        /* XXX scene->obedit warning */
 
@@ -366,7 +367,6 @@ static void draw_textured_begin(Scene *scene, View3D *v3d, RegionView3D *rv3d, O
        
        rgba_float_to_uchar(obcol, ob->col);
 
-       glCullFace(GL_BACK); glEnable(GL_CULL_FACE);
        if (solidtex || v3d->drawtype == OB_TEXTURE) is_tex = 1;
        else is_tex = 0;
 
@@ -376,6 +376,14 @@ static void draw_textured_begin(Scene *scene, View3D *v3d, RegionView3D *rv3d, O
        memcpy(Gtexdraw.obcol, obcol, sizeof(obcol));
        set_draw_settings_cached(1, NULL, NULL, Gtexdraw);
        glShadeModel(GL_SMOOTH);
+       if (v3d->flag2 & V3D_BACKFACE_CULLING) {
+               glEnable(GL_CULL_FACE);
+               glCullFace(GL_BACK);
+       }
+       else {          
+               glDisable(GL_CULL_FACE);
+       }
+       glLightModeli(GL_LIGHT_MODEL_TWO_SIDE, (me->flag & ME_TWOSIDED) ? GL_TRUE : GL_FALSE);
 }
 
 static void draw_textured_end(void)
index 65b921688423da6d51bc7713182b7c0cfdfb301f..4213ff68cf2d259cff1090e24ceedcae3fc472b6 100644 (file)
@@ -129,7 +129,7 @@ static int ed_undo_step(bContext *C, int step, const char *undoname)
 
        /* undo during jobs are running can easily lead to freeing data using by jobs,
         * or they can just lead to freezing job in some other cases */
-       if (WM_jobs_test(CTX_wm_manager(C), CTX_data_scene(C))) {
+       if (WM_jobs_test(CTX_wm_manager(C), CTX_data_scene(C), WM_JOB_TYPE_ANY)) {
                return OPERATOR_CANCELLED;
        }
 
@@ -359,7 +359,7 @@ int ED_undo_operator_repeat(bContext *C, struct wmOperator *op)
                      * (which copy their data), wont stop redo, see [#29579]],
                      *
                      * note, - WM_operator_check_ui_enabled() jobs test _must_ stay in sync with this */
-                    (WM_jobs_test(wm, scene) == 0))
+                    (WM_jobs_test(wm, scene, WM_JOB_TYPE_ANY) == 0))
                {
                        int retval;
 
index 54c1b1bb77322fe3f87cabdc211063e00f77d5d5..541593aa8107ef78bbbebf592554d846d6266f80 100644 (file)
@@ -127,7 +127,7 @@ typedef struct bNodeSocket {
 /* sock->flag, first bit is select */
        /* hidden is user defined, to hide unused */
 #define SOCK_HIDDEN                            2
-       /* only used now for groups... */
+       /* for quick check if socket is linked */
 #define SOCK_IN_USE                            4       /* XXX deprecated */
        /* unavailable is for dynamic sockets */
 #define SOCK_UNAVAIL                   8
@@ -389,7 +389,7 @@ enum {
 };
 
 enum {
-       CMP_NODEFLAG_BLUR_REFERENCE = (1 << 0),
+       CMP_NODEFLAG_BLUR_VARIABLE_SIZE = (1 << 0)
 };
 
 typedef struct NodeFrame {
@@ -399,8 +399,11 @@ typedef struct NodeFrame {
 
 /* this one has been replaced with ImageUser, keep it for do_versions() */
 typedef struct NodeImageAnim {
-       int frames, sfra, nr;
-       char cyclic, movie;
+       int frames   DNA_DEPRECATED;
+       int sfra     DNA_DEPRECATED;
+       int nr       DNA_DEPRECATED;
+       char cyclic  DNA_DEPRECATED;
+       char movie   DNA_DEPRECATED;
        short pad;
 } NodeImageAnim;
 
index bcd1b0e610b232443757f1c1cd18a0ec12a6d5d9..667d85706e05d4303287ddd34dfd0df0de0a28db 100644 (file)
@@ -324,6 +324,20 @@ static char *rna_NodeSocket_path(PointerRNA *ptr)
        return NULL;
 }
 
+static void rna_NodeSocket_hide_set(PointerRNA *ptr, int value)
+{
+       bNodeSocket *sock = (bNodeSocket *)ptr->data;
+       
+       /* don't hide linked sockets */
+       if (sock->flag & SOCK_IN_USE)
+               return;
+       
+       if (value)
+               sock->flag |= SOCK_HIDDEN;
+       else
+               sock->flag &= ~SOCK_HIDDEN;
+}
+
 /* Button Set Funcs for Matte Nodes */
 static void rna_Matte_t1_set(PointerRNA *ptr, float value)
 {
@@ -1741,9 +1755,10 @@ static void def_cmp_blur(StructRNA *srna)
                {0, NULL, 0, NULL, NULL}
        };
 
-       prop = RNA_def_property(srna, "use_reference", PROP_BOOLEAN, PROP_NONE);
-       RNA_def_property_boolean_sdna(prop, NULL, "custom1", CMP_NODEFLAG_BLUR_REFERENCE);
-       RNA_def_property_ui_text(prop, "Reference", "Use size socket as a reference image");
+       /* duplicated in def_cmp_bokehblur */
+       prop = RNA_def_property(srna, "use_variable_size", PROP_BOOLEAN, PROP_NONE);
+       RNA_def_property_boolean_sdna(prop, NULL, "custom1", CMP_NODEFLAG_BLUR_VARIABLE_SIZE);
+       RNA_def_property_ui_text(prop, "Variable Size", "Support variable blue per-pixel when using an image for size input");
        RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
 
        RNA_def_struct_sdna_from(srna, "NodeBlurData", "storage");
@@ -3372,6 +3387,14 @@ static void def_cmp_ellipsemask(StructRNA *srna)
 static void def_cmp_bokehblur(StructRNA *srna)
 {
        PropertyRNA *prop;
+
+       /* duplicated in def_cmp_blur */
+       prop = RNA_def_property(srna, "use_variable_size", PROP_BOOLEAN, PROP_NONE);
+       RNA_def_property_boolean_sdna(prop, NULL, "custom1", CMP_NODEFLAG_BLUR_VARIABLE_SIZE);
+       RNA_def_property_ui_text(prop, "Variable Size", "Support variable blue per-pixel when using an image for size input");
+       RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
+
+#if 0
        prop = RNA_def_property(srna, "f_stop", PROP_FLOAT, PROP_NONE);
        RNA_def_property_float_sdna(prop, NULL, "custom3");
        RNA_def_property_range(prop, 0.0f, 128.0f);
@@ -3379,7 +3402,8 @@ static void def_cmp_bokehblur(StructRNA *srna)
                                 "Amount of focal blur, 128=infinity=perfect focus, half the value doubles "
                                 "the blur radius");
        RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
-       
+#endif
+
        prop = RNA_def_property(srna, "blur_max", PROP_FLOAT, PROP_NONE);
        RNA_def_property_float_sdna(prop, NULL, "custom4");
        RNA_def_property_range(prop, 0.0f, 10000.0f);
@@ -4114,6 +4138,17 @@ static void rna_def_node_socket(BlenderRNA *brna)
        RNA_def_property_ui_text(prop, "Group Socket",
                                 "For group nodes, the group input or output socket this corresponds to");
 
+       prop = RNA_def_property(srna, "hide", PROP_BOOLEAN, PROP_NONE);
+       RNA_def_property_boolean_sdna(prop, NULL, "flag", SOCK_HIDDEN);
+       RNA_def_property_boolean_funcs(prop, NULL, "rna_NodeSocket_hide_set");
+       RNA_def_property_ui_text(prop, "Hide", "Hide the socket");
+       RNA_def_property_update(prop, NC_NODE | NA_EDITED, NULL);
+
+       prop = RNA_def_property(srna, "is_linked", PROP_BOOLEAN, PROP_NONE);
+       RNA_def_property_boolean_sdna(prop, NULL, "flag", SOCK_IN_USE);
+       RNA_def_property_clear_flag(prop, PROP_EDITABLE);
+       RNA_def_property_ui_text(prop, "Linked", "True if the socket is connected");
+
        prop = RNA_def_property(srna, "show_expanded", PROP_BOOLEAN, PROP_NONE);
        RNA_def_property_boolean_negative_sdna(prop, NULL, "flag", SOCK_COLLAPSED);
        RNA_def_property_ui_text(prop, "Expanded", "Socket links are expanded in the user interface");
index 01592d63bb2ed950a1a04f0f903af646b8748002..21cbc2b766ceba4f9fbab722e7fcb7dc264a0440 100644 (file)
@@ -140,8 +140,7 @@ static void foreachTexLink(ModifierData *md, Object *ob,
 static int isDisabled(ModifierData *md, int UNUSED(useRenderParams))
 {
        DisplaceModifierData *dmd = (DisplaceModifierData *) md;
-
-       return (!dmd->texture || dmd->strength == 0.0f);
+       return ((!dmd->texture && dmd->direction == MOD_DISP_DIR_RGB_XYZ) || dmd->strength == 0.0f);
 }
 
 static void updateDepgraph(ModifierData *md, DagForest *forest,
@@ -176,8 +175,9 @@ static void displaceModifier_do(
        int defgrp_index;
        float (*tex_co)[3];
        float weight = 1.0f; /* init value unused but some compilers may complain */
+       const float delta_fixed = 1.0f - dmd->midlevel;  /* when no texture is used, we fallback to white */
 
-       if (!dmd->texture) return;
+       if (!dmd->texture && dmd->direction == MOD_DISP_DIR_RGB_XYZ) return;
        if (dmd->strength == 0.0f) return;
 
        mvert = CDDM_get_verts(dm);
@@ -191,17 +191,22 @@ static void displaceModifier_do(
 
        for (i = 0; i < numVerts; i++) {
                TexResult texres;
-               float delta = 0, strength = dmd->strength;
+               float strength = dmd->strength;
+               float delta;
 
                if (dvert) {
                        weight = defvert_find_weight(dvert + i, defgrp_index);
                        if (weight == 0.0f) continue;
                }
 
-               texres.nor = NULL;
-               get_texture_value(dmd->texture, tex_co[i], &texres);
-
-               delta = texres.tin - dmd->midlevel;
+               if (dmd->texture) {
+                       texres.nor = NULL;
+                       get_texture_value(dmd->texture, tex_co[i], &texres);
+                       delta = texres.tin - dmd->midlevel;
+               }
+               else {
+                       delta = delta_fixed;  /* (1.0f - dmd->midlevel) */  /* never changes */
+               }
 
                if (dvert) strength *= weight;
 
index 584790b4cdae80b1178dcb78e65b9ec806372e95..588be336afaf97928bdb61702fb2d4ddd93f5dc3 100644 (file)
@@ -301,14 +301,35 @@ void              WM_framebuffer_index_set(int index);
 int                    WM_framebuffer_to_index(unsigned int col);
 
                        /* threaded Jobs Manager */
-#define WM_JOB_PRIORITY                1
-#define WM_JOB_EXCL_RENDER     2
-#define WM_JOB_PROGRESS                4
-#define WM_JOB_SUSPEND         8
-
-struct wmJob *WM_jobs_get(struct wmWindowManager *wm, struct wmWindow *win, void *owner, const char *name, int flag);
-
-int                    WM_jobs_test(struct wmWindowManager *wm, void *owner);
+enum {
+       WM_JOB_PRIORITY     = (1 << 0),
+       WM_JOB_EXCL_RENDER  = (1 << 1),
+       WM_JOB_PROGRESS     = (1 << 2),
+       WM_JOB_SUSPEND      = (1 << 3)
+};
+
+/* identifying jobs by owner alone is unreliable, this isnt saved, order can change */
+enum {
+       WM_JOB_TYPE_ANY = -1,
+       WM_JOB_TYPE_COMPOSITE,
+       WM_JOB_TYPE_RENDER,
+       WM_JOB_TYPE_RENDER_PREVIEW,  /* UI preview */
+       WM_JOB_TYPE_SCREENCAST,
+       WM_JOB_TYPE_OBJECT_SIM_OCEAN,
+       WM_JOB_TYPE_OBJECT_SIM_FLUID,
+       WM_JOB_TYPE_OBJECT_BAKE_TEXTURE,
+       WM_JOB_TYPE_FILESEL_THUMBNAIL,
+       WM_JOB_TYPE_CLIP_BUILD_PROXY,
+       WM_JOB_TYPE_CLIP_TRACK_MARKERS,
+       WM_JOB_TYPE_CLIP_SOLVE_CAMERA,
+       WM_JOB_TYPE_SEQ_BUILD_PROXY,
+       /* add as needed, screencast, seq proxy build
+        * if having hard coded values is a problem */
+};
+
+struct wmJob *WM_jobs_get(struct wmWindowManager *wm, struct wmWindow *win, void *owner, const char *name, int flag, int job_type);
+
+int                    WM_jobs_test(struct wmWindowManager *wm, void *owner, int job_type);
 float          WM_jobs_progress(struct wmWindowManager *wm, void *owner);
 char       *WM_jobs_name(struct wmWindowManager *wm, void *owner);
 
index 337c8937de8d8fe229941356a7afc079f3b17859..a892b1c686144697d932f474eefbb7da892840f0 100644 (file)
@@ -368,7 +368,7 @@ static void wait_for_console_key(void)
 /* note, doesnt run exit() call WM_exit() for that */
 void WM_exit_ext(bContext *C, const short do_python)
 {
-       wmWindow *win;
+       wmWindowManager *wm = C ? CTX_wm_manager(C) : NULL;
 
        sound_exit();
 
@@ -377,11 +377,12 @@ void WM_exit_ext(bContext *C, const short do_python)
        /* first wrap up running stuff, we assume only the active WM is running */
        /* modal handlers are on window level freed, others too? */
        /* note; same code copied in wm_files.c */
-       if (C && CTX_wm_manager(C)) {
-               
-               WM_jobs_stop_all(CTX_wm_manager(C));
-               
-               for (win = CTX_wm_manager(C)->windows.first; win; win = win->next) {
+       if (C && wm) {
+               wmWindow *win;
+
+               WM_jobs_stop_all(wm);
+
+               for (win = wm->windows.first; win; win = win->next) {
                        
                        CTX_wm_window_set(C, win);  /* needed by operator close callbacks */
                        WM_event_remove_handlers(C, &win->handlers);
@@ -410,7 +411,7 @@ void WM_exit_ext(bContext *C, const short do_python)
        
        ED_preview_free_dbase();  /* frees a Main dbase, before free_blender! */
 
-       if (C && CTX_wm_manager(C))
+       if (C && wm)
                wm_free_reports(C);  /* before free_blender! - since the ListBases get freed there */
 
        BKE_sequencer_free_clipboard(); /* sequencer.c */
index ce0c7e134544c45666624caa49a31466f3f6a9c3..e3d6b0f73e1c8455c257670bb11fc8c5af898a92 100644 (file)
@@ -114,7 +114,7 @@ struct wmJob {
 /* internal */
        void *owner;
        int flag;
-       short suspended, running, ready, do_update, stop;
+       short suspended, running, ready, do_update, stop, job_type;
        float progress;
 
        /* for display in header, identification */
@@ -136,13 +136,13 @@ struct wmJob {
  */
 static wmJob *wm_job_find(wmWindowManager *wm, void *owner, const char *name)
 {
-       wmJob *steve, *found = NULL;
+       wmJob *wm_job, *found = NULL;
        
-       for (steve = wm->jobs.first; steve; steve = steve->next)
-               if (steve->owner == owner) {
-                       found = steve;
-                       if (name && strcmp(steve->name, name) == 0)
-                               return steve;
+       for (wm_job = wm->jobs.first; wm_job; wm_job = wm_job->next)
+               if (wm_job->owner == owner) {
+                       found = wm_job;
+                       if (name && strcmp(wm_job->name, name) == 0)
+                               return wm_job;
                }
        
        return found;
@@ -153,112 +153,118 @@ static wmJob *wm_job_find(wmWindowManager *wm, void *owner, const char *name)
 /* returns current or adds new job, but doesnt run it */
 /* every owner only gets a single job, adding a new one will stop running stop and 
  * when stopped it starts the new one */
-wmJob *WM_jobs_get(wmWindowManager *wm, wmWindow *win, void *owner, const char *name, int flag)
+wmJob *WM_jobs_get(wmWindowManager *wm, wmWindow *win, void *owner, const char *name, int flag, int job_type)
 {
-       wmJob *steve = wm_job_find(wm, owner, name);
+       wmJob *wm_job = wm_job_find(wm, owner, name);
        
-       if (steve == NULL) {
-               steve = MEM_callocN(sizeof(wmJob), "new job");
+       if (wm_job == NULL) {
+               wm_job = MEM_callocN(sizeof(wmJob), "new job");
        
-               BLI_addtail(&wm->jobs, steve);
-               steve->win = win;
-               steve->owner = owner;
-               steve->flag = flag;
-               BLI_strncpy(steve->name, name, sizeof(steve->name));
+               BLI_addtail(&wm->jobs, wm_job);
+               wm_job->win = win;
+               wm_job->owner = owner;
+               wm_job->flag = flag;
+               wm_job->job_type = job_type;
+               BLI_strncpy(wm_job->name, name, sizeof(wm_job->name));
        }
        
-       return steve;
+       return wm_job;
 }
 
 /* returns true if job runs, for UI (progress) indicators */
-int WM_jobs_test(wmWindowManager *wm, void *owner)
+int WM_jobs_test(wmWindowManager *wm, void *owner, int job_type)
 {
-       wmJob *steve;
+       wmJob *wm_job;
        
        /* job can be running or about to run (suspended) */
-       for (steve = wm->jobs.first; steve; steve = steve->next)
-               if (steve->owner == owner)
-                       if (steve->running || steve->suspended)
-                               return 1;
+       for (wm_job = wm->jobs.first; wm_job; wm_job = wm_job->next) {
+               if (wm_job->owner == owner) {
+                       if (job_type == WM_JOB_TYPE_ANY || (wm_job->job_type == job_type)) {
+                               if (wm_job->running || wm_job->suspended) {
+                                       return TRUE;
+                               }
+                       }
+               }
+       }
 
-       return 0;
+       return FALSE;
 }
 
 float WM_jobs_progress(wmWindowManager *wm, void *owner)
 {
-       wmJob *steve = wm_job_find(wm, owner, NULL);
+       wmJob *wm_job = wm_job_find(wm, owner, NULL);
        
-       if (steve && steve->flag & WM_JOB_PROGRESS)
-               return steve->progress;
+       if (wm_job && wm_job->flag & WM_JOB_PROGRESS)
+               return wm_job->progress;
        
        return 0.0;
 }
 
 char *WM_jobs_name(wmWindowManager *wm, void *owner)
 {
-       wmJob *steve = wm_job_find(wm, owner, NULL);
+       wmJob *wm_job = wm_job_find(wm, owner, NULL);
        
-       if (steve)
-               return steve->name;
+       if (wm_job)
+               return wm_job->name;
        
        return NULL;
 }
 
-int WM_jobs_is_running(wmJob *steve)
+int WM_jobs_is_running(wmJob *wm_job)
 {
-       return steve->running;
+       return wm_job->running;
 }
 
-void *WM_jobs_customdata_get(wmJob *steve)
+void *WM_jobs_customdata_get(wmJob *wm_job)
 {
-       if (!steve->customdata) {
-               return steve->run_customdata;
+       if (!wm_job->customdata) {
+               return wm_job->run_customdata;
        }
        else {
-               return steve->customdata;
+               return wm_job->customdata;
        }
 }
 
-void WM_jobs_customdata_set(wmJob *steve, void *customdata, void (*free)(void *))
+void WM_jobs_customdata_set(wmJob *wm_job, void *customdata, void (*free)(void *))
 {
        /* pending job? just free */
-       if (steve->customdata)
-               steve->free(steve->customdata);
+       if (wm_job->customdata)
+               wm_job->free(wm_job->customdata);
        
-       steve->customdata = customdata;
-       steve->free = free;
+       wm_job->customdata = customdata;
+       wm_job->free = free;
 
-       if (steve->running) {
+       if (wm_job->running) {
                /* signal job to end */
-               steve->stop = 1;
+               wm_job->stop = TRUE;
        }
 }
 
-void WM_jobs_timer(wmJob *steve, double timestep, unsigned int note, unsigned int endnote)
+void WM_jobs_timer(wmJob *wm_job, double timestep, unsigned int note, unsigned int endnote)
 {
-       steve->timestep = timestep;
-       steve->note = note;
-       steve->endnote = endnote;
+       wm_job->timestep = timestep;
+       wm_job->note = note;
+       wm_job->endnote = endnote;
 }
 
-void WM_jobs_callbacks(wmJob *steve, 
+void WM_jobs_callbacks(wmJob *wm_job,
                        void (*startjob)(void *, short *, short *, float *),
                        void (*initjob)(void *),
                        void (*update)(void *),
                        void (*endjob)(void *))
 {
-       steve->startjob = startjob;
-       steve->initjob = initjob;
-       steve->update = update;
-       steve->endjob = endjob;
+       wm_job->startjob = startjob;
+       wm_job->initjob = initjob;
+       wm_job->update = update;
+       wm_job->endjob = endjob;
 }
 
 static void *do_job_thread(void *job_v)
 {
-       wmJob *steve = job_v;
+       wmJob *wm_job = job_v;
        
-       steve->startjob(steve->run_customdata, &steve->stop, &steve->do_update, &steve->progress);
-       steve->ready = 1;
+       wm_job->startjob(wm_job->run_customdata, &wm_job->stop, &wm_job->do_update, &wm_job->progress);
+       wm_job->ready = TRUE;
        
        return NULL;
 }
@@ -266,36 +272,38 @@ static void *do_job_thread(void *job_v)
 /* don't allow same startjob to be executed twice */
 static void wm_jobs_test_suspend_stop(wmWindowManager *wm, wmJob *test)
 {
-       wmJob *steve;
-       int suspend = 0;
+       wmJob *wm_job;
+       int suspend = FALSE;
        
        /* job added with suspend flag, we wait 1 timer step before activating it */
        if (test->flag & WM_JOB_SUSPEND) {
-               suspend = 1;
+               suspend = TRUE;
                test->flag &= ~WM_JOB_SUSPEND;
        }
        else {
                /* check other jobs */
-               for (steve = wm->jobs.first; steve; steve = steve->next) {
+               for (wm_job = wm->jobs.first; wm_job; wm_job = wm_job->next) {
                        /* obvious case, no test needed */
-                       if (steve == test || !steve->running) continue;
+                       if (wm_job == test || !wm_job->running) {
+                               continue;
+                       }
                        
                        /* if new job is not render, then check for same startjob */
                        if (0 == (test->flag & WM_JOB_EXCL_RENDER))
-                               if (steve->startjob != test->startjob)
+                               if (wm_job->startjob != test->startjob)
                                        continue;
                        
                        /* if new job is render, any render job should be stopped */
                        if (test->flag & WM_JOB_EXCL_RENDER)
-                               if (0 == (steve->flag & WM_JOB_EXCL_RENDER))
+                               if (0 == (wm_job->flag & WM_JOB_EXCL_RENDER))
                                        continue;
 
-                       suspend = 1;
+                       suspend = TRUE;
 
                        /* if this job has higher priority, stop others */
                        if (test->flag & WM_JOB_PRIORITY) {
-                               steve->stop = 1;
-                               // printf("job stopped: %s\n", steve->name);
+                               wm_job->stop = TRUE;
+                               // printf("job stopped: %s\n", wm_job->name);
                        }
                }
        }
@@ -307,110 +315,113 @@ static void wm_jobs_test_suspend_stop(wmWindowManager *wm, wmJob *test)
 
 /* if job running, the same owner gave it a new job */
 /* if different owner starts existing startjob, it suspends itself */
-void WM_jobs_start(wmWindowManager *wm, wmJob *steve)
+void WM_jobs_start(wmWindowManager *wm, wmJob *wm_job)
 {
-       if (steve->running) {
+       if (wm_job->running) {
                /* signal job to end and restart */
-               steve->stop = 1;
-               // printf("job started a running job, ending... %s\n", steve->name);
+               wm_job->stop = TRUE;
+               // printf("job started a running job, ending... %s\n", wm_job->name);
        }
        else {
                
-               if (steve->customdata && steve->startjob) {
+               if (wm_job->customdata && wm_job->startjob) {
                        
-                       wm_jobs_test_suspend_stop(wm, steve);
+                       wm_jobs_test_suspend_stop(wm, wm_job);
                        
-                       if (steve->suspended == 0) {
+                       if (wm_job->suspended == FALSE) {
                                /* copy to ensure proper free in end */
-                               steve->run_customdata = steve->customdata;
-                               steve->run_free = steve->free;
-                               steve->free = NULL;
-                               steve->customdata = NULL;
-                               steve->running = 1;
+                               wm_job->run_customdata = wm_job->customdata;
+                               wm_job->run_free = wm_job->free;
+                               wm_job->free = NULL;
+                               wm_job->customdata = NULL;
+                               wm_job->running = TRUE;
                                
-                               if (steve->initjob)
-                                       steve->initjob(steve->run_customdata);
+                               if (wm_job->initjob)
+                                       wm_job->initjob(wm_job->run_customdata);
                                
-                               steve->stop = 0;
-                               steve->ready = 0;
-                               steve->progress = 0.0;
+                               wm_job->stop = FALSE;
+                               wm_job->ready = FALSE;
+                               wm_job->progress = 0.0;
 
-                               // printf("job started: %s\n", steve->name);
+                               // printf("job started: %s\n", wm_job->name);
                                
-                               BLI_init_threads(&steve->threads, do_job_thread, 1);
-                               BLI_insert_thread(&steve->threads, steve);
+                               BLI_init_threads(&wm_job->threads, do_job_thread, 1);
+                               BLI_insert_thread(&wm_job->threads, wm_job);
                        }
                        
                        /* restarted job has timer already */
-                       if (steve->wt == NULL)
-                               steve->wt = WM_event_add_timer(wm, steve->win, TIMERJOBS, steve->timestep);
+                       if (wm_job->wt == NULL)
+                               wm_job->wt = WM_event_add_timer(wm, wm_job->win, TIMERJOBS, wm_job->timestep);
 
                        if (G.debug & G_DEBUG_JOBS)
-                               steve->start_time = PIL_check_seconds_timer();
+                               wm_job->start_time = PIL_check_seconds_timer();
                }
                else printf("job fails, not initialized\n");
        }
 }
 
 /* stop job, free data completely */
-static void wm_jobs_kill_job(wmWindowManager *wm, wmJob *steve)
+static void wm_jobs_kill_job(wmWindowManager *wm, wmJob *wm_job)
 {
-       if (steve->running) {
+       if (wm_job->running) {
                /* signal job to end */
-               steve->stop = 1;
-               BLI_end_threads(&steve->threads);
+               wm_job->stop = TRUE;
+               BLI_end_threads(&wm_job->threads);
 
-               if (steve->endjob)
-                       steve->endjob(steve->run_customdata);
+               if (wm_job->endjob)
+                       wm_job->endjob(wm_job->run_customdata);
        }
        
-       if (steve->wt)
-               WM_event_remove_timer(wm, steve->win, steve->wt);
-       if (steve->customdata)
-               steve->free(steve->customdata);
-       if (steve->run_customdata)
-               steve->run_free(steve->run_customdata);
+       if (wm_job->wt)
+               WM_event_remove_timer(wm, wm_job->win, wm_job->wt);
+       if (wm_job->customdata)
+               wm_job->free(wm_job->customdata);
+       if (wm_job->run_customdata)
+               wm_job->run_free(wm_job->run_customdata);
        
-       /* remove steve */
-       BLI_remlink(&wm->jobs, steve);
-       MEM_freeN(steve);
+       /* remove wm_job */
+       BLI_remlink(&wm->jobs, wm_job);
+       MEM_freeN(wm_job);
        
 }
 
 void WM_jobs_stop_all(wmWindowManager *wm)
 {
-       wmJob *steve;
+       wmJob *wm_job;
        
-       while ((steve = wm->jobs.first))
-               wm_jobs_kill_job(wm, steve);
+       while ((wm_job = wm->jobs.first))
+               wm_jobs_kill_job(wm, wm_job);
        
 }
 
 /* signal job(s) from this owner or callback to stop, timer is required to get handled */
 void WM_jobs_stop(wmWindowManager *wm, void *owner, void *startjob)
 {
-       wmJob *steve;
+       wmJob *wm_job;
        
-       for (steve = wm->jobs.first; steve; steve = steve->next)
-               if (steve->owner == owner || steve->startjob == startjob)
-                       if (steve->running)
-                               steve->stop = 1;
+       for (wm_job = wm->jobs.first; wm_job; wm_job = wm_job->next) {
+               if (wm_job->owner == owner || wm_job->startjob == startjob) {
+                       if (wm_job->running) {
+                               wm_job->stop = TRUE;
+                       }
+               }
+       }
 }
 
 /* actually terminate thread and job timer */
 void WM_jobs_kill(wmWindowManager *wm, void *owner, void (*startjob)(void *, short int *, short int *, float *))
 {
-       wmJob *steve;
+       wmJob *wm_job;
        
-       steve = wm->jobs.first;
-       while (steve) {
-               if (steve->owner == owner || steve->startjob == startjob) {
-                       wmJob *bill = steve;
-                       steve = steve->next;
+       wm_job = wm->jobs.first;
+       while (wm_job) {
+               if (wm_job->owner == owner || wm_job->startjob == startjob) {
+                       wmJob *bill = wm_job;
+                       wm_job = wm_job->next;
                        wm_jobs_kill_job(wm, bill);
                }
                else {
-                       steve = steve->next;
+                       wm_job = wm_job->next;
                }
        }
 }
@@ -419,11 +430,11 @@ void WM_jobs_kill(wmWindowManager *wm, void *owner, void (*startjob)(void *, sho
 /* kill job entirely, also removes timer itself */
 void wm_jobs_timer_ended(wmWindowManager *wm, wmTimer *wt)
 {
-       wmJob *steve;
+       wmJob *wm_job;
        
-       for (steve = wm->jobs.first; steve; steve = steve->next) {
-               if (steve->wt == wt) {
-                       wm_jobs_kill_job(wm, steve);
+       for (wm_job = wm->jobs.first; wm_job; wm_job = wm_job->next) {
+               if (wm_job->wt == wt) {
+                       wm_jobs_kill_job(wm, wm_job);
                        return;
                }
        }
@@ -432,85 +443,85 @@ void wm_jobs_timer_ended(wmWindowManager *wm, wmTimer *wt)
 /* hardcoded to event TIMERJOBS */
 void wm_jobs_timer(const bContext *C, wmWindowManager *wm, wmTimer *wt)
 {
-       wmJob *steve = wm->jobs.first, *stevenext;
+       wmJob *wm_job, *wm_jobnext;
        float total_progress = 0.f;
        float jobs_progress = 0;
        
        
-       for (; steve; steve = stevenext) {
-               stevenext = steve->next;
+       for (wm_job = wm->jobs.first; wm_job; wm_job = wm_jobnext) {
+               wm_jobnext = wm_job->next;
                
-               if (steve->wt == wt) {
+               if (wm_job->wt == wt) {
                        
                        /* running threads */
-                       if (steve->threads.first) {
+                       if (wm_job->threads.first) {
                                
                                /* always call note and update when ready */
-                               if (steve->do_update || steve->ready) {
-                                       if (steve->update)
-                                               steve->update(steve->run_customdata);
-                                       if (steve->note)
-                                               WM_event_add_notifier(C, steve->note, NULL);
+                               if (wm_job->do_update || wm_job->ready) {
+                                       if (wm_job->update)
+                                               wm_job->update(wm_job->run_customdata);
+                                       if (wm_job->note)
+                                               WM_event_add_notifier(C, wm_job->note, NULL);
 
-                                       if (steve->flag & WM_JOB_PROGRESS)
+                                       if (wm_job->flag & WM_JOB_PROGRESS)
                                                WM_event_add_notifier(C, NC_WM | ND_JOB, NULL);
-                                       steve->do_update = FALSE;
+                                       wm_job->do_update = FALSE;
                                }       
                                
-                               if (steve->ready) {
-                                       if (steve->endjob)
-                                               steve->endjob(steve->run_customdata);
+                               if (wm_job->ready) {
+                                       if (wm_job->endjob)
+                                               wm_job->endjob(wm_job->run_customdata);
 
                                        /* free own data */
-                                       steve->run_free(steve->run_customdata);
-                                       steve->run_customdata = NULL;
-                                       steve->run_free = NULL;
+                                       wm_job->run_free(wm_job->run_customdata);
+                                       wm_job->run_customdata = NULL;
+                                       wm_job->run_free = NULL;
                                        
-                                       // if (steve->stop) printf("job ready but stopped %s\n", steve->name);
-                                       // else printf("job finished %s\n", steve->name);
+                                       // if (wm_job->stop) printf("job ready but stopped %s\n", wm_job->name);
+                                       // else printf("job finished %s\n", wm_job->name);
 
                                        if (G.debug & G_DEBUG_JOBS) {
-                                               printf("Job '%s' finished in %f seconds\n", steve->name,
-                                                      PIL_check_seconds_timer() - steve->start_time);
+                                               printf("Job '%s' finished in %f seconds\n", wm_job->name,
+                                                      PIL_check_seconds_timer() - wm_job->start_time);
                                        }
 
-                                       steve->running = 0;
-                                       BLI_end_threads(&steve->threads);
+                                       wm_job->running = FALSE;
+                                       BLI_end_threads(&wm_job->threads);
                                        
-                                       if (steve->endnote)
-                                               WM_event_add_notifier(C, steve->endnote, NULL);
+                                       if (wm_job->endnote)
+                                               WM_event_add_notifier(C, wm_job->endnote, NULL);
                                        
                                        WM_event_add_notifier(C, NC_WM | ND_JOB, NULL);
                                        
-                                       /* new job added for steve? */
-                                       if (steve->customdata) {
-                                               // printf("job restarted with new data %s\n", steve->name);
-                                               WM_jobs_start(wm, steve);
+                                       /* new job added for wm_job? */
+                                       if (wm_job->customdata) {
+                                               // printf("job restarted with new data %s\n", wm_job->name);
+                                               WM_jobs_start(wm, wm_job);
                                        }
                                        else {
-                                               WM_event_remove_timer(wm, steve->win, steve->wt);
-                                               steve->wt = NULL;
+                                               WM_event_remove_timer(wm, wm_job->win, wm_job->wt);
+                                               wm_job->wt = NULL;
                                                
-                                               /* remove steve */
-                                               BLI_remlink(&wm->jobs, steve);
-                                               MEM_freeN(steve);
+                                               /* remove wm_job */
+                                               BLI_remlink(&wm->jobs, wm_job);
+                                               MEM_freeN(wm_job);
                                        }
                                }
-                               else if (steve->flag & WM_JOB_PROGRESS) {
+                               else if (wm_job->flag & WM_JOB_PROGRESS) {
                                        /* accumulate global progress for running jobs */
                                        jobs_progress++;
-                                       total_progress += steve->progress;
+                                       total_progress += wm_job->progress;
                                }
                        }
-                       else if (steve->suspended) {
-                               WM_jobs_start(wm, steve);
+                       else if (wm_job->suspended) {
+                               WM_jobs_start(wm, wm_job);
                        }
                }
-               else if (steve->threads.first && !steve->ready) {
-                       if (steve->flag & WM_JOB_PROGRESS) {
+               else if (wm_job->threads.first && !wm_job->ready) {
+                       if (wm_job->flag & WM_JOB_PROGRESS) {
                                /* accumulate global progress for running jobs */
                                jobs_progress++;
-                               total_progress += steve->progress;
+                               total_progress += wm_job->progress;
                        }
                }
        }
@@ -530,11 +541,13 @@ void wm_jobs_timer(const bContext *C, wmWindowManager *wm, wmTimer *wt)
 
 int WM_jobs_has_running(wmWindowManager *wm)
 {
-       wmJob *steve;
+       wmJob *wm_job;
 
-       for (steve = wm->jobs.first; steve; steve = steve->next)
-               if (steve->running)
-                       return 1;
+       for (wm_job = wm->jobs.first; wm_job; wm_job = wm_job->next) {
+               if (wm_job->running) {
+                       return TRUE;
+               }
+       }
 
-       return 0;
+       return FALSE;
 }
index 59e0614b18aa5cbe3e6c7c2ff18d351e6a4a9b04..a2812d34e617b2379669bca6fa777b0b8c633737 100644 (file)
@@ -965,7 +965,7 @@ int WM_operator_check_ui_enabled(const bContext *C, const char *idname)
        wmWindowManager *wm = CTX_wm_manager(C);
        Scene *scene = CTX_data_scene(C);
 
-       return !(ED_undo_valid(C, idname) == 0 || WM_jobs_test(wm, scene));
+       return !(ED_undo_valid(C, idname) == 0 || WM_jobs_test(wm, scene, WM_JOB_TYPE_ANY));
 }
 
 wmOperator *WM_operator_last_redo(const bContext *C)