This commit is contained in:
parent
c93c5ec921
commit
a8aba3f8f4
|
@ -21,6 +21,7 @@ set(INC
|
||||||
../../render
|
../../render
|
||||||
../../shader_fx
|
../../shader_fx
|
||||||
../../windowmanager
|
../../windowmanager
|
||||||
|
../transform
|
||||||
../../../../intern/clog
|
../../../../intern/clog
|
||||||
|
|
||||||
# RNA_prototypes.h
|
# RNA_prototypes.h
|
||||||
|
|
|
@ -89,6 +89,7 @@
|
||||||
#include "BKE_speaker.h"
|
#include "BKE_speaker.h"
|
||||||
#include "BKE_vfont.h"
|
#include "BKE_vfont.h"
|
||||||
#include "BKE_volume.hh"
|
#include "BKE_volume.hh"
|
||||||
|
#include "BKE_scene.h"
|
||||||
|
|
||||||
#include "DEG_depsgraph.hh"
|
#include "DEG_depsgraph.hh"
|
||||||
#include "DEG_depsgraph_build.hh"
|
#include "DEG_depsgraph_build.hh"
|
||||||
|
@ -126,6 +127,8 @@
|
||||||
|
|
||||||
#include "object_intern.h"
|
#include "object_intern.h"
|
||||||
|
|
||||||
|
#include "transform_orientations.hh"
|
||||||
|
|
||||||
using blender::float3;
|
using blender::float3;
|
||||||
using blender::float4x4;
|
using blender::float4x4;
|
||||||
using blender::Vector;
|
using blender::Vector;
|
||||||
|
@ -347,15 +350,35 @@ float ED_object_new_primitive_matrix(bContext *C,
|
||||||
View3D *v3d = CTX_wm_view3d(C);
|
View3D *v3d = CTX_wm_view3d(C);
|
||||||
float mat[3][3], rmat[3][3], cmat[3][3], imat[3][3];
|
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);
|
unit_m4(r_primmat);
|
||||||
|
|
||||||
eul_to_mat3(rmat, rot);
|
eul_to_mat3(rmat, rot);
|
||||||
invert_m3(rmat);
|
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 */
|
/* inverse transform for initial rotation and object */
|
||||||
copy_m3_m4(mat, obedit->object_to_world);
|
copy_m3_m4(mat, obedit->object_to_world);
|
||||||
mul_m3_m3m3(cmat, rmat, mat);
|
mul_m3_m3m3(cmat, rmat, mat);
|
||||||
invert_m3_m3(imat, cmat);
|
invert_m3_m3(imat, cmat);
|
||||||
|
|
||||||
copy_m4_m3(r_primmat, imat);
|
copy_m4_m3(r_primmat, imat);
|
||||||
|
|
||||||
/* center */
|
/* center */
|
||||||
|
|
Loading…
Reference in New Issue