Merge branch 'master' into blender2.8
authorBastien Montagne <montagne29@wanadoo.fr>
Thu, 11 Jan 2018 13:35:36 +0000 (14:35 +0100)
committerBastien Montagne <montagne29@wanadoo.fr>
Thu, 11 Jan 2018 13:35:36 +0000 (14:35 +0100)
Conflicts:
source/blender/blenkernel/intern/blender.c
source/blender/makesdna/DNA_ID.h

intern/cycles/kernel/geom/geom_object.h
release/scripts/startup/bl_ui/space_userpref.py
source/blender/blenkernel/intern/blender.c
source/blender/editors/interface/resources.c
source/blender/editors/screen/area.c
source/blender/editors/transform/transform_orientations.c
source/blender/makesdna/DNA_userdef_types.h
source/blender/makesrna/intern/rna_userdef.c

index d77c40f234823b5b3e3e898473cbbc1ada88cf98..fa0dff4bd57b42afbf1a1625a1575c7804c00af3 100644 (file)
@@ -175,6 +175,10 @@ ccl_device_inline void object_inverse_normal_transform(KernelGlobals *kg, const
                Transform tfm = object_fetch_transform(kg, sd->object, OBJECT_TRANSFORM);
                *N = normalize(transform_direction_transposed(&tfm, *N));
        }
+       else if(sd->type == PRIMITIVE_LAMP) {
+               Transform tfm = lamp_fetch_transform(kg, sd->lamp, false);
+               *N = normalize(transform_direction_transposed(&tfm, *N));
+       }
 #endif
 }
 
index 0abb187679856953ef6ba291aff451f2823610d1..1089b5c699d48e8b403a4c7ed7ffe04324ea27af 100644 (file)
@@ -318,6 +318,9 @@ class USERPREF_PT_interface(Panel):
         col.separator()
         col.separator()
 
+        col.label(text="Screen:")
+        col.prop(view, "show_layout_ui")
+
         col.prop(view, "show_splash")
 
 
index 0b368df57eddf3c11552d21ab0eb00f1fbf319fd..d03be79baade1514ab06b866758df0f5865952fb 100644 (file)
@@ -262,6 +262,16 @@ void BKE_blender_userdef_app_template_data_swap(UserDef *userdef_a, UserDef *use
        SWAP(ListBase, userdef_a->id, userdef_b->id); \
 } ((void)0)
 
+#define FLAG_SWAP(id, ty, flags) { \
+       CHECK_TYPE(&(userdef_a->id), ty *); \
+       const ty f = flags; \
+       const ty a = userdef_a->id; \
+       const ty b = userdef_b->id; \
+        userdef_a->id = (userdef_a->id & ~f) | (b & f); \
+        userdef_b->id = (userdef_b->id & ~f) | (a & f); \
+} ((void)0)
+
+
        LIST_SWAP(uistyles);
        LIST_SWAP(uifonts);
        LIST_SWAP(themes);
@@ -276,9 +286,12 @@ void BKE_blender_userdef_app_template_data_swap(UserDef *userdef_a, UserDef *use
 
        DATA_SWAP(manipulator_flag);
 
+       FLAG_SWAP(uiflag, int, USER_LOCK_UI_LAYOUT);
+
 #undef SWAP_TYPELESS
-#undef LIST_SWAP
 #undef DATA_SWAP
+#undef LIST_SWAP
+#undef FLAG_SWAP
 }
 
 void BKE_blender_userdef_app_template_data_set(UserDef *userdef)
index 2eae452debb358bb1aca508bb5744b683a724711..788c5fb3913f4b7ec3b8fd30096cc0a93bca20f6 100644 (file)
@@ -2923,7 +2923,7 @@ void init_userdef_do_versions(void)
                    USER_FLAG_DEPRECATED_6 | USER_FLAG_DEPRECATED_7 |
                    USER_FLAG_DEPRECATED_9 | USER_FLAG_DEPRECATED_10);
                U.uiflag &= ~(
-                   USER_UIFLAG_DEPRECATED_7);
+                   USER_LOCK_UI_LAYOUT);
                U.transopts &= ~(
                    USER_TR_DEPRECATED_2 | USER_TR_DEPRECATED_3 | USER_TR_DEPRECATED_4 |
                    USER_TR_DEPRECATED_6 | USER_TR_DEPRECATED_7);
index 08d92dfc9ff1363ca515d85a77d1c854a25dba37..e097cd34eac4575f166f4e04c7afce7a59ceec81 100644 (file)
@@ -769,6 +769,10 @@ static void area_azone_initialize(wmWindow *win, const bScreen *screen, ScrArea
                return;
        }
 
+       if (U.uiflag & USER_LOCK_UI_LAYOUT) {
+               return;
+       }
+
        /* can't click on bottom corners on OS X, already used for resizing */
 #ifdef __APPLE__
        if (!(sa->totrct.xmin == 0 && sa->totrct.ymin == 0) || WM_window_is_fullscreen(win))
index 63cd5291193b1e4883febef0ddb0a2a1df88ec4e..f8b11a0bcae4ec83705144f1dbb2a6c7c894e2cf 100644 (file)
@@ -735,10 +735,19 @@ int getTransformOrientation_ex(const bContext *C, float normal[3], float plane[3
                                                        SWAP(BMVert *, v_pair[0], v_pair[1]);
                                                }
 
-                                               add_v3_v3v3(normal, v_pair[0]->no, v_pair[1]->no);
-                                               sub_v3_v3v3(plane, v_pair[0]->co, v_pair[1]->co);
-                                               /* flip the plane normal so we point outwards */
-                                               negate_v3(plane);
+                                               add_v3_v3v3(normal, v_pair[1]->no, v_pair[0]->no);
+                                               sub_v3_v3v3(plane, v_pair[1]->co, v_pair[0]->co);
+
+                                               if (normalize_v3(plane) != 0.0f) {
+                                                       /* For edges it'd important the resulting matrix can rotate around the edge,
+                                                        * project onto the plane so we can use a fallback value. */
+                                                       project_plane_normalized_v3_v3v3(normal, normal, plane);
+                                                       if (UNLIKELY(normalize_v3(normal) == 0.0f)) {
+                                                               /* in the case the normal and plane are aligned,
+                                                                * use a fallback normal which is orthogonal to the plane. */
+                                                               ortho_v3_v3(normal, plane);
+                                                       }
+                                               }
                                        }
 
                                        result = ORIENTATION_EDGE;
index 89761ee6ced1c72c90b0df15f4bcd1b0311a7b94..237091e1391b59263eed156cd23e8129ea890a75 100644 (file)
@@ -679,7 +679,9 @@ typedef enum eUserpref_UI_Flag {
        USER_DRAWVIEWINFO               = (1 << 4),
        USER_PLAINMENUS                 = (1 << 5),
        USER_LOCK_CURSOR_ADJUST = (1 << 6),
-       USER_UIFLAG_DEPRECATED_7        = (1 << 7),  /* cleared */
+       /* Avoid accidentally adjusting the layout
+        * (exact behavior may change based on whats considered reasonable to lock down). */
+       USER_LOCK_UI_LAYOUT     = (1 << 7),
        USER_ALLWINCODECS               = (1 << 8),
        USER_MENUOPENAUTO               = (1 << 9),
        USER_ZBUF_CURSOR                = (1 << 10),
index 25ce04229ed1b6d3f144eb45d21c7583ebccb1cd..e2a0769490d8bc3ac5776c16467fe0513453e622 100644 (file)
@@ -147,6 +147,12 @@ static void rna_userdef_dpi_update(Main *bmain, Scene *UNUSED(scene), PointerRNA
        WM_main_add_notifier(NC_SCREEN | NA_EDITED, NULL);    /* refresh region sizes */
 }
 
+static void rna_userdef_update_ui(Main *UNUSED(bmain), Scene *UNUSED(scene), PointerRNA *UNUSED(ptr))
+{
+       WM_main_add_notifier(NC_WINDOW, NULL);
+       WM_main_add_notifier(NC_SCREEN | NA_EDITED, NULL);    /* refresh region sizes */
+}
+
 static void rna_userdef_language_update(Main *UNUSED(bmain), Scene *UNUSED(scene), PointerRNA *UNUSED(ptr))
 {
        BLF_cache_clear();
@@ -3393,6 +3399,11 @@ static void rna_def_userdef_view(BlenderRNA *brna)
        RNA_def_property_boolean_negative_sdna(prop, NULL, "uiflag", USER_SPLASH_DISABLE);
        RNA_def_property_ui_text(prop, "Show Splash", "Display splash screen on startup");
 
+       prop = RNA_def_property(srna, "show_layout_ui", PROP_BOOLEAN, PROP_NONE);
+       RNA_def_property_boolean_negative_sdna(prop, NULL, "uiflag", USER_LOCK_UI_LAYOUT);
+       RNA_def_property_ui_text(prop, "Show Layout Widgets", "Show screen layout editing UI");
+       RNA_def_property_update(prop, 0, "rna_userdef_update_ui");
+
        prop = RNA_def_property(srna, "show_playback_fps", PROP_BOOLEAN, PROP_NONE);
        RNA_def_property_boolean_sdna(prop, NULL, "uiflag", USER_SHOW_FPS);
        RNA_def_property_ui_text(prop, "Show Playback FPS",