diff --git a/source/blender/editors/object/CMakeLists.txt b/source/blender/editors/object/CMakeLists.txt
index 05a3a9b480c..d55feb4eb8e 100644
--- a/source/blender/editors/object/CMakeLists.txt
+++ b/source/blender/editors/object/CMakeLists.txt
@@ -17,6 +17,7 @@ set(INC
   ../../render
   ../../shader_fx
   ../../windowmanager
+  ../transform
 
   # RNA_prototypes.h
   ${CMAKE_BINARY_DIR}/source/blender/makesrna
diff --git a/source/blender/editors/object/object_add.cc b/source/blender/editors/object/object_add.cc
index 8d15eb8ca39..609b9b2bc94 100644
--- a/source/blender/editors/object/object_add.cc
+++ b/source/blender/editors/object/object_add.cc
@@ -89,6 +89,7 @@
 #include "BKE_speaker.h"
 #include "BKE_vfont.hh"
 #include "BKE_volume.hh"
+#include "BKE_scene.h"
 
 #include "DEG_depsgraph.hh"
 #include "DEG_depsgraph_build.hh"
@@ -126,6 +127,8 @@
 
 #include "object_intern.h"
 
+#include "transform_orientations.hh"
+
 using blender::float3;
 using blender::float4x4;
 using blender::Vector;
@@ -347,15 +350,35 @@ float ED_object_new_primitive_matrix(bContext *C,
   View3D *v3d = CTX_wm_view3d(C);
   float mat[3][3], rmat[3][3], cmat[3][3], imat[3][3];
 
+  float ts_mat[3][3];
+  char ts_name[MAX_NAME];
+  //int orientation_index = v3d->twmode - V3D_MANIP_CUSTOM;
+  TransformOrientation *custom_orientation = nullptr;
+  if (scene->orientation_slots->type >= V3D_ORIENT_CUSTOM &&
+      scene->orientation_slots->index_custom != -1)
+  {
+    custom_orientation = BKE_scene_transform_orientation_find(
+        scene, scene->orientation_slots->index_custom);
+  }
+
   unit_m4(r_primmat);
 
   eul_to_mat3(rmat, rot);
   invert_m3(rmat);
 
+  if (custom_orientation) {
+    applyTransformOrientation(custom_orientation, ts_mat, ts_name);
+    invert_m3(ts_mat);
+    mul_m3_m3m3(mat, rmat, ts_mat);
+    copy_m3_m3(rmat, mat);
+  }
+
+
   /* inverse transform for initial rotation and object */
   copy_m3_m4(mat, obedit->object_to_world);
   mul_m3_m3m3(cmat, rmat, mat);
   invert_m3_m3(imat, cmat);
+
   copy_m4_m3(r_primmat, imat);
 
   /* center */
diff --git a/source/blender/tornavis/patches/MB_0016.h b/source/blender/tornavis/patches/MB_0016.h
new file mode 100644
index 00000000000..ddf2a41c228
--- /dev/null
+++ b/source/blender/tornavis/patches/MB_0016.h
@@ -0,0 +1 @@
+/* Empty File */
