Merging r59083 through r59103 from trunk into soc-2013-depsgraph_mt

This commit is contained in:
Sergey Sharybin
2013-08-13 07:37:13 +00:00
28 changed files with 886 additions and 120 deletions

View File

@@ -613,7 +613,6 @@ void BKE_pose_channels_hash_free(bPose *pose)
}
}
void BKE_pose_channel_free(bPoseChannel *pchan)
{
if (pchan->custom) {
@@ -731,6 +730,9 @@ void BKE_pose_channel_copy_data(bPoseChannel *pchan, const bPoseChannel *pchan_f
/* custom shape */
pchan->custom = pchan_from->custom;
if (pchan->custom) {
id_us_plus(&pchan->custom->id);
}
}

View File

@@ -1647,10 +1647,16 @@ static void pose_proxy_synchronize(Object *ob, Object *from, int layer_protected
/* copy data in temp back over to the cleaned-out (but still allocated) original channel */
*pchan = pchanw;
if (pchan->custom) {
id_us_plus(&pchan->custom->id);
}
}
else {
/* always copy custom shape */
pchan->custom = pchanp->custom;
if (pchan->custom) {
id_us_plus(&pchan->custom->id);
}
if (pchanp->custom_tx)
pchan->custom_tx = BKE_pose_channel_find_name(pose, pchanp->custom_tx->name);

View File

@@ -462,7 +462,7 @@ typedef struct CameraViewFrameData {
unsigned int tot;
} CameraViewFrameData;
static void BKE_camera_to_frame_view_cb(const float co[3], void *user_data)
static void camera_to_frame_view_cb(const float co[3], void *user_data)
{
CameraViewFrameData *data = (CameraViewFrameData *)user_data;
unsigned int i;
@@ -526,7 +526,7 @@ int BKE_camera_view_frame_fit_to_scene(Scene *scene, struct View3D *v3d, Object
data_cb.tot = 0;
/* run callback on all visible points */
BKE_scene_foreach_display_point(scene, v3d, BA_SELECT,
BKE_camera_to_frame_view_cb, &data_cb);
camera_to_frame_view_cb, &data_cb);
if (data_cb.tot <= 1) {
return FALSE;

View File

@@ -2562,7 +2562,7 @@ void BKE_scene_foreach_display_point(
Object *ob;
for (base = FIRSTBASE; base; base = base->next) {
if (BASE_VISIBLE(v3d, base) && (base->flag & flag) == flag) {
if (BASE_VISIBLE_BGMODE(v3d, scene, base) && (base->flag & flag) == flag) {
ob = base->object;
if ((ob->transflag & OB_DUPLI) == 0) {

View File

@@ -271,6 +271,7 @@ extern "C" {
#include "tools/bmesh_bevel.h"
#include "tools/bmesh_decimate.h"
#include "tools/bmesh_edgesplit.h"
#include "tools/bmesh_path.h"
#include "tools/bmesh_triangulate.h"

View File

@@ -869,10 +869,10 @@ void BM_elem_attrs_copy(BMesh *bm_src, BMesh *bm_dst, const void *ele_src, void
BM_elem_attrs_copy_ex(bm_src, bm_dst, ele_src, ele_dst, BM_ELEM_SELECT);
}
void BM_elem_select_copy(BMesh *UNUSED(bm_src), BMesh *bm_dst, const void *ele_src_v, void *ele_dst_v)
void BM_elem_select_copy(BMesh *bm_dst, BMesh *UNUSED(bm_src), void *ele_dst_v, const void *ele_src_v)
{
const BMHeader *ele_src = ele_src_v;
BMHeader *ele_dst = ele_dst_v;
const BMHeader *ele_src = ele_src_v;
BLI_assert(ele_src->htype == ele_dst->htype);

View File

@@ -53,7 +53,7 @@ void BMO_remove_tagged_context(BMesh *bm, const short oflag, const int type);
void BM_elem_attrs_copy_ex(BMesh *bm_src, BMesh *bm_dst, const void *ele_src_v, void *ele_dst_v,
const char hflag_mask);
void BM_elem_attrs_copy(BMesh *bm_src, BMesh *bm_dst, const void *ele_src_v, void *ele_dst_v);
void BM_elem_select_copy(BMesh *bm_src, BMesh *bm_dst, const void *ele_src_v, void *ele_dst_v);
void BM_elem_select_copy(BMesh *bm_dst, BMesh *bm_src, void *ele_dst_v, const void *ele_src_v);
void BM_mesh_copy_init_customdata(BMesh *bm_dst, BMesh *bm_src, const struct BMAllocTemplate *allocsize);
BMesh *BM_mesh_copy(BMesh *bm_old);

View File

@@ -1915,7 +1915,8 @@ bool BM_vert_splice(BMesh *bm, BMVert *v, BMVert *v_target)
*
* \return Success
*/
bool bmesh_vert_separate(BMesh *bm, BMVert *v, BMVert ***r_vout, int *r_vout_len)
void bmesh_vert_separate(BMesh *bm, BMVert *v, BMVert ***r_vout, int *r_vout_len,
const bool copy_select)
{
const int v_edgetot = BM_vert_face_count(v);
BMEdge **stack = BLI_array_alloca(stack, v_edgetot);
@@ -1970,6 +1971,9 @@ bool bmesh_vert_separate(BMesh *bm, BMVert *v, BMVert ***r_vout, int *r_vout_len
verts[0] = v;
for (i = 1; i < maxindex; i++) {
verts[i] = BM_vert_create(bm, v->co, v, 0);
if (copy_select) {
BM_elem_select_copy(bm, bm, verts[i], v);
}
}
/* Replace v with the new verts in each group */
@@ -2039,14 +2043,12 @@ bool bmesh_vert_separate(BMesh *bm, BMVert *v, BMVert ***r_vout, int *r_vout_len
if (r_vout != NULL) {
*r_vout = verts;
}
return true;
}
/**
* High level function which wraps both #bmesh_vert_separate and #bmesh_edge_separate
*/
bool BM_vert_separate(BMesh *bm, BMVert *v, BMVert ***r_vout, int *r_vout_len,
void BM_vert_separate(BMesh *bm, BMVert *v, BMVert ***r_vout, int *r_vout_len,
BMEdge **e_in, int e_in_len)
{
int i;
@@ -2054,11 +2056,11 @@ bool BM_vert_separate(BMesh *bm, BMVert *v, BMVert ***r_vout, int *r_vout_len,
for (i = 0; i < e_in_len; i++) {
BMEdge *e = e_in[i];
if (e->l && BM_vert_in_edge(e, v)) {
bmesh_edge_separate(bm, e, e->l);
bmesh_edge_separate(bm, e, e->l, false);
}
}
return bmesh_vert_separate(bm, v, r_vout, r_vout_len);
bmesh_vert_separate(bm, v, r_vout, r_vout_len, false);
}
/**
@@ -2114,18 +2116,20 @@ bool BM_edge_splice(BMesh *bm, BMEdge *e, BMEdge *e_target)
* \note Does nothing if \a l_sep is already the only loop in the
* edge radial.
*/
bool bmesh_edge_separate(BMesh *bm, BMEdge *e, BMLoop *l_sep)
void bmesh_edge_separate(BMesh *bm, BMEdge *e, BMLoop *l_sep,
const bool copy_select)
{
BMEdge *e_new;
int radlen;
#ifndef NDEBUG
const int radlen = bmesh_radial_length(e->l);
#endif
BLI_assert(l_sep->e == e);
BLI_assert(e->l);
radlen = bmesh_radial_length(e->l);
if (radlen < 2) {
if (BM_edge_is_boundary(e)) {
/* no cut required */
return true;
return;
}
if (l_sep == e->l) {
@@ -2137,13 +2141,15 @@ bool bmesh_edge_separate(BMesh *bm, BMEdge *e, BMLoop *l_sep)
bmesh_radial_append(e_new, l_sep);
l_sep->e = e_new;
if (copy_select) {
BM_elem_select_copy(bm, bm, e_new, e);
}
BLI_assert(bmesh_radial_length(e->l) == radlen - 1);
BLI_assert(bmesh_radial_length(e_new->l) == 1);
BM_CHECK_ELEMENT(e_new);
BM_CHECK_ELEMENT(e);
return true;
}
/**
@@ -2162,8 +2168,8 @@ BMVert *bmesh_urmv_loop(BMesh *bm, BMLoop *l_sep)
/* peel the face from the edge radials on both sides of the
* loop vert, disconnecting the face from its fan */
bmesh_edge_separate(bm, l_sep->e, l_sep);
bmesh_edge_separate(bm, l_sep->prev->e, l_sep->prev);
bmesh_edge_separate(bm, l_sep->e, l_sep, false);
bmesh_edge_separate(bm, l_sep->prev->e, l_sep->prev, false);
if (bmesh_disk_count(v_sep) == 2) {
/* If there are still only two edges out of v_sep, then
@@ -2181,7 +2187,7 @@ BMVert *bmesh_urmv_loop(BMesh *bm, BMLoop *l_sep)
/* Split all fans connected to the vert, duplicating it for
* each fans. */
bmesh_vert_separate(bm, v_sep, &vtar, &len);
bmesh_vert_separate(bm, v_sep, &vtar, &len, false);
/* There should have been at least two fans cut apart here,
* otherwise the early exit would have kicked in. */

View File

@@ -50,16 +50,18 @@ void BM_face_kill(BMesh *bm, BMFace *f);
void BM_edge_kill(BMesh *bm, BMEdge *e);
void BM_vert_kill(BMesh *bm, BMVert *v);
bool bmesh_edge_separate(BMesh *bm, BMEdge *e, BMLoop *l_sep);
void bmesh_edge_separate(BMesh *bm, BMEdge *e, BMLoop *l_sep,
const bool copy_select);
bool BM_edge_splice(BMesh *bm, BMEdge *e, BMEdge *e_target);
bool BM_vert_splice(BMesh *bm, BMVert *v, BMVert *v_target);
bool bmesh_vert_separate(BMesh *bm, BMVert *v, BMVert ***r_vout, int *r_vout_len);
void bmesh_vert_separate(BMesh *bm, BMVert *v, BMVert ***r_vout, int *r_vout_len,
const bool copy_select);
bool bmesh_loop_reverse(BMesh *bm, BMFace *f);
BMFace *BM_faces_join(BMesh *bm, BMFace **faces, int totface, const bool do_del);
bool BM_vert_separate(BMesh *bm, BMVert *v, BMVert ***r_vout, int *r_vout_len,
void BM_vert_separate(BMesh *bm, BMVert *v, BMVert ***r_vout, int *r_vout_len,
BMEdge **e_in, int e_in_len);
/* EULER API - For modifying structure */

View File

@@ -69,6 +69,79 @@ static void recount_totsels(BMesh *bm)
}
}
/**
* \brief Select Mode Clean
*
* Remove isolated selected elements when in a mode doesn't support them.
* eg: in edge-mode a selected vertex must be connected to a selected edge.
*
* \note this could be made apart of #BM_mesh_select_mode_flush_ex
*/
void BM_mesh_select_mode_clean_ex(BMesh *bm, const short selectmode)
{
if (selectmode & SCE_SELECT_VERTEX) {
/* pass */
}
else if (selectmode & SCE_SELECT_EDGE) {
BMIter iter;
if (bm->totvertsel) {
BMVert *v;
BM_ITER_MESH (v, &iter, bm, BM_VERTS_OF_MESH) {
BM_elem_flag_disable(v, BM_ELEM_SELECT);
}
bm->totvertsel = 0;
}
if (bm->totedgesel) {
BMEdge *e;
BM_ITER_MESH (e, &iter, bm, BM_EDGES_OF_MESH) {
if (BM_elem_flag_test(e, BM_ELEM_SELECT)) {
BM_vert_select_set(bm, e->v1, true);
BM_vert_select_set(bm, e->v2, true);
}
}
}
}
else if (selectmode & SCE_SELECT_FACE) {
BMIter iter;
if (bm->totvertsel) {
BMVert *v;
BM_ITER_MESH (v, &iter, bm, BM_VERTS_OF_MESH) {
BM_elem_flag_disable(v, BM_ELEM_SELECT);
}
bm->totvertsel = 0;
}
if (bm->totedgesel) {
BMEdge *e;
BM_ITER_MESH (e, &iter, bm, BM_EDGES_OF_MESH) {
BM_elem_flag_disable(e, BM_ELEM_SELECT);
}
bm->totedgesel = 0;
}
if (bm->totfacesel) {
BMFace *f;
BM_ITER_MESH (f, &iter, bm, BM_FACES_OF_MESH) {
if (BM_elem_flag_test(f, BM_ELEM_SELECT)) {
BMLoop *l_iter, *l_first;
l_iter = l_first = BM_FACE_FIRST_LOOP(f);
do {
BM_edge_select_set(bm, l_iter->e, true);
} while ((l_iter = l_iter->next) != l_first);
}
}
}
}
}
void BM_mesh_select_mode_clean(BMesh *bm)
{
BM_mesh_select_mode_clean_ex(bm, bm->selectmode);
}
/**
* \brief Select Mode Flush
*
@@ -329,18 +402,15 @@ void BM_edge_select_set(BMesh *bm, BMEdge *e, const bool select)
if (BM_elem_flag_test(e, BM_ELEM_SELECT)) bm->totedgesel -= 1;
BM_elem_flag_disable(e, BM_ELEM_SELECT);
if (bm->selectmode == SCE_SELECT_EDGE ||
bm->selectmode == SCE_SELECT_FACE ||
bm->selectmode == (SCE_SELECT_EDGE | SCE_SELECT_FACE))
{
if ((bm->selectmode & SCE_SELECT_VERTEX) == 0) {
BMIter iter;
BMVert *verts[2] = {e->v1, e->v2};
BMEdge *e2;
int i;
/* check if the vert is used by a selected edge */
for (i = 0; i < 2; i++) {
int deselect = 1;
bool deselect = true;
for (e2 = BM_iter_new(&iter, bm, BM_EDGES_OF_VERT, verts[i]); e2; e2 = BM_iter_step(&iter)) {
if (e2 == e) {
@@ -348,7 +418,7 @@ void BM_edge_select_set(BMesh *bm, BMEdge *e, const bool select)
}
if (BM_elem_flag_test(e2, BM_ELEM_SELECT)) {
deselect = 0;
deselect = false;
break;
}
}

View File

@@ -59,6 +59,9 @@ void BM_vert_select_set(BMesh *bm, BMVert *v, const bool select);
void BM_edge_select_set(BMesh *bm, BMEdge *e, const bool select);
void BM_face_select_set(BMesh *bm, BMFace *f, const bool select);
void BM_mesh_select_mode_clean_ex(BMesh *bm, const short selectmode);
void BM_mesh_select_mode_clean(BMesh *bm);
void BM_mesh_select_mode_set(BMesh *bm, int selectmode);
void BM_mesh_select_mode_flush_ex(BMesh *bm, const short selectmode);
void BM_mesh_select_mode_flush(BMesh *bm);

View File

@@ -457,7 +457,7 @@ void bmo_inset_region_exec(BMesh *bm, BMOperator *op)
/* run the separate arg */
bmesh_edge_separate(bm, es->e_old, es->l);
bmesh_edge_separate(bm, es->e_old, es->l, false);
/* calc edge-split info */
es->e_new = es->l->e;
@@ -535,7 +535,7 @@ void bmo_inset_region_exec(BMesh *bm, BMOperator *op)
/* disable touching twice, this _will_ happen if the flags not disabled */
BM_elem_flag_disable(v, BM_ELEM_TAG);
bmesh_vert_separate(bm, v, &vout, &r_vout_len);
bmesh_vert_separate(bm, v, &vout, &r_vout_len, false);
v = NULL; /* don't use again */
/* in some cases the edge doesn't split off */

View File

@@ -29,7 +29,6 @@
#include "BLI_utildefines.h"
#include "bmesh.h"
#include "tools/bmesh_edgesplit.h"
#include "intern/bmesh_operators_private.h" /* own include */
@@ -48,7 +47,7 @@ void bmo_split_edges_exec(BMesh *bm, BMOperator *op)
}
/* this is where everything happens */
BM_mesh_edgesplit(bm, use_verts, true);
BM_mesh_edgesplit(bm, use_verts, true, false);
BMO_slot_buffer_from_enabled_hflag(bm, op, op->slots_out, "edges.out", BM_EDGE, BM_ELEM_INTERNAL_TAG);
}

View File

@@ -47,7 +47,6 @@
#include "BKE_curve.h"
#include "bmesh.h"
#include "tools/bmesh_edgesplit.h"
#include "intern/bmesh_operators_private.h" /* own include */

View File

@@ -98,7 +98,7 @@ static void bm_edgesplit_validate_seams(BMesh *bm)
MEM_freeN(vtouch);
}
void BM_mesh_edgesplit(BMesh *bm, const bool use_verts, const bool tag_only)
void BM_mesh_edgesplit(BMesh *bm, const bool use_verts, const bool tag_only, const bool copy_select)
{
BMIter iter;
BMEdge *e;
@@ -136,7 +136,7 @@ void BM_mesh_edgesplit(BMesh *bm, const bool use_verts, const bool tag_only)
/* keep splitting until each loop has its own edge */
do {
bmesh_edge_separate(bm, e, e->l);
bmesh_edge_separate(bm, e, e->l, copy_select);
} while (!BM_edge_is_boundary(e));
BM_elem_flag_enable(e->v1, BM_ELEM_TAG);
@@ -159,11 +159,11 @@ void BM_mesh_edgesplit(BMesh *bm, const bool use_verts, const bool tag_only)
if (BM_elem_flag_test(e, BM_ELEM_TAG)) {
if (BM_elem_flag_test(e->v1, BM_ELEM_TAG)) {
BM_elem_flag_disable(e->v1, BM_ELEM_TAG);
bmesh_vert_separate(bm, e->v1, NULL, NULL);
bmesh_vert_separate(bm, e->v1, NULL, NULL, copy_select);
}
if (BM_elem_flag_test(e->v2, BM_ELEM_TAG)) {
BM_elem_flag_disable(e->v2, BM_ELEM_TAG);
bmesh_vert_separate(bm, e->v2, NULL, NULL);
bmesh_vert_separate(bm, e->v2, NULL, NULL, copy_select);
}
}
}

View File

@@ -27,6 +27,6 @@
* \ingroup bmesh
*/
void BM_mesh_edgesplit(BMesh *bm, const bool use_verts, const bool tag_only);
void BM_mesh_edgesplit(BMesh *bm, const bool use_verts, const bool tag_only, const bool copy_select);
#endif /* __BMESH_EDGESPLIT_H__ */

View File

@@ -487,6 +487,9 @@ static void pose_copy_menu(Scene *scene)
break;
case 8: /* Custom Bone Shape */
pchan->custom = pchanact->custom;
if (pchan->custom) {
id_us_plus(&pchan->custom->id);
}
break;
case 9: /* Visual Location */
BKE_armature_loc_pose_to_bone(pchan, pchanact->pose_mat[3], pchan->loc);

View File

@@ -2684,7 +2684,7 @@ static void knife_make_chain_cut(KnifeTool_OpData *kcd, BMFace *f, ListBase *cha
}
}
else {
BM_elem_select_copy(bm, bm, f, f_new);
BM_elem_select_copy(bm, bm, f_new, f);
}
*r_f_new = f_new;

View File

@@ -510,24 +510,6 @@ static void edbm_tagged_loop_pairs_do_fill_faces(BMesh *bm, UnorderedLoopPair *u
/* --- end 'face-fill' code --- */
static bool edbm_rip_call_edgesplit(BMEditMesh *em, wmOperator *op)
{
BMOperator bmop;
if (!EDBM_op_init(em, &bmop, op, "split_edges edges=%he verts=%hv use_verts=%b",
BM_ELEM_TAG, BM_ELEM_SELECT, true))
{
return false;
}
BMO_op_exec(em->bm, &bmop);
if (!EDBM_op_finish(em, &bmop, op, true)) {
return false;
}
return true;
}
/**
* This is the main vert ripping function (rip when one vertex is selected)
*/
@@ -648,11 +630,9 @@ static int edbm_rip_invoke__vert(bContext *C, wmOperator *op, const wmEvent *eve
BM_vert_select_set(bm, v, false);
if (bmesh_vert_separate(bm, v, &vout, &vout_len) == false) {
BKE_report(op->reports, RPT_ERROR, "Error ripping vertex from faces");
return OPERATOR_CANCELLED;
}
else if (vout_len < 2) {
bmesh_vert_separate(bm, v, &vout, &vout_len, true);
if (vout_len < 2) {
MEM_freeN(vout);
/* set selection back to avoid active-unselected vertex */
BM_vert_select_set(bm, v, true);
@@ -786,10 +766,7 @@ static int edbm_rip_invoke__vert(bContext *C, wmOperator *op, const wmEvent *eve
fill_uloop_pairs = edbm_tagged_loop_pairs_to_fill(bm);
}
if (!edbm_rip_call_edgesplit(em, op)) {
if (fill_uloop_pairs) MEM_freeN(fill_uloop_pairs);
return OPERATOR_CANCELLED;
}
BM_mesh_edgesplit(em->bm, true, true, true);
}
dist = FLT_MAX;
@@ -951,10 +928,7 @@ static int edbm_rip_invoke__edge(bContext *C, wmOperator *op, const wmEvent *eve
fill_uloop_pairs = edbm_tagged_loop_pairs_to_fill(bm);
}
if (!edbm_rip_call_edgesplit(em, op)) {
if (fill_uloop_pairs) MEM_freeN(fill_uloop_pairs);
return OPERATOR_CANCELLED;
}
BM_mesh_edgesplit(em->bm, true, true, true);
/* note: the output of the bmesh operator is ignored, since we built
* the contiguous loop pairs to split already, its possible that some
@@ -965,6 +939,9 @@ static int edbm_rip_invoke__edge(bContext *C, wmOperator *op, const wmEvent *eve
ar, projectMat, fmval);
MEM_freeN(eloop_pairs);
/* deselect loose verts */
BM_mesh_select_mode_clean_ex(bm, SCE_SELECT_EDGE);
if (do_fill && fill_uloop_pairs) {
edbm_tagged_loop_pairs_do_fill_faces(bm, fill_uloop_pairs);
MEM_freeN(fill_uloop_pairs);
@@ -975,8 +952,6 @@ static int edbm_rip_invoke__edge(bContext *C, wmOperator *op, const wmEvent *eve
return OPERATOR_CANCELLED;
}
EDBM_selectmode_flush(em);
return OPERATOR_FINISHED;
}

View File

@@ -448,6 +448,7 @@ static SpaceLink *outliner_duplicate(SpaceLink *sl)
soutlinern->tree.first = soutlinern->tree.last = NULL;
soutlinern->treestore = NULL;
soutlinern->treehash = NULL;
return (SpaceLink *)soutlinern;
}

View File

@@ -444,14 +444,27 @@ void VIEW3D_OT_camera_to_view(wmOperatorType *ot)
/* unlike VIEW3D_OT_view_selected this is for framing a render and not
* meant to take into account vertex/bone selection for eg. */
static int view3d_camera_to_view_selected_exec(bContext *C, wmOperator *UNUSED(op))
static int view3d_camera_to_view_selected_exec(bContext *C, wmOperator *op)
{
Scene *scene = CTX_data_scene(C);
View3D *v3d = CTX_wm_view3d(C);
Object *camera_ob = v3d->camera;
View3D *v3d = CTX_wm_view3d(C); /* can be NULL */
Object *camera_ob = v3d ? v3d->camera : scene->camera;
float r_co[3]; /* the new location to apply */
if (camera_ob == NULL) {
BKE_report(op->reports, RPT_ERROR, "No active camera");
return OPERATOR_CANCELLED;
}
else if (camera_ob->type != OB_CAMERA) {
BKE_report(op->reports, RPT_ERROR, "Object not a camera");
return OPERATOR_CANCELLED;
}
else if (((Camera *)camera_ob->data)->type == R_ORTHO) {
BKE_report(op->reports, RPT_ERROR, "Orthographic cameras not supported");
return OPERATOR_CANCELLED;
}
/* this function does all the important stuff */
if (BKE_camera_view_frame_fit_to_scene(scene, v3d, camera_ob, r_co)) {
@@ -476,24 +489,6 @@ static int view3d_camera_to_view_selected_exec(bContext *C, wmOperator *UNUSED(o
}
}
static int view3d_camera_to_view_selected_poll(bContext *C)
{
View3D *v3d = CTX_wm_view3d(C);
if (v3d && v3d->camera && v3d->camera->id.lib == NULL) {
RegionView3D *rv3d = CTX_wm_region_view3d(C);
if (rv3d) {
if (rv3d->is_persp == false) {
CTX_wm_operator_poll_msg_set(C, "Only valid for a perspective camera view");
}
else if (!rv3d->viewlock) {
return 1;
}
}
}
return 0;
}
void VIEW3D_OT_camera_to_view_selected(wmOperatorType *ot)
{
/* identifiers */
@@ -503,7 +498,7 @@ void VIEW3D_OT_camera_to_view_selected(wmOperatorType *ot)
/* api callbacks */
ot->exec = view3d_camera_to_view_selected_exec;
ot->poll = view3d_camera_to_view_selected_poll;
ot->poll = ED_operator_scene_editable;
/* flags */
ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;

View File

@@ -100,11 +100,11 @@ static int checkbmp(unsigned char *mem)
memcpy(&bmi, mem, sizeof(bmi));
u = LITTLE_LONG(bmi.biSize);
/* we only support uncompressed 24 or 32 bits images for now */
/* we only support uncompressed images for now. */
if (u >= sizeof(BMPINFOHEADER)) {
if ((bmi.biCompression == 0) && (bmi.biClrUsed == 0)) {
if (bmi.biCompression == 0) {
u = LITTLE_SHORT(bmi.biBitCount);
if (u >= 16) {
if (u >= 8) {
ret_val = 1;
}
}
@@ -125,7 +125,7 @@ struct ImBuf *imb_bmp_decode(unsigned char *mem, size_t size, int flags, char co
{
struct ImBuf *ibuf = NULL;
BMPINFOHEADER bmi;
int x, y, depth, skip, i;
int x, y, depth, ibuf_depth, skip, i;
unsigned char *bmp, *rect;
unsigned short col;
double xppm, yppm;
@@ -151,6 +151,13 @@ struct ImBuf *imb_bmp_decode(unsigned char *mem, size_t size, int flags, char co
xppm = LITTLE_LONG(bmi.biXPelsPerMeter);
yppm = LITTLE_LONG(bmi.biYPelsPerMeter);
if (depth <= 8) {
ibuf_depth = 24;
}
else {
ibuf_depth = depth;
}
#if 0
printf("skip: %d, x: %d y: %d, depth: %d (%x)\n", skip, x, y,
depth, bmi.biBitCount);
@@ -159,14 +166,33 @@ struct ImBuf *imb_bmp_decode(unsigned char *mem, size_t size, int flags, char co
#endif
if (flags & IB_test) {
ibuf = IMB_allocImBuf(x, y, depth, 0);
ibuf = IMB_allocImBuf(x, y, ibuf_depth, 0);
}
else {
ibuf = IMB_allocImBuf(x, y, depth, IB_rect);
ibuf = IMB_allocImBuf(x, y, ibuf_depth, IB_rect);
bmp = mem + skip;
rect = (unsigned char *) ibuf->rect;
if (depth == 16) {
if (depth == 8) {
const int x_pad = (4 - (x % 4)) % 4;
const char (*palette)[4] = (void *)bmp;
bmp += bmi.biClrUsed * 4;
for (i = y; i > 0; i--) {
int j;
for (j = x; j > 0; j--) {
const char *pcol = palette[bmp[0]];
rect[0] = pcol[0];
rect[1] = pcol[1];
rect[2] = pcol[2];
rect[3] = 255;
rect += 4; bmp += 1;
}
/* rows are padded to multiples of 4 */
bmp += x_pad;
}
}
else if (depth == 16) {
for (i = x * y; i > 0; i--) {
col = bmp[0] + (bmp[1] << 8);
rect[0] = ((col >> 10) & 0x1f) << 3;
@@ -179,6 +205,7 @@ struct ImBuf *imb_bmp_decode(unsigned char *mem, size_t size, int flags, char co
}
else if (depth == 24) {
const int x_pad = x % 4;
for (i = y; i > 0; i--) {
int j;
for (j = x; j > 0; j--) {
@@ -190,7 +217,7 @@ struct ImBuf *imb_bmp_decode(unsigned char *mem, size_t size, int flags, char co
rect += 4; bmp += 3;
}
/* for 24-bit images, rows are padded to multiples of 4 */
bmp += x % 4;
bmp += x_pad;
}
}
else if (depth == 32) {

View File

@@ -44,7 +44,6 @@
#include "BKE_modifier.h"
#include "bmesh.h"
#include "tools/bmesh_edgesplit.h"
#include "DNA_object_types.h"
@@ -91,7 +90,7 @@ static DerivedMesh *doEdgeSplit(DerivedMesh *dm, EdgeSplitModifierData *emd)
}
}
BM_mesh_edgesplit(bm, FALSE, TRUE);
BM_mesh_edgesplit(bm, false, true, false);
/* BM_mesh_validate(bm); */ /* for troubleshooting */

View File

@@ -245,14 +245,10 @@ static PyObject *bpy_bm_utils_vert_separate(PyObject *UNUSED(self), PyObject *ar
return NULL;
}
if (BM_vert_separate(bm, py_vert->v, &elem, &elem_len, edge_array, edge_array_len)) {
/* return collected verts */
ret = BPy_BMElem_Array_As_Tuple(bm, (BMHeader **)elem, elem_len);
MEM_freeN(elem);
}
else {
ret = PyTuple_New(0);
}
BM_vert_separate(bm, py_vert->v, &elem, &elem_len, edge_array, edge_array_len);
/* return collected verts */
ret = BPy_BMElem_Array_As_Tuple(bm, (BMHeader **)elem, elem_len);
MEM_freeN(elem);
PyMem_FREE(edge_array);

View File

@@ -4817,6 +4817,9 @@ static void add_render_object(Render *re, Object *ob, Object *par, DupliObject *
if (ob->particlesystem.first) {
psysindex= 1;
for (psys=ob->particlesystem.first; psys; psys=psys->next, psysindex++) {
if (!psys_check_enabled(ob, psys))
continue;
obr= RE_addRenderObject(re, ob, par, index, psysindex, ob->lay);
if ((dob && !dob->animated) || (ob->transflag & OB_RENDER_DUPLI)) {
obr->flag |= R_INSTANCEABLE;

View File

@@ -99,7 +99,8 @@ const char KX_KetsjiEngine::m_profileLabels[tc_numCategories][15] = {
"Rasterizer:", // tc_rasterizer
"Services:", // tc_services
"Overhead:", // tc_overhead
"Outside:" // tc_outside
"Outside:", // tc_outside
"GPU Latency:" // tc_latency
};
double KX_KetsjiEngine::m_ticrate = DEFAULT_LOGIC_TIC_RATE;
@@ -542,7 +543,10 @@ void KX_KetsjiEngine::EndFrame()
m_logger->StartLog(tc_rasterizer, m_kxsystem->GetTimeInSeconds(), true);
m_rasterizer->EndFrame();
// swap backbuffer (drawing into this buffer) <-> front/visible buffer
m_logger->StartLog(tc_latency, m_kxsystem->GetTimeInSeconds(), true);
m_rasterizer->SwapBuffers();
m_logger->StartLog(tc_rasterizer, m_kxsystem->GetTimeInSeconds(), true);
m_rendertools->EndFrame(m_rasterizer);

View File

@@ -158,9 +158,10 @@ private:
tc_network,
tc_scenegraph,
tc_rasterizer,
tc_services, // time spend in miscelaneous activities
tc_services, // time spent in miscelaneous activities
tc_overhead, // profile info drawing overhead
tc_outside, // time spend outside main loop
tc_outside, // time spent outside main loop
tc_latency, // time spent waiting on the gpu
tc_numCategories
} KX_TimeCategory;