Merge branch 'master' into blender2.8
authorBastien Montagne <montagne29@wanadoo.fr>
Thu, 23 Feb 2017 21:09:09 +0000 (22:09 +0100)
committerBastien Montagne <montagne29@wanadoo.fr>
Thu, 23 Feb 2017 21:09:09 +0000 (22:09 +0100)
doc/python_api/sphinx_doc_gen.py
doc/python_api/sphinx_doc_update.py
intern/cycles/render/session.cpp
intern/cycles/util/util_half.h
intern/cycles/util/util_image_impl.h
release/scripts/startup/bl_ui/space_sequencer.py
source/blender/editors/space_node/node_edit.c
source/blender/makesrna/intern/rna_scene.c

index ec3131ca19e8271eae22d783ced9b7299431cd37..47bb323e57409edf54140a46a782f5910f7ec0f3 100644 (file)
@@ -427,9 +427,9 @@ if BLENDER_REVISION != "Unknown":
     BLENDER_VERSION_DOTS += " " + BLENDER_REVISION          # '2.62.1 SHA1'
 
 BLENDER_VERSION_PATH = "_".join(blender_version_strings)    # '2_62_1'
-if bpy.app.version_cycle == "release":
-    BLENDER_VERSION_PATH = "%s%s_release" % ("_".join(blender_version_strings[:2]),
-                                             bpy.app.version_char)   # '2_62_release'
+if bpy.app.version_cycle in {"rc", "release"}:
+    # '2_62a_release'
+    BLENDER_VERSION_PATH = "%s%s_release" % ("_".join(blender_version_strings[:2]), bpy.app.version_char)
 
 # --------------------------DOWNLOADABLE FILES----------------------------------
 
index 3d48c1145e11fe8d6bd3695cf26c2ad03ab6a440..884ddeecffb7fcc8905886c5c9496853fbfa260e 100755 (executable)
@@ -96,6 +96,10 @@ def main():
 
     rsync_base = "rsync://%s@%s:%s" % (args.user, args.rsync_server, args.rsync_root)
 
+    blenver = blenver_zip = ""
+    api_name = ""
+    is_release = False
+
     # I) Update local mirror using rsync.
     rsync_mirror_cmd = ("rsync", "--delete-after", "-avzz", rsync_base, args.mirror_dir)
     subprocess.run(rsync_mirror_cmd, env=dict(os.environ, RSYNC_PASSWORD=args.password))
@@ -108,19 +112,23 @@ def main():
         subprocess.run(doc_gen_cmd)
 
         # III) Get Blender version info.
-        blenver = blenver_zip = ""
         getver_file = os.path.join(tmp_dir, "blendver.txt")
         getver_script = (""
             "import sys, bpy\n"
             "with open(sys.argv[-1], 'w') as f:\n"
-            "    f.write('%d_%d%s_release\\n' % (bpy.app.version[0], bpy.app.version[1], bpy.app.version_char)\n"
-            "            if bpy.app.version_cycle in {'rc', 'release'} else '%d_%d_%d\\n' % bpy.app.version)\n"
-            "    f.write('%d_%d_%d' % bpy.app.version)\n")
+            "    is_release = bpy.app.version_cycle in {'rc', 'release'}\n"
+            "    branch = bpy.app.build_branch.split()[0].decode()\n"
+            "    f.write('%d\\n' % is_release)\n"
+            "    f.write('%d.%d%s\\n' % (bpy.app.version[0], bpy.app.version[1], bpy.app.version_char)\n"
+            "            if is_release else '%s\\n' % branch)\n"
+            "    f.write('%d_%d%s_release' % (bpy.app.version[0], bpy.app.version[1], bpy.app.version_char)\n"
+            "            if is_release else '%d_%d_%d' % bpy.app.version)\n")
         get_ver_cmd = (args.blender, "--background", "-noaudio", "--factory-startup", "--python-exit-code", "1",
                        "--python-expr", getver_script, "--", getver_file)
         subprocess.run(get_ver_cmd)
         with open(getver_file) as f:
-            blenver, blenver_zip = f.read().split("\n")
+            is_release, blenver, blenver_zip = f.read().split("\n")
+            is_release = bool(int(is_release))
         os.remove(getver_file)
 
         # IV) Build doc.
@@ -132,7 +140,7 @@ def main():
         os.chdir(curr_dir)
 
         # V) Cleanup existing matching dir in server mirror (if any), and copy new doc.
-        api_name = "blender_python_api_%s" % blenver
+        api_name = blenver
         api_dir = os.path.join(args.mirror_dir, api_name)
         if os.path.exists(api_dir):
             shutil.rmtree(api_dir)
@@ -150,19 +158,15 @@ def main():
     os.rename(zip_path, os.path.join(api_dir, "%s.zip" % zip_name))
 
     # VII) Create symlinks and html redirects.
-    #~ os.symlink(os.path.join(DEFAULT_SYMLINK_ROOT, api_name, "contents.html"), os.path.join(api_dir, "index.html"))
     os.symlink("./contents.html", os.path.join(api_dir, "index.html"))
-    if blenver.endswith("release"):
-        symlink = os.path.join(args.mirror_dir, "blender_python_api_current")
+    if is_release:
+        symlink = os.path.join(args.mirror_dir, "current")
         os.remove(symlink)
         os.symlink("./%s" % api_name, symlink)
         with open(os.path.join(args.mirror_dir, "250PythonDoc/index.html"), 'w') as f:
             f.write("<html><head><title>Redirecting...</title><meta http-equiv=\"REFRESH\""
                     "content=\"0;url=../%s/\"></head><body>Redirecting...</body></html>" % api_name)
     else:
-        symlink = os.path.join(args.mirror_dir, "blender_python_api_master")
-        os.remove(symlink)
-        os.symlink("./%s" % api_name, symlink)
         with open(os.path.join(args.mirror_dir, "blender_python_api/index.html"), 'w') as f:
             f.write("<html><head><title>Redirecting...</title><meta http-equiv=\"REFRESH\""
                     "content=\"0;url=../%s/\"></head><body>Redirecting...</body></html>" % api_name)
index 7c01934cfd82fd8222e2d017b5941aaabb562004..420866c9436c9ebd9641a9bf82f31dad25beb822 100644 (file)
@@ -230,7 +230,9 @@ void Session::run_gpu()
                                while(1) {
                                        scoped_timer pause_timer;
                                        pause_cond.wait(pause_lock);
-                                       progress.add_skip_time(pause_timer, params.background);
+                                       if(pause) {
+                                               progress.add_skip_time(pause_timer, params.background);
+                                       }
 
                                        update_status_time(pause, no_tiles);
                                        progress.set_update();
@@ -520,7 +522,9 @@ void Session::run_cpu()
                                while(1) {
                                        scoped_timer pause_timer;
                                        pause_cond.wait(pause_lock);
-                                       progress.add_skip_time(pause_timer, params.background);
+                                       if(pause) {
+                                               progress.add_skip_time(pause_timer, params.background);
+                                       }
 
                                        update_status_time(pause, no_tiles);
                                        progress.set_update();
index 5db3384cda4d390f7260619419d34385d9b259dc..c1a47d58c55b1dadd1bc55160995171492d92501 100644 (file)
@@ -18,6 +18,7 @@
 #define __UTIL_HALF_H__
 
 #include "util_types.h"
+#include "util_math.h"
 
 #ifdef __KERNEL_SSE2__
 #include "util_simd.h"
@@ -110,6 +111,28 @@ ccl_device_inline float4 half4_to_float4(half4 h)
        return f;
 }
 
+ccl_device_inline half float_to_half(float f)
+{
+       const uint u = __float_as_uint(f);
+       /* Sign bit, shifted to it's position. */
+       uint sign_bit = u & 0x80000000;
+       sign_bit >>= 16;
+       /* Exponent. */
+       uint exponent_bits = u & 0x7f800000;
+       /* Non-sign bits. */
+       uint value_bits = u & 0x7fffffff;
+       value_bits >>= 13;  /* Align mantissa on MSB. */
+       value_bits -= 0x1c000;  /* Adjust bias. */
+       /* Flush-to-zero. */
+       value_bits = (exponent_bits < 0x38800000) ? 0 : value_bits;
+       /* Clamp-to-max. */
+       value_bits = (exponent_bits > 0x47000000) ? 0x7bff : value_bits;
+       /* Denormals-as-zero. */
+       value_bits = (exponent_bits == 0 ? 0 : value_bits);
+       /* Re-insert sign bit and return. */
+       return (value_bits | sign_bit);
+}
+
 #endif
 
 #endif
index 73ecfda0855284e9cc04f7df66a4343c95d56bd5..4daf1eaac2279e416df489c2c70d4f733b5b959d 100644 (file)
@@ -19,6 +19,7 @@
 
 #include "util_algorithm.h"
 #include "util_debug.h"
+#include "util_half.h"
 #include "util_image.h"
 
 CCL_NAMESPACE_BEGIN
@@ -38,6 +39,52 @@ const T *util_image_read(const vector<T>& pixels,
        return &pixels[index];
 }
 
+/* Cast input pixel from unknown storage to float. */
+template<typename T>
+inline float cast_to_float(T value);
+
+template<>
+inline float cast_to_float(float value)
+{
+       return value;
+}
+template<>
+inline float cast_to_float(uchar value)
+{
+       return (float)value / 255.0f;
+}
+template<>
+inline float cast_to_float(half value)
+{
+       return half_to_float(value);
+}
+
+/* Cast float value to output pixel type. */
+template<typename T>
+inline T cast_from_float(float value);
+
+template<>
+inline float cast_from_float(float value)
+{
+       return value;
+}
+template<>
+inline uchar cast_from_float(float value)
+{
+       if(value < 0.0f) {
+               return 0;
+       }
+       else if(value > (1.0f - 0.5f / 255.0f)) {
+               return 255;
+       }
+       return (uchar)((255.0f * value) + 0.5f);
+}
+template<>
+inline half cast_from_float(float value)
+{
+       return float_to_half(value);
+}
+
 template<typename T>
 void util_image_downscale_sample(const vector<T>& pixels,
                                  const size_t width,
@@ -71,15 +118,22 @@ void util_image_downscale_sample(const vector<T>& pixels,
                                                                 components,
                                                                 nx, ny, nz);
                                for(size_t k = 0; k < components; ++k) {
-                                       accum[k] += pixel[k];
+                                       accum[k] += cast_to_float(pixel[k]);
                                }
                                ++count;
                        }
                }
        }
-       const float inv_count = 1.0f / (float)count;
-       for(size_t k = 0; k < components; ++k) {
-               result[k] = T(accum[k] * inv_count);
+       if(count != 0) {
+               const float inv_count = 1.0f / (float)count;
+               for(size_t k = 0; k < components; ++k) {
+                       result[k] = cast_from_float<T>(accum[k] * inv_count);
+               }
+       }
+       else {
+               for(size_t k = 0; k < components; ++k) {
+                       result[k] = T(0.0f);
+               }
        }
 }
 
index 8ab5b4724b84721013568db792cf6a46a6e4c7f6..23697c5e5eb7c50d6468c467ad6cc89161926556 100644 (file)
@@ -683,7 +683,7 @@ class SEQUENCER_PT_effect(SequencerButtonsPanel, Panel):
                         row.label("")
             else:
                 col.separator()
-                col.label(text="Two or more channels are needed below this strip.", icon="INFO")
+                col.label(text="Two or more channels are needed below this strip", icon="INFO")
 
 
         elif strip.type == 'TEXT':
index ffe510016ff2486b23597c825897abf2319bd7c4..8a61857675c0764c335b84679c8cf12f04668650 100644 (file)
@@ -582,7 +582,7 @@ void snode_set_context(const bContext *C)
                }
        }
        
-       if (snode->nodetree != ntree || snode->id != id || snode->from != from) {
+       if (snode->nodetree != ntree || snode->id != id || snode->from != from || snode->treepath.last == NULL) {
                ED_node_tree_start(snode, ntree, id, from);
        }
        
index 211063fa03b62310c9b3399b33da25b529229141..86140eaaa05c9f23d5d5ef47b74553d96c199fee 100644 (file)
@@ -418,7 +418,7 @@ EnumPropertyItem rna_enum_gpencil_interpolation_mode_items[] = {
        /* interpolation */
        {0, "", 0, N_("Interpolation"), "Standard transitions between keyframes"},
        {GP_IPO_LINEAR,   "LINEAR", ICON_IPO_LINEAR, "Linear", "Straight-line interpolation between A and B (i.e. no ease in/out)"},
-       {GP_IPO_CURVEMAP, "CUSTOM", ICON_IPO_BEZIER, "Custom", "Custom interpolation defined using a curvemap"},
+       {GP_IPO_CURVEMAP, "CUSTOM", ICON_IPO_BEZIER, "Custom", "Custom interpolation defined using a curve map"},
        
        /* easing */
        {0, "", 0, N_("Easing (by strength)"), "Predefined inertial transitions, useful for motion graphics (from least to most ''dramatic'')"},