svn merge -r37900:38000 https://svn.blender.org/svnroot/bf-blender/trunk/blender
authorCampbell Barton <ideasman42@gmail.com>
Mon, 25 Jul 2011 16:12:54 +0000 (16:12 +0000)
committerCampbell Barton <ideasman42@gmail.com>
Mon, 25 Jul 2011 16:12:54 +0000 (16:12 +0000)
29 files changed:
CMakeLists.txt
build_files/scons/config/win32-vc-config.py
build_files/scons/config/win64-vc-config.py
release/scripts/modules/bpy/__init__.py
release/scripts/modules/bpy_extras/mesh_utils.py
release/scripts/modules/console/intellisense.py
release/scripts/startup/bl_operators/image.py
release/scripts/startup/bl_ui/space_userpref.py
source/blender/blenkernel/intern/key.c
source/blender/collada/EffectExporter.cpp
source/blender/editors/armature/armature_ops.c
source/blender/editors/interface/interface_draw.c
source/blender/editors/interface/interface_widgets.c
source/blender/editors/object/object_edit.c
source/blender/editors/object/object_hook.c
source/blender/editors/object/object_relations.c
source/blender/editors/render/render_internal.c
source/blender/editors/screen/area.c
source/blender/editors/screen/screen_edit.c
source/blender/editors/space_image/image_buttons.c
source/blender/editors/space_node/node_edit.c
source/blender/makesrna/intern/rna_render.c
source/blender/modifiers/intern/MOD_displace.c
source/blender/render/extern/include/RE_pipeline.h
source/blender/render/intern/include/render_types.h
source/blender/render/intern/source/convertblender.c
source/blender/render/intern/source/pipeline.c
source/blenderplayer/bad_level_call_stubs/stubs.c
source/creator/creator.c

index ad2c6f89c0839c5a812402d0f8f1a7e4db83b6bc..f7e8d7dc172dd47278578b28866e4f93435835a5 100644 (file)
@@ -53,7 +53,6 @@ if(NOT EXECUTABLE_OUTPUT_PATH)
        set(FIRST_RUN "TRUE")
 endif()
 
-
 # this starts out unset
 list(APPEND CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/build_files/cmake/Modules")
 
@@ -145,7 +144,7 @@ option(WITH_IMAGE_HDR           "Enable HDR Image Support" ON)
 option(WITH_IMAGE_REDCODE       "Enable RedCode Image Support" OFF)
 
 # Audio/Video format support
-option(WITH_CODEC_FFMPEG        "Enable FFMPeg Support (http://ffmpeg.mplayerhq.hu)" OFF)
+option(WITH_CODEC_FFMPEG        "Enable FFMPeg Support (http://ffmpeg.org)" OFF)
 option(WITH_CODEC_SNDFILE       "Enable libsndfile Support (http://www.mega-nerd.com/libsndfile)" OFF)
 if(APPLE OR (WIN32 AND NOT UNIX))
        option(WITH_CODEC_QUICKTIME     "Enable Quicktime Support" OFF)
@@ -363,7 +362,7 @@ if(UNIX AND NOT APPLE)
        endif()
 
        if(WITH_CODEC_FFMPEG)
-               set(FFMPEG /usr CACHE FILEPATH "FFMPEG Directory")
+               set(FFMPEG /usr CACHE PATH "FFMPEG Directory")
                mark_as_advanced(FFMPEG)
                set(FFMPEG_INCLUDE_DIRS ${FFMPEG}/include)
                set(FFMPEG_LIBRARIES avformat avcodec avutil avdevice swscale CACHE STRING "FFMPEG Libraries")
@@ -407,18 +406,18 @@ if(UNIX AND NOT APPLE)
        endif()
 
        if(WITH_OPENCOLLADA)
-               set(OPENCOLLADA /usr/local/opencollada CACHE FILEPATH "OpenCollada Directory")
+               set(OPENCOLLADA /usr/local/opencollada CACHE PATH "OpenCollada Directory")
                mark_as_advanced(OPENCOLLADA)
                set(OPENCOLLADA_LIBPATH ${OPENCOLLADA}/lib)
                set(OPENCOLLADA_LIBRARIES OpenCOLLADAStreamWriter OpenCOLLADASaxFrameworkLoader OpenCOLLADAFramework OpenCOLLADABaseUtils GeneratedSaxParser UTF MathMLSolver pcre ftoa buffer xml2)
                set(OPENCOLLADA_INCLUDE_DIR ${OPENCOLLADA})
 
-               set(PCRE /usr CACHE FILEPATH "PCRE Directory")
+               set(PCRE /usr CACHE PATH "PCRE Directory")
                mark_as_advanced(PCRE)
                set(PCRE_LIBPATH ${PCRE}/lib)
                set(PCRE_LIB pcre)
 
-               set(EXPAT /usr CACHE FILEPATH "Expat Directory")
+               set(EXPAT /usr CACHE PATH "Expat Directory")
                mark_as_advanced(EXPAT)
                set(EXPAT_LIBPATH ${EXPAT}/lib)
                set(EXPAT_LIB expat)
@@ -615,9 +614,10 @@ elseif(WIN32)
                set(PTHREADS_INCLUDE_DIRS ${LIBDIR}/pthreads/include)
                set(PTHREADS_LIBRARIES ${LIBDIR}/pthreads/lib/pthreadVC2.lib)
 
+               set(FREETYPE ${LIBDIR}/freetype)
                set(FREETYPE_INCLUDE_DIRS
-                       ${FREETYPE}/include
-                       ${FREETYPE}/include/freetype2
+                       ${LIBDIR}/freetype/include
+                       ${LIBDIR}/freetype/include/freetype2
                )
                set(FREETYPE_LIBRARY ${LIBDIR}/freetype/lib/freetype2ST.lib)
 
@@ -714,7 +714,7 @@ elseif(WIN32)
                        set(PYTHON_LIBRARIES ${LIBDIR}/python/lib/python32.lib)
                endif()
 
-               set(PLATFORM_LINKFLAGS "/SUBSYSTEM:CONSOLE /STACK:2097152 /INCREMENTAL:NO  /NODEFAULTLIB:msvcrt.lib\;msvcmrt.lib\;msvcurt.lib\;msvcrtd.lib ")
+               set(PLATFORM_LINKFLAGS "/SUBSYSTEM:CONSOLE /STACK:2097152 /INCREMENTAL:NO /NODEFAULTLIB:msvcrt.lib /NODEFAULTLIB:msvcmrt.lib /NODEFAULTLIB:msvcurt.lib /NODEFAULTLIB:msvcrtd.lib")
 
                # MSVC only, Mingw doesnt need
                if(CMAKE_CL_64)
@@ -723,7 +723,7 @@ elseif(WIN32)
                        set(PLATFORM_LINKFLAGS "/MACHINE:IX86 /LARGEADDRESSAWARE ${PLATFORM_LINKFLAGS}")
                endif()
 
-               set(PLATFORM_LINKFLAGS_DEBUG "/NODEFAULTLIB:libcmt.lib\;libc.lib")
+               set(PLATFORM_LINKFLAGS_DEBUG "/NODEFAULTLIB:libcmt.lib /NODEFAULTLIB:libc.lib")
 
        else()
                # keep GCC spesific stuff here
index 1654947885e92ef6d6a88391cf7059cd9d0766d4..89b246cb39f329f5415bfb6fc1526d29c8b01f4b 100644 (file)
@@ -181,7 +181,7 @@ CXX_WARN = []
 
 LLIBS = ['ws2_32', 'vfw32', 'winmm', 'kernel32', 'user32', 'gdi32', 'comdlg32', 'advapi32', 'shfolder', 'shell32', 'ole32', 'oleaut32', 'uuid']
 
-PLATFORM_LINKFLAGS = ['/SUBSYSTEM:CONSOLE','/MACHINE:IX86','/STACK:2097152','/INCREMENTAL:NO', '/LARGEADDRESSAWARE', '/NODEFAULTLIB:msvcrt.lib;msvcmrt.lib;msvcurt.lib;msvcrtd.lib']
+PLATFORM_LINKFLAGS = ['/SUBSYSTEM:CONSOLE','/MACHINE:IX86','/STACK:2097152','/INCREMENTAL:NO', '/LARGEADDRESSAWARE', '/NODEFAULTLIB:msvcrt.lib', '/NODEFAULTLIB:msvcmrt.lib', '/NODEFAULTLIB:msvcurt.lib', '/NODEFAULTLIB:msvcrtd.lib']
 
 # # Todo
 # BF_PROFILE_CCFLAGS = ['-pg', '-g ']
index 34fa27dc98d1de22cadc05779894ed319e16d38f..67db1c441d7d41b3343ed0893ed1d9250f8b1abd 100644 (file)
@@ -190,7 +190,7 @@ if BF_DEBUG:
 else:
        BF_NUMJOBS=6
 
-PLATFORM_LINKFLAGS = ['/SUBSYSTEM:CONSOLE','/MACHINE:X64','/STACK:2097152','/OPT:NOREF','/INCREMENTAL:NO', '/NODEFAULTLIB:msvcrt.lib;msvcmrt.lib;msvcurt.lib;msvcrtd.lib']
+PLATFORM_LINKFLAGS = ['/SUBSYSTEM:CONSOLE','/MACHINE:X64','/STACK:2097152','/OPT:NOREF','/INCREMENTAL:NO', '/NODEFAULTLIB:msvcrt.lib', '/NODEFAULTLIB:msvcmrt.lib', '/NODEFAULTLIB:msvcurt.lib', '/NODEFAULTLIB:msvcrtd.lib']
 
 BF_BUILDDIR = '..\\build\\blender25-win64-vc'
 BF_INSTALLDIR='..\\install\\blender25-win64-vc'
index 1df8e9e5588531d39124fffe3d26d55d1b7ba04c..6dcc5d7b2850cc48ae90458eff0f7331ea130c45 100644 (file)
 Give access to blender data and utility functions.
 """
 
-# internal blender C module
-import _bpy
-from _bpy import types, props, app
+__all__ = (
+    "app",
+    "context",
+    "data",
+    "ops",
+    "path",
+    "props",
+    "types",
+    "utils",
+)
+
 
-data = _bpy.data
-context = _bpy.context
+# internal blender C module
+from _bpy import types, props, app, data, context
 
 # python modules
-from . import utils, path
-from . import ops as _ops_module
+from . import utils, path, ops
 
 # fake operator module
-ops = _ops_module.ops_fake_module
-
-import sys as _sys
-
+ops = ops.ops_fake_module
 
 def _main():
+    import sys as _sys
 
     # Possibly temp. addons path
     from os.path import join, dirname, normpath
@@ -59,3 +64,5 @@ def _main():
 
 
 _main()
+
+del _main
\ No newline at end of file
index 2062fe4485ffd789d2c32c1d6624364ed31bc481..cf099016aee3ab9a511e93fa95a324a8ab105768 100644 (file)
@@ -287,7 +287,7 @@ def ngon_tesselate(from_data, indices, fix_loops=True):
         else:
             return v1[1], v2[1]
 
-    if not PREF_FIX_LOOPS:
+    if not fix_loops:
         '''
         Normal single concave loop filling
         '''
index 072d467ff86855c10436ba9b4a6374085513e256..a177b305fdae81fc3ec0931492f9f165d9db4361 100644 (file)
@@ -53,7 +53,7 @@ RE_UNQUOTED_WORD = re.compile(
     re.UNICODE)
 
 
-def complete(line, cursor, namespace, private=True):
+def complete(line, cursor, namespace, private):
     """Returns a list of possible completions:
 
     * name completion
@@ -82,6 +82,9 @@ def complete(line, cursor, namespace, private=True):
         if RE_MODULE.match(line):
             from . import complete_import
             matches = complete_import.complete(line)
+            if not private:
+                matches[:] = [m for m in matches if m[:1] != "_"]
+            matches.sort()
         else:
             from . import complete_namespace
             matches = complete_namespace.complete(word, namespace, private)
@@ -130,11 +133,15 @@ def expand(line, cursor, namespace, private=True):
         else:
             # causes blender bug [#27495] since string keys may contain '.'
             # scrollback = '  '.join([m.split('.')[-1] for m in matches])
+
+            # add white space to align with the cursor
+            white_space = "    " + (" " * (cursor + len(prefix)))
             word_prefix = word + prefix
-            scrollback = '  '.join(
-                    [m[len(word_prefix):]
+            scrollback = '\n'.join(
+                    [white_space + m[len(word_prefix):]
                      if (word_prefix and m.startswith(word_prefix))
-                     else m.split('.')[-1]
+                     else
+                     white_space + m.split('.')[-1]
                      for m in matches])
 
         no_calltip = True
index 462db3a2c5e6526e078e77f6bed888441e0f55c0..1e5217217dd1d5244fe71934526e95c8ef5daf55 100644 (file)
@@ -60,7 +60,7 @@ class EditExternally(bpy.types.Operator):
         filepath = bpy.path.abspath(self.filepath)
 
         if not os.path.exists(filepath):
-            self.report({'ERROR'}, "Image path %r not found." % filepath)
+            self.report({'ERROR'}, "Image path %r not found, image may be packed or unsaved." % filepath)
             return {'CANCELLED'}
 
         cmd = self._editor_guess(context) + [filepath]
index b9ac740eb5b21f50b3f7e232b903eb8fdcf01f25..9c31b172ee96a0ed37a149576f4768b5750b6c2f 100644 (file)
@@ -876,6 +876,19 @@ class USERPREF_PT_addons(bpy.types.Panel):
     def module_get(mod_name):
         return USERPREF_PT_addons._addons_fake_modules[mod_name]
 
+    @staticmethod
+    def is_user_addon(mod, user_addon_paths):
+        if not user_addon_paths:
+            user_script_path = bpy.utils.user_script_path()
+            if user_script_path is not None:
+                user_addon_paths.append(os.path.join(user_script_path(), "addons"))
+            user_addon_paths.append(os.path.join(bpy.utils.resource_path('USER'), "scripts", "addons"))
+        
+        for path in user_addon_paths:
+            if bpy.path.is_subdir(mod.__file__, path):
+                return True
+        return False
+
     def draw(self, context):
         layout = self.layout
 
@@ -900,6 +913,9 @@ class USERPREF_PT_addons(bpy.types.Panel):
         search = context.window_manager.addon_search.lower()
         support = context.window_manager.addon_support
 
+        # initialized on demand
+        user_addon_paths = []
+
         for mod, info in addons:
             module_name = mod.__name__
 
@@ -969,19 +985,24 @@ class USERPREF_PT_addons(bpy.types.Panel):
                         split = colsub.row().split(percentage=0.15)
                         split.label(text="Warning:")
                         split.label(text='  ' + info["warning"], icon='ERROR')
-                    if info["wiki_url"] or info["tracker_url"]:
+
+                    user_addon = __class__.is_user_addon(mod, user_addon_paths)
+                    tot_row = bool(info["wiki_url"]) + bool(info["tracker_url"]) + bool(user_addon)
+
+                    if tot_row:
                         split = colsub.row().split(percentage=0.15)
                         split.label(text="Internet:")
                         if info["wiki_url"]:
                             split.operator("wm.url_open", text="Link to the Wiki", icon='HELP').url = info["wiki_url"]
                         if info["tracker_url"]:
                             split.operator("wm.url_open", text="Report a Bug", icon='URL').url = info["tracker_url"]
+                        if user_addon:
+                            split.operator("wm.addon_remove", text="Remove", icon='CANCEL').module = mod.__name__
 
-                        if info["wiki_url"] and info["tracker_url"]:
-                            split.separator()
-                        else:
-                            split.separator()
+                        for i in range(4 - tot_row):
                             split.separator()
+                        
+                        
 
         # Append missing scripts
         # First collect scripts that are used but have no script file.
@@ -1186,6 +1207,54 @@ class WM_OT_addon_install(bpy.types.Operator):
         return {'RUNNING_MODAL'}
 
 
+class WM_OT_addon_remove(bpy.types.Operator):
+    "Disable an addon"
+    bl_idname = "wm.addon_remove"
+    bl_label = "Remove Add-On"
+
+    module = StringProperty(name="Module", description="Module name of the addon to remove")
+
+    @staticmethod
+    def path_from_addon(module):
+        for mod in addon_utils.modules(USERPREF_PT_addons._addons_fake_modules):
+            if mod.__name__ == module:
+                filepath = mod.__file__
+                if os.path.exists(filepath):
+                    if os.path.splitext(os.path.basename(filepath))[0] == "__init__":
+                        return os.path.dirname(filepath), True
+                    else:
+                        return filepath, False
+        return None, False
+
+    def execute(self, context):
+        path, isdir = __class__.path_from_addon(self.module)
+        if path is None:
+            self.report('WARNING', "Addon path %r could not be found" % path)
+            return {'CANCELLED'}
+
+        # incase its enabled
+        addon_utils.disable(self.module)
+
+        import shutil
+        if isdir:
+            shutil.rmtree(path)
+        else:
+            os.remove(path)
+
+        context.area.tag_redraw()
+        return {'FINISHED'}
+
+    # lame confirmation check
+    def draw(self, context):
+        self.layout.label(text="Remove Addon: %r?" % self.module)
+        path, isdir = __class__.path_from_addon(self.module)
+        self.layout.label(text="Path: %r" % path)
+
+    def invoke(self, context, event):
+        wm = context.window_manager
+        return wm.invoke_props_dialog(self, width=600)
+
+
 class WM_OT_addon_expand(bpy.types.Operator):
     "Display more information on this add-on"
     bl_idname = "wm.addon_expand"
index a345cedec90524563804e803e9c3bd92f8a5c214..904f6af210518c5c12cae525441ce6166ab01d0f 100644 (file)
@@ -64,6 +64,7 @@
 #include "BKE_tessmesh.h"
 #include "BKE_main.h"
 #include "BKE_object.h"
+#include "BKE_deform.h"
 
 
 #include "RNA_access.h"
@@ -1052,7 +1053,7 @@ static float *get_weights_array(Object *ob, char *vgroup)
        BMEditMesh *em= NULL;
        BMIter iter;
        BMVert *eve;
-       int totvert= 0, index= 0;
+       int totvert= 0, defgrp_index= 0;
        
        /* no vgroup string set? */
        if(vgroup[0]==0) return NULL;
@@ -1075,10 +1076,10 @@ static float *get_weights_array(Object *ob, char *vgroup)
        if(dvert==NULL) return NULL;
        
        /* find the group (weak loop-in-loop) */
-       index= defgroup_name_index(ob, vgroup);
-       if(index >= 0) {
+       defgrp_index= defgroup_name_index(ob, vgroup);
+       if(defgrp_index >= 0) {
                float *weights;
-               int i, j;
+               int i;
                
                weights= MEM_callocN(totvert*sizeof(float), "weights");
 
@@ -1088,23 +1089,13 @@ static float *get_weights_array(Object *ob, char *vgroup)
                                dvert= CustomData_bmesh_get(&em->bm->vdata, eve->head.data, CD_MDEFORMVERT);
 
                                if(dvert) {
-                                       for(j=0; j<dvert->totweight; j++) {
-                                               if(dvert->dw[j].def_nr == index) {
-                                                       weights[i]= dvert->dw[j].weight;
-                                                       break;
-                                               }
-                                       }
+                                       weights[i]= defvert_find_weight(dvert, defgrp_index);
                                }
                        }
                }
                else {
                        for(i=0; i < totvert; i++, dvert++) {
-                               for(j=0; j<dvert->totweight; j++) {
-                                       if(dvert->dw[j].def_nr == index) {
-                                               weights[i]= dvert->dw[j].weight;
-                                               break;
-                                       }
-                               }
+                               weights[i]= defvert_find_weight(dvert, defgrp_index);
                        }
                }
 
index 0bbf714137e9da64c92b3992b8b6d8f5948c4800..74756859d3b92a58c1247c04aa95f87b36cf1f6b 100644 (file)
@@ -273,7 +273,7 @@ void EffectsExporter::operator()(Material *ma, Object *ob)
                std::string uvname = strlen(t->uvname) ? t->uvname : active_uv;
 
                // color
-               if (t->mapto & MAP_COL | MAP_COLSPEC) {
+               if (t->mapto & (MAP_COL | MAP_COLSPEC)) {
                        ep.setDiffuse(createTexture(ima, uvname, sampler));
                }
                // ambient
index 7bc9bb48a4c63f8a516eb6f4aa61be6cb019c9c0..16b748737ca6505219b133a727cdbe3672a105b5 100644 (file)
@@ -265,7 +265,7 @@ void ED_keymap_armature(wmKeyConfig *keyconf)
        
                /* set flags */
        WM_keymap_add_menu(keymap, "VIEW3D_MT_bone_options_toggle", WKEY, KM_PRESS, KM_SHIFT, 0);
-       WM_keymap_add_menu(keymap, "VIEW3D_MT_bone_options_enable", WKEY, KM_PRESS, KM_CTRL, 0);
+       WM_keymap_add_menu(keymap, "VIEW3D_MT_bone_options_enable", WKEY, KM_PRESS, KM_CTRL|KM_SHIFT, 0);
        WM_keymap_add_menu(keymap, "VIEW3D_MT_bone_options_disable", WKEY, KM_PRESS, KM_ALT, 0);
                
                /* armature/bone layers */
@@ -343,7 +343,7 @@ void ED_keymap_armature(wmKeyConfig *keyconf)
        
                /* set flags */
        WM_keymap_add_menu(keymap, "VIEW3D_MT_bone_options_toggle", WKEY, KM_PRESS, KM_SHIFT, 0);
-       WM_keymap_add_menu(keymap, "VIEW3D_MT_bone_options_enable", WKEY, KM_PRESS, KM_CTRL, 0);
+       WM_keymap_add_menu(keymap, "VIEW3D_MT_bone_options_enable", WKEY, KM_PRESS, KM_CTRL|KM_SHIFT, 0);
        WM_keymap_add_menu(keymap, "VIEW3D_MT_bone_options_disable", WKEY, KM_PRESS, KM_ALT, 0);
 
                /* armature/bone layers */
index c7f11116834f91f0150d605f796e1192ba2c103d..97299a6a766ff523aaeb037ca32d8ac59f21c741 100644 (file)
@@ -142,13 +142,13 @@ void uiDrawBox(int mode, float minx, float miny, float maxx, float maxy, float r
 
 static void round_box_shade_col(float *col1, float *col2, float fac)
 {
-       float col[3];
+       float col[4];
 
        col[0]= (fac*col1[0] + (1.0f-fac)*col2[0]);
        col[1]= (fac*col1[1] + (1.0f-fac)*col2[1]);
        col[2]= (fac*col1[2] + (1.0f-fac)*col2[2]);
-       
-       glColor3fv(col);
+       col[3]= (fac*col1[3] + (1.0f-fac)*col2[3]);
+       glColor4fv(col);
 }
 
 
@@ -159,7 +159,7 @@ void uiDrawBoxShade(int mode, float minx, float miny, float maxx, float maxy, fl
        float vec[7][2]= {{0.195, 0.02}, {0.383, 0.067}, {0.55, 0.169}, {0.707, 0.293},
                                          {0.831, 0.45}, {0.924, 0.617}, {0.98, 0.805}};
        float div= maxy-miny;
-       float coltop[3], coldown[3], color[4];
+       float coltop[4], coldown[4], color[4];
        int a;
        
        /* mult */
@@ -173,9 +173,11 @@ void uiDrawBoxShade(int mode, float minx, float miny, float maxx, float maxy, fl
        coltop[0]= color[0]+shadetop; if(coltop[0]>1.0f) coltop[0]= 1.0f;
        coltop[1]= color[1]+shadetop; if(coltop[1]>1.0f) coltop[1]= 1.0f;
        coltop[2]= color[2]+shadetop; if(coltop[2]>1.0f) coltop[2]= 1.0f;
+       coltop[3]= color[3];
        coldown[0]= color[0]+shadedown; if(coldown[0]<0.0f) coldown[0]= 0.0f;
        coldown[1]= color[1]+shadedown; if(coldown[1]<0.0f) coldown[1]= 0.0f;
        coldown[2]= color[2]+shadedown; if(coldown[2]<0.0f) coldown[2]= 0.0f;
+       coldown[3]= color[3];
 
        glShadeModel(GL_SMOOTH);
        glBegin(mode);
index b6e255b6758a1bda7bfd049f4796e54e07abb3a1..25a64994f5c250c475c667346eb1bd764d203ee0 100644 (file)
@@ -180,7 +180,7 @@ void ui_draw_anti_tria(float x1, float y1, float x2, float y2, float x3, float y
        
        glEnable(GL_BLEND);
        glGetFloatv(GL_CURRENT_COLOR, color);
-       color[3]= 0.125;
+       color[3]*= 0.125;
        glColor4fv(color);
        
        /* for each AA step */
index 22c580606374fd5ec2723885574d8b57b2b40464..c6f82f5b7b0cf0ea4a9fb1dd9a682e838410239d 100644 (file)
@@ -1692,7 +1692,7 @@ void OBJECT_OT_shade_flat(wmOperatorType *ot)
 {
        /* identifiers */
        ot->name= "Shade Flat";
-       ot->description= "Display faces 'smooth' (using vertext normals)";
+       ot->description= "Display faces 'flat'";
        ot->idname= "OBJECT_OT_shade_flat";
        
        /* api callbacks */
@@ -1707,7 +1707,7 @@ void OBJECT_OT_shade_smooth(wmOperatorType *ot)
 {
        /* identifiers */
        ot->name= "Shade Smooth";
-       ot->description= "Display faces 'flat'";
+       ot->description= "Display faces 'smooth' (using vertex normals)";
        ot->idname= "OBJECT_OT_shade_smooth";
        
        /* api callbacks */
index 604a201816565bdb7ece57d4c7fb993860d660c6..01fab0813d4d3fc388a1b9fddefe63297bb6b864 100644 (file)
@@ -56,6 +56,7 @@
 #include "BKE_object.h"
 #include "BKE_report.h"
 #include "BKE_scene.h"
+#include "BKE_deform.h"
 #include "BKE_tessmesh.h"
 
 #include "RNA_define.h"
@@ -87,7 +88,7 @@ static int return_editmesh_indexar(BMEditMesh *em, int *tot, int **indexar, floa
        *indexar= index= MEM_mallocN(4*totvert, "hook indexar");
        *tot= totvert;
        nr= 0;
-       cent[0]= cent[1]= cent[2]= 0.0;
+       zero_v3(cent);
        
        BM_ITER(eve, &iter, em->bm, BM_VERTS_OF_MESH, NULL) {
                if(BM_TestHFlag(eve, BM_SELECT)) {
@@ -104,31 +105,30 @@ static int return_editmesh_indexar(BMEditMesh *em, int *tot, int **indexar, floa
 
 static int return_editmesh_vgroup(Object *obedit, BMEditMesh *em, char *name, float *cent)
 {
-       MDeformVert *dvert;
-       BMVert *eve;
-       BMIter iter;
-       int i, totvert=0;
-       
-       cent[0]= cent[1]= cent[2]= 0.0;
-       
+       zero_v3(cent);
+
        if(obedit->actdef) {
-               
+               const int defgrp_index= obedit->actdef-1;
+               int totvert=0;
+
+               MDeformVert *dvert;
+               BMVert *eve;
+               BMIter iter;
+
                /* find the vertices */
                BM_ITER(eve, &iter, em->bm, BM_VERTS_OF_MESH, NULL) {
                        dvert= CustomData_bmesh_get(&em->bm->vdata, eve->head.data, CD_MDEFORMVERT);
 
                        if(dvert) {
-                               for(i=0; i<dvert->totweight; i++){
-                                       if(dvert->dw[i].def_nr == (obedit->actdef-1)) {
-                                               totvert++;
-                                               add_v3_v3(cent, eve->co);
-                                       }
+                               if(defvert_find_weight(dvert, defgrp_index) > 0.0f) {
+                                       add_v3_v3(cent, eve->co);
+                                       totvert++;
                                }
                        }
                }
                if(totvert) {
-                       bDeformGroup *defGroup = BLI_findlink(&obedit->defbase, obedit->actdef-1);
-                       strcpy(name, defGroup->name);
+                       bDeformGroup *dg = BLI_findlink(&obedit->defbase, defgrp_index);
+                       BLI_strncpy(name, dg->name, sizeof(dg->name));
                        mul_v3_fl(cent, 1.0f/(float)totvert);
                        return 1;
                }
index 1ba2f3541ece709e74fa614b84fe3bdae6716cc7..bf21c4c0f6290df70fe14d68c5d9f46f96ab5035 100644 (file)
@@ -443,6 +443,7 @@ static int parent_clear_exec(bContext *C, wmOperator *op)
        DAG_scene_sort(bmain, scene);
        DAG_ids_flush_update(bmain, 0);
        WM_event_add_notifier(C, NC_OBJECT|ND_TRANSFORM, NULL);
+       WM_event_add_notifier(C, NC_OBJECT|ND_PARENT, NULL);
 
        return OPERATOR_FINISHED;
 }
index d4de1386871396f9deb76b407554751df1465b32..42a163d3da50dd7a6b3e37ac457eaee8e41b54d2 100644 (file)
@@ -189,11 +189,6 @@ void image_buffer_rect_update(Scene *scene, RenderResult *rr, ImBuf *ibuf, volat
 /* set callbacks, exported to sequence render too.
  Only call in foreground (UI) renders. */
 
-static void render_error_reports(void *reports, const char *str)
-{
-       BKE_report(reports, RPT_ERROR, str);
-}
-
 /* executes blocking render */
 static int screen_render_exec(bContext *C, wmOperator *op)
 {
@@ -214,7 +209,6 @@ static int screen_render_exec(bContext *C, wmOperator *op)
 
        G.afbreek= 0;
        RE_test_break_cb(re, NULL, (int (*)(void *)) blender_test_break);
-       RE_error_cb(re, op->reports, render_error_reports);
 
        ima= BKE_image_verify_viewer(IMA_TYPE_R_RESULT, "Render Result");
        BKE_image_signal(ima, NULL, IMA_SIGNAL_FREE);
@@ -226,11 +220,15 @@ static int screen_render_exec(bContext *C, wmOperator *op)
           since sequence rendering can call that recursively... (peter) */
        seq_stripelem_cache_cleanup();
 
+       RE_SetReports(re, op->reports);
+
        if(is_animation)
-               RE_BlenderAnim(re, mainp, scene, camera_override, lay, scene->r.sfra, scene->r.efra, scene->r.frame_step, op->reports);
+               RE_BlenderAnim(re, mainp, scene, camera_override, lay, scene->r.sfra, scene->r.efra, scene->r.frame_step);
        else
                RE_BlenderFrame(re, mainp, scene, NULL, camera_override, lay, scene->r.cfra, is_write_still);
 
+       RE_SetReports(re, NULL);
+
        // no redraw needed, we leave state as we entered it
        ED_update_for_newframe(mainp, scene, CTX_wm_screen(C), 1);
 
@@ -374,10 +372,14 @@ static void render_startjob(void *rjv, short *stop, short *do_update, float *pro
        rj->do_update= do_update;
        rj->progress= progress;
 
+       RE_SetReports(rj->re, rj->reports);
+
        if(rj->anim)
-               RE_BlenderAnim(rj->re, rj->main, rj->scene, rj->camera_override, rj->lay, rj->scene->r.sfra, rj->scene->r.efra, rj->scene->r.frame_step, rj->reports);
+               RE_BlenderAnim(rj->re, rj->main, rj->scene, rj->camera_override, rj->lay, rj->scene->r.sfra, rj->scene->r.efra, rj->scene->r.frame_step);
        else
                RE_BlenderFrame(rj->re, rj->main, rj->scene, rj->srl, rj->camera_override, rj->lay, rj->scene->r.cfra, rj->write_still);
+
+       RE_SetReports(rj->re, NULL);
 }
 
 static void render_endjob(void *rjv)
@@ -470,7 +472,7 @@ static int screen_render_invoke(bContext *C, wmOperator *op, wmEvent *event)
        if(WM_jobs_test(CTX_wm_manager(C), scene))
                return OPERATOR_CANCELLED;
 
-       if(!RE_is_rendering_allowed(scene, camera_override, op->reports, render_error_reports)) {
+       if(!RE_is_rendering_allowed(scene, camera_override, op->reports)) {
                return OPERATOR_CANCELLED;
        }
 
@@ -578,8 +580,6 @@ static int screen_render_invoke(bContext *C, wmOperator *op, wmEvent *event)
        rj->re= re;
        G.afbreek= 0;
 
-       RE_error_cb(re, op->reports, render_error_reports);
-
        WM_jobs_start(CTX_wm_manager(C), steve);
 
        WM_cursor_wait(0);
@@ -596,7 +596,6 @@ static int screen_render_invoke(bContext *C, wmOperator *op, wmEvent *event)
        return OPERATOR_RUNNING_MODAL;
 }
 
-
 /* contextual render, using current scene, view3d? */
 void RENDER_OT_render(wmOperatorType *ot)
 {
index 4d531e78ec0815f46e4555fe0be2e279ca5521de..82986dfbcc4b82b5a462aaa2321f549ee33cbc88 100644 (file)
@@ -188,17 +188,12 @@ static void area_draw_azone(short x1, short y1, short x2, short y2)
 }
 
 
-static void region_draw_azone(AZone *az)
+static void region_draw_azone_icon(AZone *az)
 {
        GLUquadricObj *qobj = NULL; 
        short midx = az->x1 + (az->x2 - az->x1)/2;
        short midy = az->y1 + (az->y2 - az->y1)/2;
-       
-       if(az->ar==NULL) return;
-       
-       /* only display action zone icons when the region is hidden */
-       if (!(az->ar->flag & RGN_FLAG_HIDDEN)) return;
-       
+               
        qobj = gluNewQuadric();
        
        glPushMatrix();         
@@ -227,6 +222,79 @@ static void region_draw_azone(AZone *az)
        sdrawline(midx-2, midy, midx+3, midy);
 }
 
+static void region_draw_azone_tab(AZone *az)
+{
+       float col[3];
+       
+       glEnable(GL_BLEND);
+       UI_GetThemeColor3fv(TH_HEADER, col);
+       glColor4f(col[0], col[1], col[2], 0.5f);
+       
+       /* add code to draw region hidden as 'too small' */
+       switch(az->edge) {
+               case AE_TOP_TO_BOTTOMRIGHT:
+                       uiSetRoundBox(3 + 16);
+                       
+                       uiDrawBoxShade(GL_POLYGON, (float)az->x1, (float)az->y1, (float)az->x2, (float)az->y2, 4.0f, -0.3f, 0.05f);
+                       glColor4ub(0, 0, 0, 255);
+                       uiRoundRect((float)az->x1, 0.3f+(float)az->y1, (float)az->x2, 0.3f+(float)az->y2, 4.0f);
+                       break;
+               case AE_BOTTOM_TO_TOPLEFT:
+                       uiSetRoundBox(12 + 16);
+                       
+                       uiDrawBoxShade(GL_POLYGON, (float)az->x1, (float)az->y1, (float)az->x2, (float)az->y2, 4.0f, -0.3f, 0.05f);
+                       glColor4ub(0, 0, 0, 255);
+                       uiRoundRect((float)az->x1, 0.3f+(float)az->y1, (float)az->x2, 0.3f+(float)az->y2, 4.0f);
+                       break;
+               case AE_LEFT_TO_TOPRIGHT:
+                       uiSetRoundBox(9 + 16);
+                       
+                       uiDrawBoxShade(GL_POLYGON, (float)az->x1, (float)az->y1, (float)az->x2, (float)az->y2, 4.0f, -0.3f, 0.05f);
+                       glColor4ub(0, 0, 0, 255);
+                       uiRoundRect((float)az->x1, (float)az->y1, (float)az->x2, (float)az->y2, 4.0f);
+                       break;
+               case AE_RIGHT_TO_TOPLEFT:
+                       uiSetRoundBox(6 + 16);
+                       
+                       uiDrawBoxShade(GL_POLYGON, (float)az->x1, (float)az->y1, (float)az->x2, (float)az->y2, 4.0f, -0.3f, 0.05f);
+                       glColor4ub(0, 0, 0, 255);
+                       uiRoundRect((float)az->x1, (float)az->y1, (float)az->x2, (float)az->y2, 4.0f);
+                       break;
+       }
+       
+       glDisable(GL_BLEND);
+}
+
+static void region_draw_azone_tria(AZone *az)
+{
+       extern void ui_draw_anti_tria(float x1, float y1, float x2, float y2, float x3, float y3); /* xxx temp */
+       
+       glEnable(GL_BLEND);
+       //UI_GetThemeColor3fv(TH_HEADER, col);
+       glColor4f(0.0f, 0.0f, 0.0f, 0.35f);
+       
+       /* add code to draw region hidden as 'too small' */
+       switch(az->edge) {
+               case AE_TOP_TO_BOTTOMRIGHT:
+                       ui_draw_anti_tria((float)az->x1, (float)az->y1, (float)az->x2, (float)az->y1, (float)(az->x1+az->x2)/2, (float)az->y2);
+                       break;
+                       
+               case AE_BOTTOM_TO_TOPLEFT:
+                       ui_draw_anti_tria((float)az->x1, (float)az->y2, (float)az->x2, (float)az->y2, (float)(az->x1+az->x2)/2, (float)az->y1);
+                       break;
+
+               case AE_LEFT_TO_TOPRIGHT:
+                       ui_draw_anti_tria((float)az->x2, (float)az->y1, (float)az->x2, (float)az->y2, (float)az->x1, (float)(az->y1+az->y2)/2);
+                       break;
+                       
+               case AE_RIGHT_TO_TOPLEFT:
+                       ui_draw_anti_tria((float)az->x1, (float)az->y1, (float)az->x1, (float)az->y2, (float)az->x2, (float)(az->y1+az->y2)/2);
+                       break;
+                       
+       }
+       
+       glDisable(GL_BLEND);
+}
 
 /* only exported for WM */
 void ED_area_overdraw(bContext *C)
@@ -248,7 +316,19 @@ void ED_area_overdraw(bContext *C)
                                if(az->type==AZONE_AREA) {
                                        area_draw_azone(az->x1, az->y1, az->x2, az->y2);
                                } else if(az->type==AZONE_REGION) {
-                                       region_draw_azone(az);
+                                       
+                                       if(az->ar) {
+                                               /* only display tab or icons when the region is hidden */
+                                               if (az->ar->flag & (RGN_FLAG_HIDDEN|RGN_FLAG_TOO_SMALL)) {
+                                       
+                                                       if(G.rt==2)
+                                                               region_draw_azone_tria(az);
+                                                       else if(G.rt==1)
+                                                               region_draw_azone_tab(az);
+                                                       else
+                                                               region_draw_azone_icon(az);
+                                               }
+                                       }
                                }
                                
                                az->do_draw= 0;
@@ -579,6 +659,96 @@ static void region_azone_icon(ScrArea *sa, AZone *az, ARegion *ar)
        }
 }
 
+#define AZONEPAD_TABW  18
+#define AZONEPAD_TABH  7
+
+/* region already made zero sized, in shape of edge */
+static void region_azone_tab(ScrArea *sa, AZone *az, ARegion *ar)
+{
+       AZone *azt;
+       int tot= 0, add;
+       
+       for(azt= sa->actionzones.first; azt; azt= azt->next) {
+               if(azt->edge == az->edge) tot++;
+       }
+       
+       switch(az->edge) {
+               case AE_TOP_TO_BOTTOMRIGHT:
+                       if(ar->winrct.ymax == sa->totrct.ymin) add= 1; else add= 0;
+                       az->x1= ar->winrct.xmax - 2*AZONEPAD_TABW;
+                       az->y1= ar->winrct.ymax - add;
+                       az->x2= ar->winrct.xmax - AZONEPAD_TABW;
+                       az->y2= ar->winrct.ymax - add + AZONEPAD_TABH;
+                       break;
+               case AE_BOTTOM_TO_TOPLEFT:
+                       az->x1= ar->winrct.xmin + AZONEPAD_TABW;
+                       az->y1= ar->winrct.ymin - AZONEPAD_TABH;
+                       az->x2= ar->winrct.xmin + 2*AZONEPAD_TABW;
+                       az->y2= ar->winrct.ymin;
+                       break;
+               case AE_LEFT_TO_TOPRIGHT:
+                       az->x1= ar->winrct.xmin + 1 - AZONEPAD_TABH;
+                       az->y1= ar->winrct.ymax - 2*AZONEPAD_TABW;
+                       az->x2= ar->winrct.xmin + 1;
+                       az->y2= ar->winrct.ymax - AZONEPAD_TABW;
+                       break;
+               case AE_RIGHT_TO_TOPLEFT:
+                       az->x1= ar->winrct.xmax - 1;
+                       az->y1= ar->winrct.ymax - 2*AZONEPAD_TABW;
+                       az->x2= ar->winrct.xmax - 1 + AZONEPAD_TABH;
+                       az->y2= ar->winrct.ymax - AZONEPAD_TABW;
+                       break;
+       }
+       /* rect needed for mouse pointer test */
+       BLI_init_rcti(&az->rect, az->x1, az->x2, az->y1, az->y2);
+}      
+
+#define AZONEPAD_TRIAW 16
+#define AZONEPAD_TRIAH 9
+
+
+/* region already made zero sized, in shape of edge */
+static void region_azone_tria(ScrArea *sa, AZone *az, ARegion *ar)
+{
+       AZone *azt;
+       int tot= 0, add;
+       
+       for(azt= sa->actionzones.first; azt; azt= azt->next) {
+               if(azt->edge == az->edge) tot++;
+       }
+       
+       switch(az->edge) {
+               case AE_TOP_TO_BOTTOMRIGHT:
+                       if(ar->winrct.ymax == sa->totrct.ymin) add= 1; else add= 0;
+                       az->x1= ar->winrct.xmax - 2*AZONEPAD_TRIAW;
+                       az->y1= ar->winrct.ymax - add;
+                       az->x2= ar->winrct.xmax - AZONEPAD_TRIAW;
+                       az->y2= ar->winrct.ymax - add + AZONEPAD_TRIAH;
+                       break;
+                       case AE_BOTTOM_TO_TOPLEFT:
+                       az->x1= ar->winrct.xmin + AZONEPAD_TRIAW;
+                       az->y1= ar->winrct.ymin - AZONEPAD_TRIAH;
+                       az->x2= ar->winrct.xmin + 2*AZONEPAD_TRIAW;
+                       az->y2= ar->winrct.ymin;
+                       break;
+                       case AE_LEFT_TO_TOPRIGHT:
+                       az->x1= ar->winrct.xmin + 1 - AZONEPAD_TRIAH;
+                       az->y1= ar->winrct.ymax - 2*AZONEPAD_TRIAW;
+                       az->x2= ar->winrct.xmin + 1;
+                       az->y2= ar->winrct.ymax - AZONEPAD_TRIAW;
+                       break;
+                       case AE_RIGHT_TO_TOPLEFT:
+                       az->x1= ar->winrct.xmax - 1;
+                       az->y1= ar->winrct.ymax - 2*AZONEPAD_TRIAW;
+                       az->x2= ar->winrct.xmax - 1 + AZONEPAD_TRIAH;
+                       az->y2= ar->winrct.ymax - AZONEPAD_TRIAW;
+                       break;
+       }
+       /* rect needed for mouse pointer test */
+       BLI_init_rcti(&az->rect, az->x1, az->x2, az->y1, az->y2);
+}      
+
+
 static void region_azone_initialize(ScrArea *sa, ARegion *ar, AZEdge edge) 
 {
        AZone *az;
@@ -589,8 +759,13 @@ static void region_azone_initialize(ScrArea *sa, ARegion *ar, AZEdge edge)
        az->ar= ar;
        az->edge= edge;
        
-       if (ar->flag & RGN_FLAG_HIDDEN) {
-               region_azone_icon(sa, az, ar);
+       if (ar->flag & (RGN_FLAG_HIDDEN|RGN_FLAG_TOO_SMALL)) {
+               if(G.rt==2)
+                       region_azone_tria(sa, az, ar);
+               else if(G.rt==1)
+                       region_azone_tab(sa, az, ar);
+               else
+                       region_azone_icon(sa, az, ar);
        } else {
                region_azone_edge(az, ar);
        }
@@ -790,15 +965,6 @@ static void region_rect_recursive(ScrArea *sa, ARegion *ar, rcti *remainder, int
        ar->winx= ar->winrct.xmax - ar->winrct.xmin + 1;
        ar->winy= ar->winrct.ymax - ar->winrct.ymin + 1;
        
-       /* restore test exception */
-       if(ar->alignment & RGN_SPLIT_PREV) {
-               if(ar->prev) {
-                       remainder= remainder_prev;
-                       ar->prev->winx= ar->prev->winrct.xmax - ar->prev->winrct.xmin + 1;
-                       ar->prev->winy= ar->prev->winrct.ymax - ar->prev->winrct.ymin + 1;
-               }
-       }
-
        /* set winrect for azones */
        if(ar->flag & (RGN_FLAG_HIDDEN|RGN_FLAG_TOO_SMALL)) {
                ar->winrct= *remainder;
@@ -814,12 +980,22 @@ static void region_rect_recursive(ScrArea *sa, ARegion *ar, rcti *remainder, int
                else /* prevent winrct to be valid */
                        ar->winrct.xmax= ar->winrct.xmin;
        }
+
+       /* restore prev-split exception */
+       if(ar->alignment & RGN_SPLIT_PREV) {
+               if(ar->prev) {
+                       remainder= remainder_prev;
+                       ar->prev->winx= ar->prev->winrct.xmax - ar->prev->winrct.xmin + 1;
+                       ar->prev->winy= ar->prev->winrct.ymax - ar->prev->winrct.ymin + 1;
+               }
+       }
+       
        /* in end, add azones, where appropriate */
        if(ar->regiontype == RGN_TYPE_HEADER && ar->winy + 6 > sa->winy) {
                /* The logic for this is: when the header takes up the full area,
                 * disallow hiding it to view the main window.
                 *
-                * Without this, uou can drag down the file selectors header and hide it
+                * Without this, you can drag down the file selectors header and hide it
                 * by accident very easily (highly annoying!), the value 6 is arbitrary
                 * but accounts for small common rounding problems when scaling the UI,
                 * must be minimum '4' */
@@ -833,7 +1009,7 @@ static void region_rect_recursive(ScrArea *sa, ARegion *ar, rcti *remainder, int
 
 static void area_calc_totrct(ScrArea *sa, int sizex, int sizey)
 {
-       short rt= CLAMPIS(G.rt, 0, 16);
+       short rt= 0; // CLAMPIS(G.rt, 0, 16);
 
        if(sa->v1->vec.x>0) sa->totrct.xmin= sa->v1->vec.x+1+rt;
        else sa->totrct.xmin= sa->v1->vec.x;
index 721ce82335191ee5ead55307c178aa0d85643aa5..80a65d3224eac3bc459e8f102051ab80dd0c0ceb 100644 (file)
@@ -910,7 +910,7 @@ static void drawscredge_area(ScrArea *sa, int sizex, int sizey, int center)
        short y2= sa->v3->vec.y;
        short a, rt;
        
-       rt= CLAMPIS(G.rt, 0, 16);
+       rt= 0; // CLAMPIS(G.rt, 0, 16);
        
        if(center==0) {
                cpack(0x505050);
index 0210b0dd78d3f99929a74e6cbe4e476974fb1ad8..e9ebe78da296d302b49217e932566d291c9a69ba 100644 (file)
@@ -792,7 +792,9 @@ void uiTemplateImage(uiLayout *layout, bContext *C, PointerRNA *ptr, const char
                                uiItemR(col, userptr, "frame_offset", 0, NULL, ICON_NONE);
 
                                col= uiLayoutColumn(split, 0);
-                               uiItemR(col, userptr, "fields_per_frame", 0, "Fields", ICON_NONE);
+                               row= uiLayoutRow(col, 0);
+                               uiLayoutSetActive(row, RNA_boolean_get(&imaptr, "use_fields"));
+                               uiItemR(row, userptr, "fields_per_frame", 0, "Fields", ICON_NONE);
                                uiItemR(col, userptr, "use_auto_refresh", 0, NULL, ICON_NONE);
                                uiItemR(col, userptr, "use_cyclic", 0, NULL, ICON_NONE);
                        }
index 71dd7b02e1cdbc6d9ab4d533e6c477f75619fbdb..a6a60035aa78255b8fe1c059b65d823d708cbc84 100644 (file)
@@ -2004,19 +2004,16 @@ static int node_duplicate_exec(bContext *C, wmOperator *UNUSED(op))
 {
        SpaceNode *snode= CTX_wm_space_node(C);
        bNodeTree *ntree= snode->edittree;
-       bNode *node, *newnode, *last;
+       bNode *node, *newnode, *lastnode;
+       bNodeLink *link, *newlink, *lastlink;
        
        ED_preview_kill_jobs(C);
        
-       last = ntree->nodes.last;
+       lastnode = ntree->nodes.last;
        for(node= ntree->nodes.first; node; node= node->next) {
                if(node->flag & SELECT) {
                        newnode = nodeCopyNode(ntree, node);
                        
-                       /* deselect old node, select the copy instead */
-                       node->flag &= ~(NODE_SELECT|NODE_ACTIVE);
-                       newnode->flag |= NODE_SELECT;
-                       
                        if(newnode->id) {
                                /* simple id user adjustment, node internal functions dont touch this
                                 * but operators and readfile.c do. */
@@ -2027,7 +2024,53 @@ static int node_duplicate_exec(bContext *C, wmOperator *UNUSED(op))
                }
                
                /* make sure we don't copy new nodes again! */
-               if (node==last)
+               if (node==lastnode)
+                       break;
+       }
+       
+       /* copy links between selected nodes
+        * NB: this depends on correct node->new_node and sock->new_sock pointers from above copy!
+        */
+       lastlink = ntree->links.last;
+       for (link=ntree->links.first; link; link=link->next) {
+               /* this creates new links between copied nodes,
+                * as well as input links from unselected (when fromnode==NULL) !
+                */
+               if (link->tonode && (link->tonode->flag & NODE_SELECT)) {
+                       newlink = MEM_callocN(sizeof(bNodeLink), "bNodeLink");
+                       newlink->flag = link->flag;
+                       newlink->tonode = link->tonode->new_node;
+                       newlink->tosock = link->tosock->new_sock;
+                       if (link->fromnode && (link->fromnode->flag & NODE_SELECT)) {
+                               newlink->fromnode = link->fromnode->new_node;
+                               newlink->fromsock = link->fromsock->new_sock;
+                       }
+                       else {
+                               /* input node not copied, this keeps the original input linked */
+                               newlink->fromnode = link->fromnode;
+                               newlink->fromsock = link->fromsock;
+                       }
+                       
+                       BLI_addtail(&ntree->links, newlink);
+               }
+               
+               /* make sure we don't copy new links again! */
+               if (link==lastlink)
+                       break;
+       }
+       
+       /* deselect old nodes, select the copies instead */
+       for(node= ntree->nodes.first; node; node= node->next) {
+               if(node->flag & SELECT) {
+                       /* has been set during copy above */
+                       newnode = node->new_node;
+                       
+                       node->flag &= ~(NODE_SELECT|NODE_ACTIVE);
+                       newnode->flag |= NODE_SELECT;
+               }
+               
+               /* make sure we don't copy new nodes again! */
+               if (node==lastnode)
                        break;
        }
        
index 6638a9d76d3f3424ad9e8ac911fc6e6e455f0fd6..3a6cebef1787f6c4c01312ed55d6a6d87bf4d257 100644 (file)
@@ -32,6 +32,7 @@
 #include "DNA_scene_types.h"
 
 #include "RNA_define.h"
+#include "RNA_enum_types.h"
 
 #include "rna_internal.h"
 
@@ -271,6 +272,12 @@ static void rna_def_render_engine(BlenderRNA *brna)
        prop= RNA_def_string(func, "info", "", 0, "Info", "");
        RNA_def_property_flag(prop, PROP_REQUIRED);
 
+       func= RNA_def_function(srna, "report", "RE_engine_report");
+       prop= RNA_def_enum_flag(func, "type", wm_report_items, 0, "Type", "");
+       RNA_def_property_flag(prop, PROP_REQUIRED);
+       prop= RNA_def_string(func, "message", "", 0, "Report Message", "");
+       RNA_def_property_flag(prop, PROP_REQUIRED);
+
        /* registration */
        RNA_define_verify_sdna(0);
 
index 0b350e804164696213e1383662465a2c2ec64f7b..4e60150e339e7c3a2098a383f22af619cebfe613 100644 (file)
@@ -172,6 +172,7 @@ static void displaceModifier_do(
        MDeformVert *dvert = NULL;
        int defgrp_index;
        float (*tex_co)[3];
+       float weight= 1.0f; /* init value unused but some compilers may complain */
 
        if(!dmd->texture) return;
        if(dmd->strength == 0.0f) return;
@@ -190,17 +191,10 @@ static void displaceModifier_do(
        for(i = 0; i < numVerts; ++i) {
                TexResult texres;
                float delta = 0, strength = dmd->strength;
-               MDeformWeight *def_weight = NULL;
 
                if(dvert) {
-                       int j;
-                       for(j = 0; j < dvert[i].totweight; ++j) {
-                               if(dvert[i].dw[j].def_nr == defgrp_index) {
-                                       def_weight = &dvert[i].dw[j];
-                                       break;
-                               }
-                       }
-                       if(!def_weight || def_weight->weight==0.0f) continue;
+                       weight= defvert_find_weight(dvert + i, defgrp_index);
+                       if(weight == 0.0f) continue;
                }
 
                texres.nor = NULL;
@@ -208,7 +202,7 @@ static void displaceModifier_do(
 
                delta = texres.tin - dmd->midlevel;
 
-               if(def_weight) strength *= def_weight->weight;
+               if(dvert) strength *= weight;
 
                delta *= strength;
                CLAMP(delta, -10000, 10000);
index 23f301249bafc1377bf239392f014039a47ca475..d9ed83a00b209f2d82ff3dfc33c56208531828c2 100644 (file)
@@ -218,7 +218,10 @@ void RE_TileProcessor(struct Render *re);
 
 /* only RE_NewRender() needed, main Blender render calls */
 void RE_BlenderFrame(struct Render *re, struct Main *bmain, struct Scene *scene, struct SceneRenderLayer *srl, struct Object *camera_override, unsigned int lay, int frame, const short write_still);
-void RE_BlenderAnim(struct Render *re, struct Main *bmain, struct Scene *scene, struct Object *camera_override, unsigned int lay, int sfra, int efra, int tfra, struct ReportList *reports);
+void RE_BlenderAnim(struct Render *re, struct Main *bmain, struct Scene *scene, struct Object *camera_override, unsigned int lay, int sfra, int efra, int tfra);
+
+/* error reporting */
+void RE_SetReports(struct Render *re, struct ReportList *reports);
 
 /* main preview render call */
 void RE_PreviewRender(struct Render *re, struct Main *bmain, struct Scene *scene);
@@ -242,7 +245,6 @@ void RE_stats_draw_cb       (struct Render *re, void *handle, void (*f)(void *handle,
 void RE_progress_cb    (struct Render *re, void *handle, void (*f)(void *handle, float));
 void RE_draw_lock_cb           (struct Render *re, void *handle, void (*f)(void *handle, int));
 void RE_test_break_cb  (struct Render *re, void *handle, int (*f)(void *handle));
-void RE_error_cb               (struct Render *re, void *handle, void (*f)(void *handle, const char *str));
 
 /* should move to kernel once... still unsure on how/where */
 float RE_filter_value(int type, float x);
@@ -264,7 +266,7 @@ void RE_zbuf_accumulate_vecblur(struct NodeBlurData *nbd, int xsize, int ysize,
 #define RE_BAKE_ALPHA                          11
 #define RE_BAKE_EMIT                           12
 
-void RE_Database_Baking(struct Render *re, struct Main *bmain, struct Scene *scene, unsigned int lay, int type, struct Object *actob);
+void RE_Database_Baking(struct Render *re, struct Main *bmain, struct Scene *scene, unsigned int lay, const int type, struct Object *actob);
 
 void RE_DataBase_GetView(struct Render *re, float mat[][4]);
 void RE_GetCameraWindow(struct Render *re, struct Object *camera, int frame, float mat[][4]);
@@ -308,11 +310,12 @@ void RE_engine_end_result(RenderEngine *engine, struct RenderResult *result);
 
 int RE_engine_test_break(RenderEngine *engine);
 void RE_engine_update_stats(RenderEngine *engine, const char *stats, const char *info);
+void RE_engine_report(RenderEngine *engine, int type, const char *msg);
 
 void RE_engines_init(void);
 void RE_engines_exit(void);
 
-int RE_is_rendering_allowed(struct Scene *scene, struct Object *camera_override, void *erh, void (*error)(void *handle, const char *str));
+int RE_is_rendering_allowed(struct Scene *scene, struct Object *camera_override, struct ReportList *reports);
 
 #endif /* RE_PIPELINE_H */
 
index b2535ebc9ea8763b904629dd113a5b48b63bd24e..13ca40bfd206bd29d6b94d7084aa3b198e0e46c2 100644 (file)
@@ -60,6 +60,7 @@ struct RenderBuckets;
 struct ObjectInstanceRen;
 struct RayObject;
 struct RayFace;
+struct ReportList;
 struct Main;
 
 #define TABLEINITSIZE 1024
@@ -252,10 +253,9 @@ struct Render
        int (*test_break)(void *handle);
        void *tbh;
        
-       void (*error)(void *handle, const char *str);
-       void *erh;
-       
        RenderStats i;
+
+       struct ReportList *reports;
 };
 
 /* ------------------------------------------------------------------------- */
index 76c3a497639b428722bbafd49dda2df3ce98a33e..3bc65c48701b977e0fc3f5d3055dc16e93603c2c 100644 (file)
@@ -5680,13 +5680,14 @@ void RE_Database_FromScene_Vectors(Render *re, Main *bmain, Scene *sce, unsigned
    RE_BAKE_DISPLACEMENT:for baking, no lamps, only selected objects
    RE_BAKE_SHADOW: for baking, only shadows, but all objects
 */
-void RE_Database_Baking(Render *re, Main *bmain, Scene *scene, unsigned int lay, int type, Object *actob)
+void RE_Database_Baking(Render *re, Main *bmain, Scene *scene, unsigned int lay, const int type, Object *actob)
 {
        Object *camera;
        float mat[4][4];
        float amb[3];
-       int onlyselected, nolamps;
-       
+       const short onlyselected= !ELEM3(type, RE_BAKE_LIGHT, RE_BAKE_ALL, RE_BAKE_SHADOW);
+       const short nolamps= ELEM3(type, RE_BAKE_NORMALS, RE_BAKE_TEXTURE, RE_BAKE_DISPLACEMENT);
+
        re->main= bmain;
        re->scene= scene;
        re->lay= lay;
@@ -5736,7 +5737,15 @@ void RE_Database_Baking(Render *re, Main *bmain, Scene *scene, unsigned int lay,
                unit_m4(mat);
                RE_SetView(re, mat);
        }
-       
+       copy_m3_m4(re->imat, re->viewinv);
+
+       /* TODO: deep shadow maps + baking + strands */
+       /* strands use the window matrix and view size, there is to correct
+        * window matrix but at least avoids malloc and crash loop [#27807] */
+       unit_m4(re->winmat);
+       re->winx= re->winy= 256;
+       /* done setting dummy values */
+
        init_render_world(re);  /* do first, because of ambient. also requires re->osa set correct */
        if(re->r.mode & R_RAYTRACE) {
                init_render_qmcsampler(re);
@@ -5755,9 +5764,6 @@ void RE_Database_Baking(Render *re, Main *bmain, Scene *scene, unsigned int lay,
        set_node_shader_lamp_loop(shade_material_loop);
        
        /* MAKE RENDER DATA */
-       nolamps= !ELEM3(type, RE_BAKE_LIGHT, RE_BAKE_ALL, RE_BAKE_SHADOW);
-       onlyselected= ELEM3(type, RE_BAKE_NORMALS, RE_BAKE_TEXTURE, RE_BAKE_DISPLACEMENT);
-
        database_init_objects(re, lay, nolamps, onlyselected, actob, 0);
 
        set_material_lightgroups(re);
index b1c9820337c779f6c03c9d41233a60f0ac35832d..1d4014aac3e2a8a6e4694e6ce228797d1cacad92 100644 (file)
@@ -128,7 +128,7 @@ Render R;
 
 /* ********* alloc and free ******** */
 
-static int do_write_image_or_movie(Render *re, Scene *scene, bMovieHandle *mh, ReportList *reports, const char *name_override);
+static int do_write_image_or_movie(Render *re, Scene *scene, bMovieHandle *mh, const char *name_override);
 
 static volatile int g_break= 0;
 static int thread_break(void *UNUSED(arg))
@@ -141,7 +141,6 @@ static void result_nothing(void *UNUSED(arg), RenderResult *UNUSED(rr)) {}
 static void result_rcti_nothing(void *UNUSED(arg), RenderResult *UNUSED(rr), volatile struct rcti *UNUSED(rect)) {}
 static void stats_nothing(void *UNUSED(arg), RenderStats *UNUSED(rs)) {}
 static void float_nothing(void *UNUSED(arg), float UNUSED(val)) {}
-static void print_error(void *UNUSED(arg), const char *str) {printf("ERROR: %s\n", str);}
 static int default_break(void *UNUSED(arg)) {return G.afbreek == 1;}
 
 static void stats_background(void *UNUSED(arg), RenderStats *rs)
@@ -1190,13 +1189,12 @@ void RE_InitRenderCB(Render *re)
        re->display_draw= result_rcti_nothing;
        re->progress= float_nothing;
        re->test_break= default_break;
-       re->error= print_error;
        if(G.background)
                re->stats_draw= stats_background;
        else
                re->stats_draw= stats_nothing;
        /* clear callback handles */
-       re->dih= re->dch= re->ddh= re->sdh= re->prh= re->tbh= re->erh= NULL;
+       re->dih= re->dch= re->ddh= re->sdh= re->prh= re->tbh= NULL;
 }
 
 /* only call this while you know it will remove the link too */
@@ -1251,7 +1249,7 @@ void RE_InitState(Render *re, Render *source, RenderData *rd, SceneRenderLayer *
        
        if(re->rectx < 2 || re->recty < 2 || (BKE_imtype_is_movie(rd->imtype) &&
                                                                                  (re->rectx < 16 || re->recty < 16) )) {
-               re->error(re->erh, "Image too small");
+               BKE_report(re->reports, RPT_ERROR, "Image too small");
                re->ok= 0;
                return;
        }
@@ -1417,11 +1415,6 @@ void RE_test_break_cb(Render *re, void *handle, int (*f)(void *handle))
        re->test_break= f;
        re->tbh= handle;
 }
-void RE_error_cb(Render *re, void *handle, void (*f)(void *handle, const char *str))
-{
-       re->error= f;
-       re->erh= handle;
-}
 
 
 /* ********* add object data (later) ******** */
@@ -2710,14 +2703,14 @@ static int check_valid_camera(Scene *scene, Object *camera_override)
        return 1;
 }
 
-int RE_is_rendering_allowed(Scene *scene, Object *camera_override, void *erh, void (*error)(void *handle, const char *str))
+int RE_is_rendering_allowed(Scene *scene, Object *camera_override, ReportList *reports)
 {
        SceneRenderLayer *srl;
        
        if(scene->r.mode & R_BORDER) {
                if(scene->r.border.xmax <= scene->r.border.xmin ||
                   scene->r.border.ymax <= scene->r.border.ymin) {
-                       error(erh, "No border area selected.");
+                       BKE_report(reports, RPT_ERROR, "No border area selected.");
                        return 0;
                }
        }
@@ -2728,13 +2721,13 @@ int RE_is_rendering_allowed(Scene *scene, Object *camera_override, void *erh, vo
                scene_unique_exr_name(scene, str, 0);
                
                if (BLI_is_writable(str)==0) {
-                       error(erh, "Can not save render buffers, check the temp default path");
+                       BKE_report(reports, RPT_ERROR, "Can not save render buffers, check the temp default path");
                        return 0;
                }
                
                /* no fullsample and edge */
                if((scene->r.scemode & R_FULL_SAMPLE) && (scene->r.mode & R_EDGE)) {
-                       error(erh, "Full Sample doesn't support Edge Enhance");
+                       BKE_report(reports, RPT_ERROR, "Full Sample doesn't support Edge Enhance");
                        return 0;
                }
                
@@ -2748,7 +2741,7 @@ int RE_is_rendering_allowed(Scene *scene, Object *camera_override, void *erh, vo
                        bNode *node;
                
                        if(ntree==NULL) {
-                               error(erh, "No Nodetree in Scene");
+                               BKE_report(reports, RPT_ERROR, "No Nodetree in Scene");
                                return 0;
                        }
                        
@@ -2757,13 +2750,13 @@ int RE_is_rendering_allowed(Scene *scene, Object *camera_override, void *erh, vo
                                        break;
                        
                        if(node==NULL) {
-                               error(erh, "No Render Output Node in Scene");
+                               BKE_report(reports, RPT_ERROR, "No Render Output Node in Scene");
                                return 0;
                        }
                        
                        if(scene->r.scemode & R_FULL_SAMPLE) {
                                if(composite_needs_render(scene, 0)==0) {
-                                       error(erh, "Full Sample AA not supported without 3d rendering");
+                                       BKE_report(reports, RPT_ERROR, "Full Sample AA not supported without 3d rendering");
                                        return 0;
                                }
                        }
@@ -2772,7 +2765,7 @@ int RE_is_rendering_allowed(Scene *scene, Object *camera_override, void *erh, vo
        
         /* check valid camera, without camera render is OK (compo, seq) */
        if(!check_valid_camera(scene, camera_override)) {
-               error(erh, "No camera");
+               BKE_report(reports, RPT_ERROR, "No camera");
                return 0;
        }
        
@@ -2782,7 +2775,7 @@ int RE_is_rendering_allowed(Scene *scene, Object *camera_override, void *erh, vo
        /* forbidden combinations */
        if(scene->r.mode & R_PANORAMA) {
                if(scene->r.mode & R_ORTHO) {
-                       error(erh, "No Ortho render possible for Panorama");
+                       BKE_report(reports, RPT_ERROR, "No Ortho render possible for Panorama");
                        return 0;
                }
        }
@@ -2798,13 +2791,13 @@ int RE_is_rendering_allowed(Scene *scene, Object *camera_override, void *erh, vo
                if(!(srl->layflag & SCE_LAY_DISABLE))
                        break;
        if(srl==NULL) {
-               error(erh, "All RenderLayers are disabled");
+               BKE_report(reports, RPT_ERROR, "All RenderLayers are disabled");
                return 0;
        }
        
        /* renderer */
        if(!ELEM(scene->r.renderer, R_INTERN, R_YAFRAY)) {
-               error(erh, "Unknown render engine set");
+               BKE_report(reports, RPT_ERROR, "Unknown render engine set");
                return 0;
        }
 
@@ -2906,6 +2899,11 @@ static int render_initialize_from_main(Render *re, Main *bmain, Scene *scene, Sc
        return 1;
 }
 
+void RE_SetReports(Render *re, ReportList *reports)
+{
+       re->reports= reports;
+}
+
 /* general Blender frame render call */
 void RE_BlenderFrame(Render *re, Main *bmain, Scene *scene, SceneRenderLayer *srl, Object *camera_override, unsigned int lay, int frame, const short write_still)
 {
@@ -2931,7 +2929,7 @@ void RE_BlenderFrame(Render *re, Main *bmain, Scene *scene, SceneRenderLayer *sr
                                BKE_makepicstring(name, scene->r.pic, scene->r.cfra, scene->r.imtype, scene->r.scemode & R_EXTENSION, FALSE);
        
                                /* reports only used for Movie */
-                               do_write_image_or_movie(re, scene, NULL, NULL, name);
+                               do_write_image_or_movie(re, scene, NULL, name);
                        }
                }
 
@@ -2942,7 +2940,7 @@ void RE_BlenderFrame(Render *re, Main *bmain, Scene *scene, SceneRenderLayer *sr
        G.rendering= 0;
 }
 
-static int do_write_image_or_movie(Render *re, Scene *scene, bMovieHandle *mh, ReportList *reports, const char *name_override)
+static int do_write_image_or_movie(Render *re, Scene *scene, bMovieHandle *mh, const char *name_override)
 {
        char name[FILE_MAX];
        RenderResult rres;
@@ -2960,7 +2958,7 @@ static int do_write_image_or_movie(Render *re, Scene *scene, bMovieHandle *mh, R
                        dofree = 1;
                }
                RE_ResultGet32(re, (unsigned int *)rres.rect32);
-               ok= mh->append_movie(&re->r, scene->r.cfra, rres.rect32, rres.rectx, rres.recty, reports);
+               ok= mh->append_movie(&re->r, scene->r.cfra, rres.rect32, rres.rectx, rres.recty, re->reports);
                if(dofree) {
                        MEM_freeN(rres.rect32);
                }
@@ -3042,7 +3040,7 @@ static int do_write_image_or_movie(Render *re, Scene *scene, bMovieHandle *mh, R
 }
 
 /* saves images to disk */
-void RE_BlenderAnim(Render *re, Main *bmain, Scene *scene, Object *camera_override, unsigned int lay, int sfra, int efra, int tfra, ReportList *reports)
+void RE_BlenderAnim(Render *re, Main *bmain, Scene *scene, Object *camera_override, unsigned int lay, int sfra, int efra, int tfra)
 {
        bMovieHandle *mh= BKE_get_movie_handle(scene->r.imtype);
        int cfrao= scene->r.cfra;
@@ -3055,14 +3053,14 @@ void RE_BlenderAnim(Render *re, Main *bmain, Scene *scene, Object *camera_overri
        /* ugly global still... is to prevent renderwin events and signal subsurfs etc to make full resol */
        /* is also set by caller renderwin.c */
        G.rendering= 1;
-       
+
        if(BKE_imtype_is_movie(scene->r.imtype))
-               if(!mh->start_movie(scene, &re->r, re->rectx, re->recty, reports))
+               if(!mh->start_movie(scene, &re->r, re->rectx, re->recty, re->reports))
                        G.afbreek= 1;
 
        if (mh->get_next_frame) {
                while (!(G.afbreek == 1)) {
-                       int nf = mh->get_next_frame(&re->r, reports);
+                       int nf = mh->get_next_frame(&re->r, re->reports);
                        if (nf >= 0 && nf >= scene->r.sfra && nf <= scene->r.efra) {
                                scene->r.cfra = re->r.cfra = nf;
 
@@ -3071,7 +3069,7 @@ void RE_BlenderAnim(Render *re, Main *bmain, Scene *scene, Object *camera_overri
                                do_render_all_options(re);
 
                                if(re->test_break(re->tbh) == 0) {
-                                       if(!do_write_image_or_movie(re, scene, mh, reports, NULL))
+                                       if(!do_write_image_or_movie(re, scene, mh, NULL))
                                                G.afbreek= 1;
                                }
 
@@ -3135,7 +3133,7 @@ void RE_BlenderAnim(Render *re, Main *bmain, Scene *scene, Object *camera_overri
                        
                        if(re->test_break(re->tbh) == 0) {
                                if(!G.afbreek)
-                                       if(!do_write_image_or_movie(re, scene, mh, reports, NULL))
+                                       if(!do_write_image_or_movie(re, scene, mh, NULL))
                                                G.afbreek= 1;
                        }
                        else
@@ -3343,6 +3341,11 @@ void RE_engine_update_stats(RenderEngine *engine, const char *stats, const char
        re->i.statstr= NULL;
 }
 
+void RE_engine_report(RenderEngine *engine, int type, const char *msg)
+{
+       BKE_report(engine->re->reports, type, msg);
+}
+
 /* loads in image into a result, size must match
  * x/y offsets are only used on a partial copy when dimensions dont match */
 void RE_layer_load_from_file(RenderLayer *layer, ReportList *reports, const char *filename, int x, int y)
index fff219babd228e6e23969be41a8235642077f39d..8d70ae4e63d14f494c5cea4963acb6a7dec9c148 100644 (file)
@@ -395,6 +395,7 @@ void RE_AcquireResultImage(struct Render *re, struct RenderResult *rr){}
 void RE_ReleaseResult(struct Render *re){}
 void RE_ReleaseResultImage(struct Render *re){}
 int RE_engine_test_break(struct RenderEngine *engine){return 0;}
+void RE_engine_report(struct RenderEngine *engine, int type, const char *msg) {}
 
 /* python */
 struct wmOperatorType *WM_operatortype_find(const char *idname, int quiet){return (struct wmOperatorType *) NULL;}
index e451a2ac977112633b1c771054af1dac655049f7..e7f399dc627c0bd0348464a42f2b3bbd4fa90b7c 100644 (file)
@@ -797,7 +797,9 @@ static int render_frame(int argc, const char **argv, void *data)
 
                        frame = MIN2(MAXFRAME, MAX2(MINAFRAME, frame));
 
-                       RE_BlenderAnim(re, bmain, scene, NULL, scene->lay, frame, frame, scene->r.frame_step, &reports);
+                       RE_SetReports(re, &reports);
+                       RE_BlenderAnim(re, bmain, scene, NULL, scene->lay, frame, frame, scene->r.frame_step);
+                       RE_SetReports(re, NULL);
                        return 1;
                } else {
                        printf("\nError: frame number must follow '-f / --render-frame'.\n");
@@ -818,7 +820,9 @@ static int render_animation(int UNUSED(argc), const char **UNUSED(argv), void *d
                Render *re= RE_NewRender(scene->id.name);
                ReportList reports;
                BKE_reports_init(&reports, RPT_PRINT);
-               RE_BlenderAnim(re, bmain, scene, NULL, scene->lay, scene->r.sfra, scene->r.efra, scene->r.frame_step, &reports);
+               RE_SetReports(re, &reports);
+               RE_BlenderAnim(re, bmain, scene, NULL, scene->lay, scene->r.sfra, scene->r.efra, scene->r.frame_step);
+               RE_SetReports(re, NULL);
        } else {
                printf("\nError: no blend loaded. cannot use '-a'.\n");
        }