Merge branch 'master' into blender2.8
This commit is contained in:
@@ -24,7 +24,7 @@ from bpy.types import Operator
|
|||||||
from mathutils import Vector
|
from mathutils import Vector
|
||||||
|
|
||||||
|
|
||||||
def GlobalBB_LQ(bb_world):
|
def worldspace_bounds_from_object_bounds(bb_world):
|
||||||
|
|
||||||
# Initialize the variables with the 8th vertex
|
# Initialize the variables with the 8th vertex
|
||||||
left, right, front, back, down, up = (
|
left, right, front, back, down, up = (
|
||||||
@@ -66,7 +66,7 @@ def GlobalBB_LQ(bb_world):
|
|||||||
return (Vector((left, front, up)), Vector((right, back, down)))
|
return (Vector((left, front, up)), Vector((right, back, down)))
|
||||||
|
|
||||||
|
|
||||||
def GlobalBB_HQ(scene, obj):
|
def worldspace_bounds_from_object_data(scene, obj):
|
||||||
|
|
||||||
matrix_world = obj.matrix_world.copy()
|
matrix_world = obj.matrix_world.copy()
|
||||||
|
|
||||||
@@ -75,20 +75,20 @@ def GlobalBB_HQ(scene, obj):
|
|||||||
me = obj.to_mesh(scene=scene, apply_modifiers=True, settings='PREVIEW')
|
me = obj.to_mesh(scene=scene, apply_modifiers=True, settings='PREVIEW')
|
||||||
verts = me.vertices
|
verts = me.vertices
|
||||||
|
|
||||||
val = matrix_world * verts[-1].co
|
val = matrix_world * (verts[-1].co if verts else Vector((0.0, 0.0, 0.0)))
|
||||||
|
|
||||||
left, right, front, back, down, up = (val[0],
|
left, right, front, back, down, up = (
|
||||||
val[0],
|
val[0],
|
||||||
val[1],
|
val[0],
|
||||||
val[1],
|
val[1],
|
||||||
val[2],
|
val[1],
|
||||||
val[2],
|
val[2],
|
||||||
)
|
val[2],
|
||||||
|
)
|
||||||
|
|
||||||
# Test against all other verts
|
# Test against all other verts
|
||||||
for i in range(len(verts) - 1):
|
for v in verts:
|
||||||
|
vco = matrix_world * v.co
|
||||||
vco = matrix_world * verts[i].co
|
|
||||||
|
|
||||||
# X Range
|
# X Range
|
||||||
val = vco[0]
|
val = vco[0]
|
||||||
@@ -155,9 +155,9 @@ def align_objects(context,
|
|||||||
for obj, bb_world in objects:
|
for obj, bb_world in objects:
|
||||||
|
|
||||||
if bb_quality and obj.type == 'MESH':
|
if bb_quality and obj.type == 'MESH':
|
||||||
GBB = GlobalBB_HQ(scene, obj)
|
GBB = worldspace_bounds_from_object_data(scene, obj)
|
||||||
else:
|
else:
|
||||||
GBB = GlobalBB_LQ(bb_world)
|
GBB = worldspace_bounds_from_object_bounds(bb_world)
|
||||||
|
|
||||||
Left_Front_Up = GBB[0]
|
Left_Front_Up = GBB[0]
|
||||||
Right_Back_Down = GBB[1]
|
Right_Back_Down = GBB[1]
|
||||||
@@ -219,9 +219,9 @@ def align_objects(context,
|
|||||||
bb_world = [matrix_world * Vector(v[:]) for v in obj.bound_box]
|
bb_world = [matrix_world * Vector(v[:]) for v in obj.bound_box]
|
||||||
|
|
||||||
if bb_quality and obj.type == 'MESH':
|
if bb_quality and obj.type == 'MESH':
|
||||||
GBB = GlobalBB_HQ(scene, obj)
|
GBB = worldspace_bounds_from_object_data(scene, obj)
|
||||||
else:
|
else:
|
||||||
GBB = GlobalBB_LQ(bb_world)
|
GBB = worldspace_bounds_from_object_bounds(bb_world)
|
||||||
|
|
||||||
Left_Front_Up = GBB[0]
|
Left_Front_Up = GBB[0]
|
||||||
Right_Back_Down = GBB[1]
|
Right_Back_Down = GBB[1]
|
||||||
|
|||||||
@@ -33,7 +33,6 @@
|
|||||||
#include "BLI_ghash.h"
|
#include "BLI_ghash.h"
|
||||||
#include "BLI_string.h"
|
#include "BLI_string.h"
|
||||||
#include "BLI_listbase.h"
|
#include "BLI_listbase.h"
|
||||||
#include "BLI_utildefines.h"
|
|
||||||
|
|
||||||
#include "BKE_addon.h" /* own include */
|
#include "BKE_addon.h" /* own include */
|
||||||
#include "BKE_idprop.h"
|
#include "BKE_idprop.h"
|
||||||
|
|||||||
@@ -65,7 +65,7 @@ BLI_INLINE unsigned int BLI_hash_int(unsigned int k)
|
|||||||
|
|
||||||
BLI_INLINE float BLI_hash_int_01(unsigned int k)
|
BLI_INLINE float BLI_hash_int_01(unsigned int k)
|
||||||
{
|
{
|
||||||
return (float)BLI_hash_int(k) * (1.0f/(float)0xFFFFFFFF);
|
return (float)BLI_hash_int(k) * (1.0f / (float)0xFFFFFFFF);
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif // __BLI_HASH_H__
|
#endif // __BLI_HASH_H__
|
||||||
|
|||||||
@@ -333,7 +333,8 @@ MINLINE float clamp_f(float value, float min, float max)
|
|||||||
{
|
{
|
||||||
if (value > max) {
|
if (value > max) {
|
||||||
return max;
|
return max;
|
||||||
} else if (value < min) {
|
}
|
||||||
|
else if (value < min) {
|
||||||
return min;
|
return min;
|
||||||
}
|
}
|
||||||
return value;
|
return value;
|
||||||
|
|||||||
@@ -2423,9 +2423,10 @@ static void bmesh_kernel_vert_separate__cleanup(BMesh *bm, LinkNode *edges_separ
|
|||||||
/* don't visit again */
|
/* don't visit again */
|
||||||
n_prev->next = n_step->next;
|
n_prev->next = n_step->next;
|
||||||
}
|
}
|
||||||
} while ((void)
|
else {
|
||||||
(n_prev = n_step),
|
n_prev = n_step;
|
||||||
(n_step = n_step->next));
|
}
|
||||||
|
} while ((n_step = n_step->next));
|
||||||
|
|
||||||
} while ((n_orig = n_orig->next) && n_orig->next);
|
} while ((n_orig = n_orig->next) && n_orig->next);
|
||||||
} while ((edges_separate = edges_separate->next));
|
} while ((edges_separate = edges_separate->next));
|
||||||
|
|||||||
@@ -60,7 +60,7 @@ static int gpu_shader_displacement(GPUMaterial *mat, bNode *node, bNodeExecData
|
|||||||
GPU_link(mat, "direction_transform_m4v3", GPU_builtin(GPU_VIEW_NORMAL), GPU_builtin(GPU_INVERSE_VIEW_MATRIX), &in[3].link);
|
GPU_link(mat, "direction_transform_m4v3", GPU_builtin(GPU_VIEW_NORMAL), GPU_builtin(GPU_INVERSE_VIEW_MATRIX), &in[3].link);
|
||||||
}
|
}
|
||||||
|
|
||||||
if(node->custom1 == SHD_SPACE_OBJECT) {
|
if (node->custom1 == SHD_SPACE_OBJECT) {
|
||||||
return GPU_stack_link(mat, node, "node_displacement_object", in, out, GPU_builtin(GPU_OBJECT_MATRIX));
|
return GPU_stack_link(mat, node, "node_displacement_object", in, out, GPU_builtin(GPU_OBJECT_MATRIX));
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
|||||||
@@ -48,7 +48,7 @@ static void node_shader_init_vector_displacement(bNodeTree *UNUSED(ntree), bNode
|
|||||||
|
|
||||||
static int gpu_shader_vector_displacement(GPUMaterial *mat, bNode *node, bNodeExecData *UNUSED(execdata), GPUNodeStack *in, GPUNodeStack *out)
|
static int gpu_shader_vector_displacement(GPUMaterial *mat, bNode *node, bNodeExecData *UNUSED(execdata), GPUNodeStack *in, GPUNodeStack *out)
|
||||||
{
|
{
|
||||||
if(node->custom1 == SHD_SPACE_TANGENT) {
|
if (node->custom1 == SHD_SPACE_TANGENT) {
|
||||||
return GPU_stack_link(mat,
|
return GPU_stack_link(mat,
|
||||||
node,
|
node,
|
||||||
"node_vector_displacement_tangent",
|
"node_vector_displacement_tangent",
|
||||||
@@ -59,7 +59,7 @@ static int gpu_shader_vector_displacement(GPUMaterial *mat, bNode *node, bNodeEx
|
|||||||
GPU_builtin(GPU_OBJECT_MATRIX),
|
GPU_builtin(GPU_OBJECT_MATRIX),
|
||||||
GPU_builtin(GPU_VIEW_MATRIX));
|
GPU_builtin(GPU_VIEW_MATRIX));
|
||||||
}
|
}
|
||||||
else if(node->custom1 == SHD_SPACE_OBJECT) {
|
else if (node->custom1 == SHD_SPACE_OBJECT) {
|
||||||
return GPU_stack_link(mat, node, "node_vector_displacement_object", in, out, GPU_builtin(GPU_OBJECT_MATRIX));
|
return GPU_stack_link(mat, node, "node_vector_displacement_object", in, out, GPU_builtin(GPU_OBJECT_MATRIX));
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
|||||||
Reference in New Issue
Block a user