Cleanup: shadowing (editors)

This commit is contained in:
Campbell Barton 2015-11-23 15:44:15 +11:00
parent 6e4cb463c4
commit 48b1656a6c
23 changed files with 184 additions and 181 deletions

@ -1779,14 +1779,13 @@ int sk_detectMergeGesture(bContext *C, SK_Gesture *gest, SK_Sketch *UNUSED(sketc
{
ARegion *ar = CTX_wm_region(C);
if (gest->nb_segments > 2 && gest->nb_intersections == 2) {
short start_val[2], end_val[2];
short dist;
int start_val[2], end_val[2];
int dist;
if ((ED_view3d_project_short_global(ar, gest->stk->points[0].p, start_val, V3D_PROJ_TEST_NOP) == V3D_PROJ_RET_OK) &&
(ED_view3d_project_short_global(ar, sk_lastStrokePoint(gest->stk)->p, end_val, V3D_PROJ_TEST_NOP) == V3D_PROJ_RET_OK))
if ((ED_view3d_project_int_global(ar, gest->stk->points[0].p, start_val, V3D_PROJ_TEST_NOP) == V3D_PROJ_RET_OK) &&
(ED_view3d_project_int_global(ar, sk_lastStrokePoint(gest->stk)->p, end_val, V3D_PROJ_TEST_NOP) == V3D_PROJ_RET_OK))
{
dist = MAX2(ABS(start_val[0] - end_val[0]), ABS(start_val[1] - end_val[1]));
dist = len_manhattan_v2v2_int(start_val, end_val);
/* if gesture is a circle */
if (dist <= 20) {

@ -929,7 +929,6 @@ static int slide_point_modal(bContext *C, wmOperator *op, const wmEvent *event)
if (data->is_sliding_new_point) {
if (ELEM(data->which_handle, MASK_WHICH_HANDLE_LEFT, MASK_WHICH_HANDLE_RIGHT)) {
BezTriple *bezt = &data->point->bezt;
float vec[2];
short self_handle = (data->which_handle == MASK_WHICH_HANDLE_LEFT) ? 0 : 2;
short other_handle = (data->which_handle == MASK_WHICH_HANDLE_LEFT) ? 2 : 0;
@ -1005,12 +1004,12 @@ static int slide_point_modal(bContext *C, wmOperator *op, const wmEvent *event)
w = len_v2(vec);
if (is_overall_feather) {
float delta;
float w_delta;
if (dot_v2v2(no, vec) <= 0.0f)
w = -w;
delta = w - data->weight * data->weight_scalar;
w_delta = w - data->weight * data->weight_scalar;
if (data->orig_spline == NULL) {
/* restore weight for currently sliding point, so orig_spline would be created
@ -1025,7 +1024,7 @@ static int slide_point_modal(bContext *C, wmOperator *op, const wmEvent *event)
*weight = w * weight_scalar;
}
slide_point_delta_all_feather(data, delta);
slide_point_delta_all_feather(data, w_delta);
}
else {
if (dot_v2v2(no, vec) <= 0.0f)
@ -1081,7 +1080,6 @@ static int slide_point_modal(bContext *C, wmOperator *op, const wmEvent *event)
}
if (data->is_sliding_new_point) {
BezTriple *bezt = &data->point->bezt;
if (len_squared_v2v2(bezt->vec[0], bezt->vec[1]) < FLT_EPSILON) {
bezt->h1 = HD_VECT;
}

@ -859,7 +859,6 @@ static void knife_cut_face(KnifeTool_OpData *kcd, BMFace *f, ListBase *hits)
static void knife_add_cut(KnifeTool_OpData *kcd)
{
int i;
KnifeLineHit *lh;
GHash *facehits;
BMFace *f;
Ref *r;
@ -877,7 +876,7 @@ static void knife_add_cut(KnifeTool_OpData *kcd)
/* make facehits: map face -> list of linehits touching it */
facehits = BLI_ghash_ptr_new("knife facehits");
for (i = 0; i < kcd->totlinehit; i++) {
lh = &kcd->linehits[i];
KnifeLineHit *lh = &kcd->linehits[i];
if (lh->f) {
add_hit_to_facehits(kcd, facehits, lh->f, lh);
}
@ -908,15 +907,14 @@ static void knife_add_cut(KnifeTool_OpData *kcd)
if (kcd->prev.bmface) {
KnifeLineHit *lh;
/* was "in face" but now we have a KnifeVert it is snapped to */
lh = &kcd->linehits[kcd->totlinehit - 1];
KnifeLineHit *lh = &kcd->linehits[kcd->totlinehit - 1];
kcd->prev.vert = lh->v;
kcd->prev.bmface = NULL;
}
if (kcd->is_drag_hold) {
lh = &kcd->linehits[kcd->totlinehit - 1];
KnifeLineHit *lh = &kcd->linehits[kcd->totlinehit - 1];
linehit_to_knifepos(&kcd->prev, lh);
}

@ -1256,8 +1256,7 @@ static int edbm_select_similar_region_exec(bContext *C, wmOperator *op)
LinkData *link;
while ((link = BLI_pophead(&faces_regions))) {
BMFace *f, **faces = link->data;
unsigned int i = 0;
while ((f = faces[i++])) {
while ((f = *(faces++))) {
BM_face_select_set(bm, f, true);
}
MEM_freeN(faces);

@ -584,7 +584,6 @@ static int bake(
size_t num_pixels;
int tot_materials;
int i;
RE_bake_engine_set_engine_parameters(re, bmain, scene);
@ -641,7 +640,7 @@ static int bake(
num_pixels = (size_t)width * (size_t)height * bake_images.size;
for (i = 0; i < bake_images.size; i++) {
for (int i = 0; i < bake_images.size; i++) {
bake_images.data[i].width = width;
bake_images.data[i].height = height;
bake_images.data[i].offset = (is_split_materials ? num_pixels : 0);
@ -650,8 +649,9 @@ static int bake(
if (!is_split_materials) {
/* saving a single image */
for (i = 0; i < tot_materials; i++)
for (int i = 0; i < tot_materials; i++) {
bake_images.lookup[i] = 0;
}
}
}
@ -890,7 +890,7 @@ cage_cleanup:
}
else {
/* save the results */
for (i = 0; i < bake_images.size; i++) {
for (int i = 0; i < bake_images.size; i++) {
BakeImage *bk_image = &bake_images.data[i];
if (is_save_internal) {

@ -2132,7 +2132,6 @@ static bool tag_localizable_looper(void *UNUSED(user_data), ID **id_pointer, con
static void tag_localizable_objects(bContext *C, const int mode)
{
Main *bmain = CTX_data_main(C);
Object *object;
BKE_main_id_tag_all(bmain, false);
@ -2156,7 +2155,7 @@ static void tag_localizable_objects(bContext *C, const int mode)
/* Also forbid making objects local if other library objects are using
* them for modifiers or constraints.
*/
for (object = bmain->object.first; object; object = object->id.next) {
for (Object *object = bmain->object.first; object; object = object->id.next) {
if ((object->id.flag & LIB_DOIT) == 0) {
BKE_library_foreach_ID_link(&object->id, tag_localizable_looper, NULL, IDWALK_READONLY);
}

@ -1718,7 +1718,7 @@ static void vgroup_smooth_subset(
{
const float ifac = 1.0f - fac;
MDeformVert **dvert_array = NULL;
int i, dvert_tot = 0;
int dvert_tot = 0;
int *vgroup_subset_map = BLI_array_alloca(vgroup_subset_map, subset_count);
float *vgroup_subset_weights = BLI_array_alloca(vgroup_subset_weights, subset_count);
const bool use_mirror = (ob->type == OB_MESH) ? (((Mesh *)ob->data)->editflag & ME_EDIT_MIRROR_X) != 0 : false;
@ -1768,7 +1768,7 @@ static void vgroup_smooth_subset(
/* initialize used verts */
if (bm) {
for (i = 0; i < dvert_tot; i++) {
for (int i = 0; i < dvert_tot; i++) {
BMVert *v = BM_vert_at_index(bm, i);
if (BM_elem_flag_test(v, BM_ELEM_SELECT)) {
BMIter eiter;
@ -1786,7 +1786,7 @@ static void vgroup_smooth_subset(
}
}
else {
for (i = 0; i < dvert_tot; i++) {
for (int i = 0; i < dvert_tot; i++) {
MVert *v = &me->mvert[i];
if (v->flag & SELECT) {
int j;

@ -302,7 +302,7 @@ static void screen_opengl_render_doit(OGLRender *oglrender, RenderResult *rr)
if (gpd) {
int i;
unsigned char *gp_rect;
unsigned char *rect = (unsigned char *)RE_RenderViewGetById(rr, oglrender->view_id)->rect32;
unsigned char *render_rect = (unsigned char *)RE_RenderViewGetById(rr, oglrender->view_id)->rect32;
GPU_offscreen_bind(oglrender->ofs, true);
@ -320,7 +320,7 @@ static void screen_opengl_render_doit(OGLRender *oglrender, RenderResult *rr)
GPU_offscreen_read_pixels(oglrender->ofs, GL_UNSIGNED_BYTE, gp_rect);
for (i = 0; i < sizex * sizey * 4; i += 4) {
blend_color_mix_byte(&rect[i], &rect[i], &gp_rect[i]);
blend_color_mix_byte(&render_rect[i], &render_rect[i], &gp_rect[i]);
}
GPU_offscreen_unbind(oglrender->ofs, true);

@ -459,7 +459,6 @@ static bool paintcurve_point_select(bContext *C, wmOperator *op, const int loc[2
Paint *p = BKE_paint_get_active_from_context(C);
Brush *br = p->brush;
PaintCurve *pc;
PaintCurvePoint *pcp;
int i;
const float loc_fl[2] = {UNPACK2(loc)};
@ -470,12 +469,13 @@ static bool paintcurve_point_select(bContext *C, wmOperator *op, const int loc[2
paintcurve_undo_begin(C, op, pc);
pcp = pc->points;
if (toggle) {
PaintCurvePoint *pcp;
char select = 0;
bool selected = false;
pcp = pc->points;
for (i = 0; i < pc->tot_points; i++) {
if (pcp[i].bez.f1 || pcp[i].bez.f2 || pcp[i].bez.f3) {
selected = true;

@ -870,8 +870,7 @@ static void paint_stroke_add_sample(const Paint *paint,
float x, float y, float pressure)
{
PaintSample *sample = &stroke->samples[stroke->cur_sample];
int max_samples = MIN2(PAINT_MAX_INPUT_SAMPLES,
MAX2(paint->num_input_samples, 1));
int max_samples = CLAMPIS(paint->num_input_samples, 1, PAINT_MAX_INPUT_SAMPLES);
sample->mouse[0] = x;
sample->mouse[1] = y;

@ -354,7 +354,6 @@ static void create_ghost_curves(bAnimContext *ac, int start, int end)
FPoint *fpt;
float unitFac, offset;
int cfra;
SpaceIpo *sipo = (SpaceIpo *) ac->sl;
short mapping_flag = ANIM_get_normalization_flags(ac);
/* disable driver so that it don't muck up the sampling process */

@ -1220,7 +1220,7 @@ static int image_open_invoke(bContext *C, wmOperator *op, const wmEvent *UNUSED(
const char *path = U.textudir;
Image *ima = NULL;
Scene *scene = CTX_data_scene(C);
PropertyRNA *prop;
if (sima) {
ima = sima->image;
}
@ -1260,6 +1260,7 @@ static int image_open_invoke(bContext *C, wmOperator *op, const wmEvent *UNUSED(
image_open_init(C, op);
/* show multiview save options only if scene has multiviews */
PropertyRNA *prop;
prop = RNA_struct_find_property(op->ptr, "show_multiview");
RNA_property_boolean_set(op->ptr, prop, (scene->r.scemode & R_MULTIVIEW) != 0);
@ -2300,10 +2301,11 @@ static int image_new_exec(bContext *C, wmOperator *op)
SpaceLink *sl;
for (sl = sa->spacedata.first; sl; sl = sl->next) {
if (sl->spacetype == SPACE_IMAGE) {
SpaceImage *sima = (SpaceImage *)sl;
SpaceImage *sima_other = (SpaceImage *)sl;
if (!sima->pin)
ED_space_image_set(sima, scene, scene->obedit, ima);
if (!sima_other->pin) {
ED_space_image_set(sima_other, scene, scene->obedit, ima);
}
}
}
}

@ -2452,7 +2452,6 @@ static void node_composit_buts_planetrackdeform(uiLayout *layout, bContext *C, P
MovieTrackingObject *object;
uiLayout *col;
PointerRNA tracking_ptr;
NodeTrackPosData *data = node->storage;
RNA_pointer_create(&clip->id, &RNA_MovieTracking, tracking, &tracking_ptr);

@ -2438,7 +2438,7 @@ static int node_shader_script_update_exec(bContext *C, wmOperator *op)
Scene *scene = CTX_data_scene(C);
SpaceNode *snode = CTX_wm_space_node(C);
PointerRNA nodeptr = CTX_data_pointer_get_type(C, "node", &RNA_ShaderNodeScript);
bNodeTree *ntree = NULL;
bNodeTree *ntree_base = NULL;
bNode *node = NULL;
RenderEngine *engine;
RenderEngineType *type;
@ -2451,17 +2451,17 @@ static int node_shader_script_update_exec(bContext *C, wmOperator *op)
/* get node */
if (nodeptr.data) {
ntree = nodeptr.id.data;
ntree_base = nodeptr.id.data;
node = nodeptr.data;
}
else if (snode && snode->edittree) {
ntree = snode->edittree;
ntree_base = snode->edittree;
node = nodeGetActive(snode->edittree);
}
if (node) {
/* update single node */
type->update_script_node(engine, ntree, node);
type->update_script_node(engine, ntree_base, node);
found = true;
}

@ -208,11 +208,11 @@ static void restrictbutton_recursive_child(bContext *C, Scene *scene, Object *ob
id = ptr.id.data;
if (autokeyframe_cfra_can_key(scene, id)) {
ReportList *reports = CTX_wm_reports(C);
short flag = ANIM_get_keyframing_flags(scene, 1);
eInsertKeyFlags key_flag = ANIM_get_keyframing_flags(scene, 1);
fcu->flag &= ~FCURVE_SELECTED;
insert_keyframe(reports, id, action, ((fcu->grp) ? (fcu->grp->name) : (NULL)),
fcu->rna_path, fcu->array_index, CFRA, flag);
fcu->rna_path, fcu->array_index, CFRA, key_flag);
/* Assuming this is not necessary here, since 'ancestor' object button will do it anyway. */
/* WM_event_add_notifier(C, NC_ANIMATION | ND_KEYFRAME | NA_EDITED, NULL); */
}

@ -555,10 +555,9 @@ static eOLDrawState tree_element_active_bone(
if (ob) {
if (set != OL_SETSEL_EXTEND) {
/* single select forces all other bones to get unselected */
Bone *bone;
for (bone = arm->bonebase.first; bone != NULL; bone = bone->next) {
bone->flag &= ~(BONE_TIPSEL | BONE_SELECTED | BONE_ROOTSEL);
do_outliner_bone_select_recursive(arm, bone, false);
for (Bone *bone_iter = arm->bonebase.first; bone_iter != NULL; bone_iter = bone_iter->next) {
bone_iter->flag &= ~(BONE_TIPSEL | BONE_SELECTED | BONE_ROOTSEL);
do_outliner_bone_select_recursive(arm, bone_iter, false);
}
}
}

@ -447,8 +447,6 @@ static void outliner_add_scene_contents(SpaceOops *soops, ListBase *lb, Scene *s
// can be inlined if necessary
static void outliner_add_object_contents(SpaceOops *soops, TreeElement *te, TreeStoreElem *tselem, Object *ob)
{
int a = 0;
if (outliner_animdata_test(ob->adt))
outliner_add_element(soops, &te->subtree, ob, te, TSE_ANIM_DATA, 0);
@ -464,13 +462,13 @@ static void outliner_add_object_contents(SpaceOops *soops, TreeElement *te, Tree
if (ob->pose) {
bArmature *arm = ob->data;
bPoseChannel *pchan;
TreeElement *ten;
TreeElement *tenla = outliner_add_element(soops, &te->subtree, ob, te, TSE_POSE_BASE, 0);
tenla->name = IFACE_("Pose");
/* channels undefined in editmode, but we want the 'tenla' pose icon itself */
if ((arm->edbo == NULL) && (ob->mode & OB_MODE_POSE)) {
TreeElement *ten;
int a = 0, const_index = 1000; /* ensure unique id for bone constraints */
for (pchan = ob->pose->chanbase.first; pchan; pchan = pchan->next, a++) {
@ -522,21 +520,22 @@ static void outliner_add_object_contents(SpaceOops *soops, TreeElement *te, Tree
/* Pose Groups */
if (ob->pose->agroups.first) {
bActionGroup *agrp;
TreeElement *ten;
TreeElement *tenla = outliner_add_element(soops, &te->subtree, ob, te, TSE_POSEGRP_BASE, 0);
TreeElement *ten_bonegrp = outliner_add_element(soops, &te->subtree, ob, te, TSE_POSEGRP_BASE, 0);
int a = 0;
tenla->name = IFACE_("Bone Groups");
ten_bonegrp->name = IFACE_("Bone Groups");
for (agrp = ob->pose->agroups.first; agrp; agrp = agrp->next, a++) {
ten = outliner_add_element(soops, &tenla->subtree, ob, tenla, TSE_POSEGRP, a);
TreeElement *ten;
ten = outliner_add_element(soops, &ten_bonegrp->subtree, ob, ten_bonegrp, TSE_POSEGRP, a);
ten->name = agrp->name;
ten->directdata = agrp;
}
}
}
for (a = 0; a < ob->totcol; a++)
for (int a = 0; a < ob->totcol; a++) {
outliner_add_element(soops, &te->subtree, ob->mat[a], te, 0, a);
}
if (ob->constraints.first) {
//Object *target;
@ -544,6 +543,7 @@ static void outliner_add_object_contents(SpaceOops *soops, TreeElement *te, Tree
TreeElement *ten;
TreeElement *tenla = outliner_add_element(soops, &te->subtree, ob, te, TSE_CONSTRAINT_BASE, 0);
//char *str;
int a;
tenla->name = IFACE_("Constraints");
for (con = ob->constraints.first, a = 0; con; con = con->next, a++) {
@ -562,34 +562,34 @@ static void outliner_add_object_contents(SpaceOops *soops, TreeElement *te, Tree
if (ob->modifiers.first) {
ModifierData *md;
TreeElement *temod = outliner_add_element(soops, &te->subtree, ob, te, TSE_MODIFIER_BASE, 0);
TreeElement *ten_mod = outliner_add_element(soops, &te->subtree, ob, te, TSE_MODIFIER_BASE, 0);
int index;
temod->name = IFACE_("Modifiers");
ten_mod->name = IFACE_("Modifiers");
for (index = 0, md = ob->modifiers.first; md; index++, md = md->next) {
TreeElement *te = outliner_add_element(soops, &temod->subtree, ob, temod, TSE_MODIFIER, index);
te->name = md->name;
te->directdata = md;
TreeElement *ten = outliner_add_element(soops, &ten_mod->subtree, ob, ten_mod, TSE_MODIFIER, index);
ten->name = md->name;
ten->directdata = md;
if (md->type == eModifierType_Lattice) {
outliner_add_element(soops, &te->subtree, ((LatticeModifierData *) md)->object, te, TSE_LINKED_OB, 0);
outliner_add_element(soops, &ten->subtree, ((LatticeModifierData *) md)->object, ten, TSE_LINKED_OB, 0);
}
else if (md->type == eModifierType_Curve) {
outliner_add_element(soops, &te->subtree, ((CurveModifierData *) md)->object, te, TSE_LINKED_OB, 0);
outliner_add_element(soops, &ten->subtree, ((CurveModifierData *) md)->object, ten, TSE_LINKED_OB, 0);
}
else if (md->type == eModifierType_Armature) {
outliner_add_element(soops, &te->subtree, ((ArmatureModifierData *) md)->object, te, TSE_LINKED_OB, 0);
outliner_add_element(soops, &ten->subtree, ((ArmatureModifierData *) md)->object, ten, TSE_LINKED_OB, 0);
}
else if (md->type == eModifierType_Hook) {
outliner_add_element(soops, &te->subtree, ((HookModifierData *) md)->object, te, TSE_LINKED_OB, 0);
outliner_add_element(soops, &ten->subtree, ((HookModifierData *) md)->object, ten, TSE_LINKED_OB, 0);
}
else if (md->type == eModifierType_ParticleSystem) {
TreeElement *ten;
ParticleSystem *psys = ((ParticleSystemModifierData *) md)->psys;
TreeElement *ten_psys;
ten = outliner_add_element(soops, &te->subtree, ob, te, TSE_LINKED_PSYS, 0);
ten->directdata = psys;
ten->name = psys->part->id.name + 2;
ten_psys = outliner_add_element(soops, &ten_psys->subtree, ob, ten_psys, TSE_LINKED_PSYS, 0);
ten_psys->directdata = psys;
ten_psys->name = psys->part->id.name + 2;
}
}
}
@ -599,6 +599,7 @@ static void outliner_add_object_contents(SpaceOops *soops, TreeElement *te, Tree
bDeformGroup *defgroup;
TreeElement *ten;
TreeElement *tenla = outliner_add_element(soops, &te->subtree, ob, te, TSE_DEFGROUP_BASE, 0);
int a;
tenla->name = IFACE_("Vertex Groups");
for (defgroup = ob->defbase.first, a = 0; defgroup; defgroup = defgroup->next, a++) {
@ -1571,7 +1572,6 @@ static int outliner_filter_tree(SpaceOops *soops, ListBase *lb)
void outliner_build_tree(Main *mainvar, Scene *scene, SpaceOops *soops)
{
Base *base;
Object *ob;
TreeElement *te = NULL, *ten;
TreeStoreElem *tselem;
int show_opened = !soops->treestore || !BLI_mempool_count(soops->treestore); /* on first view, we open scenes */
@ -1596,7 +1596,9 @@ void outliner_build_tree(Main *mainvar, Scene *scene, SpaceOops *soops)
outliner_storage_cleanup(soops);
/* clear ob id.new flags */
for (ob = mainvar->object.first; ob; ob = ob->id.next) ob->id.newid = NULL;
for (Object *ob = mainvar->object.first; ob; ob = ob->id.next) {
ob->id.newid = NULL;
}
/* options */
if (soops->outlinevis == SO_LIBRARIES) {

@ -1905,7 +1905,7 @@ static void drawcamera_stereo3d(
Scene *scene, View3D *v3d, RegionView3D *rv3d, Object *ob, const Camera *cam,
float vec[4][3], float drawsize, const float scale[3])
{
int i, j;
int i;
float obmat[4][4];
float vec_lr[2][4][3];
const float fac = (cam->stereo.pivot == CAM_S3D_PIVOT_CENTER) ? 2.0f : 1.0f;
@ -1938,7 +1938,7 @@ static void drawcamera_stereo3d(
((BKE_camera_multiview_shift_x(&scene->r, ob, names[i]) - cam->shiftx) *
(drawsize * scale[0] * fac));
for (j = 0; j < 4; j++) {
for (int j = 0; j < 4; j++) {
vec_lr[i][j][0] += shift_x;
}
}
@ -1956,7 +1956,7 @@ static void drawcamera_stereo3d(
/* convergence plane */
if (is_stereo3d_plane || is_stereo3d_volume) {
for (j = 0; j < 4; j++) {
for (int j = 0; j < 4; j++) {
mul_m4_v3(obmat, vec_lr[i][j]);
}
}
@ -5101,7 +5101,6 @@ static void draw_new_particle_system(Scene *scene, View3D *v3d, RegionView3D *rv
bool select = (ob->flag & SELECT) != 0, create_cdata = false, need_v = false;
GLint polygonmode[2];
char numstr[32];
size_t numstr_len;
unsigned char tcol[4] = {0, 0, 0, 255};
/* 1. */
@ -5605,8 +5604,8 @@ static void draw_new_particle_system(Scene *scene, View3D *v3d, RegionView3D *rv
if (part->draw & PART_DRAW_HAIR_GRID) {
ClothModifierData *clmd = psys->clmd;
if (clmd) {
float *a = clmd->hair_grid_min;
float *b = clmd->hair_grid_max;
float *gmin = clmd->hair_grid_min;
float *gmax = clmd->hair_grid_max;
int *res = clmd->hair_grid_res;
int i;
@ -5620,20 +5619,20 @@ static void draw_new_particle_system(Scene *scene, View3D *v3d, RegionView3D *rv
else
UI_ThemeColor(TH_WIRE);
glBegin(GL_LINES);
glVertex3f(a[0], a[1], a[2]); glVertex3f(b[0], a[1], a[2]);
glVertex3f(b[0], a[1], a[2]); glVertex3f(b[0], b[1], a[2]);
glVertex3f(b[0], b[1], a[2]); glVertex3f(a[0], b[1], a[2]);
glVertex3f(a[0], b[1], a[2]); glVertex3f(a[0], a[1], a[2]);
glVertex3f(gmin[0], gmin[1], gmin[2]); glVertex3f(gmax[0], gmin[1], gmin[2]);
glVertex3f(gmax[0], gmin[1], gmin[2]); glVertex3f(gmax[0], gmax[1], gmin[2]);
glVertex3f(gmax[0], gmax[1], gmin[2]); glVertex3f(gmin[0], gmax[1], gmin[2]);
glVertex3f(gmin[0], gmax[1], gmin[2]); glVertex3f(gmin[0], gmin[1], gmin[2]);
glVertex3f(a[0], a[1], b[2]); glVertex3f(b[0], a[1], b[2]);
glVertex3f(b[0], a[1], b[2]); glVertex3f(b[0], b[1], b[2]);
glVertex3f(b[0], b[1], b[2]); glVertex3f(a[0], b[1], b[2]);
glVertex3f(a[0], b[1], b[2]); glVertex3f(a[0], a[1], b[2]);
glVertex3f(gmin[0], gmin[1], gmax[2]); glVertex3f(gmax[0], gmin[1], gmax[2]);
glVertex3f(gmax[0], gmin[1], gmax[2]); glVertex3f(gmax[0], gmax[1], gmax[2]);
glVertex3f(gmax[0], gmax[1], gmax[2]); glVertex3f(gmin[0], gmax[1], gmax[2]);
glVertex3f(gmin[0], gmax[1], gmax[2]); glVertex3f(gmin[0], gmin[1], gmax[2]);
glVertex3f(a[0], a[1], a[2]); glVertex3f(a[0], a[1], b[2]);
glVertex3f(b[0], a[1], a[2]); glVertex3f(b[0], a[1], b[2]);
glVertex3f(a[0], b[1], a[2]); glVertex3f(a[0], b[1], b[2]);
glVertex3f(b[0], b[1], a[2]); glVertex3f(b[0], b[1], b[2]);
glVertex3f(gmin[0], gmin[1], gmin[2]); glVertex3f(gmin[0], gmin[1], gmax[2]);
glVertex3f(gmax[0], gmin[1], gmin[2]); glVertex3f(gmax[0], gmin[1], gmax[2]);
glVertex3f(gmin[0], gmax[1], gmin[2]); glVertex3f(gmin[0], gmax[1], gmax[2]);
glVertex3f(gmax[0], gmax[1], gmin[2]); glVertex3f(gmax[0], gmax[1], gmax[2]);
glEnd();
if (select)
@ -5643,25 +5642,25 @@ static void draw_new_particle_system(Scene *scene, View3D *v3d, RegionView3D *rv
glEnable(GL_BLEND);
glBegin(GL_LINES);
for (i = 1; i < res[0] - 1; ++i) {
float f = interpf(b[0], a[0], (float)i / (float)(res[0] - 1));
glVertex3f(f, a[1], a[2]); glVertex3f(f, b[1], a[2]);
glVertex3f(f, b[1], a[2]); glVertex3f(f, b[1], b[2]);
glVertex3f(f, b[1], b[2]); glVertex3f(f, a[1], b[2]);
glVertex3f(f, a[1], b[2]); glVertex3f(f, a[1], a[2]);
float f = interpf(gmax[0], gmin[0], (float)i / (float)(res[0] - 1));
glVertex3f(f, gmin[1], gmin[2]); glVertex3f(f, gmax[1], gmin[2]);
glVertex3f(f, gmax[1], gmin[2]); glVertex3f(f, gmax[1], gmax[2]);
glVertex3f(f, gmax[1], gmax[2]); glVertex3f(f, gmin[1], gmax[2]);
glVertex3f(f, gmin[1], gmax[2]); glVertex3f(f, gmin[1], gmin[2]);
}
for (i = 1; i < res[1] - 1; ++i) {
float f = interpf(b[1], a[1], (float)i / (float)(res[1] - 1));
glVertex3f(a[0], f, a[2]); glVertex3f(b[0], f, a[2]);
glVertex3f(b[0], f, a[2]); glVertex3f(b[0], f, b[2]);
glVertex3f(b[0], f, b[2]); glVertex3f(a[0], f, b[2]);
glVertex3f(a[0], f, b[2]); glVertex3f(a[0], f, a[2]);
float f = interpf(gmax[1], gmin[1], (float)i / (float)(res[1] - 1));
glVertex3f(gmin[0], f, gmin[2]); glVertex3f(gmax[0], f, gmin[2]);
glVertex3f(gmax[0], f, gmin[2]); glVertex3f(gmax[0], f, gmax[2]);
glVertex3f(gmax[0], f, gmax[2]); glVertex3f(gmin[0], f, gmax[2]);
glVertex3f(gmin[0], f, gmax[2]); glVertex3f(gmin[0], f, gmin[2]);
}
for (i = 1; i < res[2] - 1; ++i) {
float f = interpf(b[2], a[2], (float)i / (float)(res[2] - 1));
glVertex3f(a[0], a[1], f); glVertex3f(b[0], a[1], f);
glVertex3f(b[0], a[1], f); glVertex3f(b[0], b[1], f);
glVertex3f(b[0], b[1], f); glVertex3f(a[0], b[1], f);
glVertex3f(a[0], b[1], f); glVertex3f(a[0], a[1], f);
float f = interpf(gmax[2], gmin[2], (float)i / (float)(res[2] - 1));
glVertex3f(gmin[0], gmin[1], f); glVertex3f(gmax[0], gmin[1], f);
glVertex3f(gmax[0], gmin[1], f); glVertex3f(gmax[0], gmax[1], f);
glVertex3f(gmax[0], gmax[1], f); glVertex3f(gmin[0], gmax[1], f);
glVertex3f(gmin[0], gmax[1], f); glVertex3f(gmin[0], gmin[1], f);
}
glEnd();
glDisable(GL_BLEND);
@ -5713,7 +5712,7 @@ static void draw_new_particle_system(Scene *scene, View3D *v3d, RegionView3D *rv
for (a = 0, pa = psys->particles; a < totpart; a++, pa++) {
float vec_txt[3];
numstr_len = BLI_snprintf_rlen(numstr, sizeof(numstr), "%i", a);
size_t numstr_len = BLI_snprintf_rlen(numstr, sizeof(numstr), "%i", a);
/* use worldspace because object matrix is already applied */
mul_v3_m4v3(vec_txt, ob->imat, cache[a]->co);
view3d_cached_text_draw_add(vec_txt, numstr, numstr_len,
@ -5916,16 +5915,16 @@ static void draw_ptcache_edit(Scene *scene, View3D *v3d, PTCacheEdit *edit)
if (pset->selectmode == SCE_SELECT_POINT) {
float *pd = NULL, *pdata = NULL;
float *cd = NULL, *cdata = NULL;
int totkeys = 0;
int totkeys_visible = 0;
for (i = 0, point = edit->points; i < totpoint; i++, point++)
if (!(point->flag & PEP_HIDE))
totkeys += point->totkey;
totkeys_visible += point->totkey;
if (totkeys) {
if (totkeys_visible) {
if (edit->points && !(edit->points->keys->flag & PEK_USE_WCO))
pd = pdata = MEM_callocN(totkeys * 3 * sizeof(float), "particle edit point data");
cd = cdata = MEM_callocN(totkeys * (timed ? 4 : 3) * sizeof(float), "particle edit color data");
pd = pdata = MEM_callocN(totkeys_visible * 3 * sizeof(float), "particle edit point data");
cd = cdata = MEM_callocN(totkeys_visible * (timed ? 4 : 3) * sizeof(float), "particle edit color data");
}
for (i = 0, point = edit->points; i < totpoint; i++, point++) {

@ -3494,11 +3494,11 @@ ImBuf *ED_view3d_draw_offscreen_imbuf_simple(
{
CameraParams params;
Object *camera = BKE_camera_multiview_render(scene, v3d.camera, viewname);
Object *view_camera = BKE_camera_multiview_render(scene, v3d.camera, viewname);
BKE_camera_params_init(&params);
BKE_camera_params_from_object(&params, camera);
BKE_camera_multiview_params(&scene->r, &params, camera, viewname);
BKE_camera_params_from_object(&params, view_camera);
BKE_camera_multiview_params(&scene->r, &params, view_camera, viewname);
BKE_camera_params_compute_viewplane(&params, width, height, scene->r.xasp, scene->r.yasp);
BKE_camera_params_compute_matrix(&params);

@ -630,28 +630,28 @@ static bool view3d_orbit_calc_center(bContext *C, float r_dyn_ofs[3])
bool is_set = false;
Scene *scene = CTX_data_scene(C);
Object *ob = OBACT;
Object *ob_act = OBACT;
if (ob && (ob->mode & OB_MODE_ALL_PAINT) &&
if (ob_act && (ob_act->mode & OB_MODE_ALL_PAINT) &&
/* with weight-paint + pose-mode, fall through to using calculateTransformCenter */
((ob->mode & OB_MODE_WEIGHT_PAINT) && BKE_object_pose_armature_get(ob)) == 0)
((ob_act->mode & OB_MODE_WEIGHT_PAINT) && BKE_object_pose_armature_get(ob_act)) == 0)
{
/* in case of sculpting use last average stroke position as a rotation
* center, in other cases it's not clear what rotation center shall be
* so just rotate around object origin
*/
if (ob->mode & (OB_MODE_SCULPT | OB_MODE_TEXTURE_PAINT | OB_MODE_VERTEX_PAINT | OB_MODE_WEIGHT_PAINT)) {
if (ob_act->mode & (OB_MODE_SCULPT | OB_MODE_TEXTURE_PAINT | OB_MODE_VERTEX_PAINT | OB_MODE_WEIGHT_PAINT)) {
float stroke[3];
BKE_paint_stroke_get_average(scene, ob, stroke);
BKE_paint_stroke_get_average(scene, ob_act, stroke);
copy_v3_v3(lastofs, stroke);
}
else {
copy_v3_v3(lastofs, ob->obmat[3]);
copy_v3_v3(lastofs, ob_act->obmat[3]);
}
is_set = true;
}
else if (ob && (ob->mode & OB_MODE_EDIT) && (ob->type == OB_FONT)) {
Curve *cu = ob->data;
else if (ob_act && (ob_act->mode & OB_MODE_EDIT) && (ob_act->type == OB_FONT)) {
Curve *cu = ob_act->data;
EditFont *ef = cu->editfont;
int i;
@ -661,11 +661,11 @@ static bool view3d_orbit_calc_center(bContext *C, float r_dyn_ofs[3])
}
mul_v2_fl(lastofs, 1.0f / 4.0f);
mul_m4_v3(ob->obmat, lastofs);
mul_m4_v3(ob_act->obmat, lastofs);
is_set = true;
}
else if (ob == NULL || ob->mode == OB_MODE_OBJECT) {
else if (ob_act == NULL || ob_act->mode == OB_MODE_OBJECT) {
/* object mode use boundbox centers */
View3D *v3d = CTX_wm_view3d(C);
Base *base;

@ -6441,13 +6441,12 @@ static bool createEdgeSlideVerts_single_side(TransInfo *t, bool use_even, bool f
BMesh *bm = em->bm;
BMIter iter;
BMEdge *e;
BMVert *v;
TransDataEdgeSlideVert *sv_array;
int sv_tot;
int *sv_table; /* BMVert -> sv_array index */
EdgeSlideData *sld = MEM_callocN(sizeof(*sld), "sld");
float mval[2] = {(float)t->mval[0], (float)t->mval[1]};
int i, j, loop_nr;
int loop_nr;
bool use_btree_disp = false;
View3D *v3d = NULL;
RegionView3D *rv3d = NULL;
@ -6468,35 +6467,39 @@ static bool createEdgeSlideVerts_single_side(TransInfo *t, bool use_even, bool f
t->flag |= T_ALT_TRANSFORM;
/* ensure valid selection */
j = 0;
BM_ITER_MESH_INDEX (v, &iter, bm, BM_VERTS_OF_MESH, i) {
if (BM_elem_flag_test(v, BM_ELEM_SELECT)) {
float len_sq_max = -1.0f;
BMIter iter2;
BM_ITER_ELEM (e, &iter2, v, BM_EDGES_OF_VERT) {
if (!BM_elem_flag_test(e, BM_ELEM_SELECT)) {
float len_sq = BM_edge_calc_length_squared(e);
if (len_sq > len_sq_max) {
len_sq_max = len_sq;
v->e = e;
{
int i = 0, j = 0;
BMVert *v;
BM_ITER_MESH_INDEX (v, &iter, bm, BM_VERTS_OF_MESH, i) {
if (BM_elem_flag_test(v, BM_ELEM_SELECT)) {
float len_sq_max = -1.0f;
BMIter iter2;
BM_ITER_ELEM (e, &iter2, v, BM_EDGES_OF_VERT) {
if (!BM_elem_flag_test(e, BM_ELEM_SELECT)) {
float len_sq = BM_edge_calc_length_squared(e);
if (len_sq > len_sq_max) {
len_sq_max = len_sq;
v->e = e;
}
}
}
}
if (len_sq_max != -1.0f) {
j++;
if (len_sq_max != -1.0f) {
j++;
}
}
BM_elem_index_set(v, i); /* set_inline */
}
BM_elem_index_set(v, i); /* set_inline */
}
bm->elem_index_dirty &= ~BM_VERT;
bm->elem_index_dirty &= ~BM_VERT;
if (!j) {
return false;
if (!j) {
return false;
}
sv_tot = j;
}
sv_tot = j;
BLI_assert(sv_tot != 0);
/* over alloc */
sv_array = MEM_callocN(sizeof(TransDataEdgeSlideVert) * bm->totvertsel, "sv_array");
@ -6506,20 +6509,24 @@ static bool createEdgeSlideVerts_single_side(TransInfo *t, bool use_even, bool f
sv_table = MEM_mallocN(sizeof(*sv_table) * bm->totvert, __func__);
j = 0;
BM_ITER_MESH_INDEX (v, &iter, bm, BM_VERTS_OF_MESH, i) {
sv_table[i] = -1;
if ((v->e != NULL) && (BM_elem_flag_test(v, BM_ELEM_SELECT))) {
if (BM_elem_flag_test(v->e, BM_ELEM_SELECT) == 0) {
TransDataEdgeSlideVert *sv;
sv = &sv_array[j];
sv->v = v;
copy_v3_v3(sv->v_co_orig, v->co);
sv->v_side[0] = BM_edge_other_vert(v->e, v);
sub_v3_v3v3(sv->dir_side[0], sv->v_side[0]->co, v->co);
sv->loop_nr = 0;
sv_table[i] = j;
j += 1;
{
int i = 0, j = 0;
BMVert *v;
BM_ITER_MESH_INDEX (v, &iter, bm, BM_VERTS_OF_MESH, i) {
sv_table[i] = -1;
if ((v->e != NULL) && (BM_elem_flag_test(v, BM_ELEM_SELECT))) {
if (BM_elem_flag_test(v->e, BM_ELEM_SELECT) == 0) {
TransDataEdgeSlideVert *sv;
sv = &sv_array[j];
sv->v = v;
copy_v3_v3(sv->v_co_orig, v->co);
sv->v_side[0] = BM_edge_other_vert(v->e, v);
sub_v3_v3v3(sv->dir_side[0], sv->v_side[0]->co, v->co);
sv->loop_nr = 0;
sv_table[i] = j;
j += 1;
}
}
}
}
@ -6529,14 +6536,15 @@ static bool createEdgeSlideVerts_single_side(TransInfo *t, bool use_even, bool f
if (sv_tot != bm->totvert) {
const int sv_tot_nowire = sv_tot;
TransDataEdgeSlideVert *sv_iter = sv_array;
int i;
for (i = 0; i < sv_tot_nowire; i++, sv_iter++) {
for (int i = 0; i < sv_tot_nowire; i++, sv_iter++) {
BMIter eiter;
BM_ITER_ELEM (e, &eiter, sv_iter->v, BM_EDGES_OF_VERT) {
/* walk over wire */
TransDataEdgeSlideVert *sv_end = NULL;
BMEdge *e_step = e;
BMVert *v = sv_iter->v;
int j;
j = sv_tot;

@ -2047,11 +2047,13 @@ static void editmesh_set_connectivity_distance(BMesh *bm, float mtx[3][3], float
if (BM_elem_flag_test(e_iter, BM_ELEM_HIDDEN) == 0) {
/* edge distance */
BMVert *v_other = BM_edge_other_vert(e_iter, v);
if (bmesh_test_dist_add(v, v_other, dists, dists_prev, mtx)) {
if (BM_elem_flag_test(v_other, BM_ELEM_TAG) == 0) {
BM_elem_flag_enable(v_other, BM_ELEM_TAG);
BLI_LINKSTACK_PUSH(queue_next, v_other);
{
BMVert *v_other = BM_edge_other_vert(e_iter, v);
if (bmesh_test_dist_add(v, v_other, dists, dists_prev, mtx)) {
if (BM_elem_flag_test(v_other, BM_ELEM_TAG) == 0) {
BM_elem_flag_enable(v_other, BM_ELEM_TAG);
BLI_LINKSTACK_PUSH(queue_next, v_other);
}
}
}
@ -2089,10 +2091,10 @@ static void editmesh_set_connectivity_distance(BMesh *bm, float mtx[3][3], float
/* clear for the next loop */
for (lnk = queue_next; lnk; lnk = lnk->next) {
BMVert *v = lnk->link;
const int i = BM_elem_index_get(v);
BMVert *v_link = lnk->link;
const int i = BM_elem_index_get(v_link);
BM_elem_flag_disable(v, BM_ELEM_TAG);
BM_elem_flag_disable(v_link, BM_ELEM_TAG);
/* keep in sync, avoid having to do full memcpy each iteration */
dists_prev[i] = dists[i];
@ -3751,16 +3753,19 @@ static void createTransActionData(bContext *C, TransInfo *t)
/* loop 2: build transdata array */
for (ale = anim_data.first; ale; ale = ale->next) {
AnimData *adt;
if (is_prop_edit && !ale->tag)
continue;
adt = ANIM_nla_mapping_get(&ac, ale);
if (adt)
cfra = BKE_nla_tweakedit_remap(adt, (float)CFRA, NLATIME_CONVERT_UNMAP);
else
cfra = (float)CFRA;
cfra = (float)CFRA;
{
AnimData *adt;
adt = ANIM_nla_mapping_get(&ac, ale);
if (adt) {
cfra = BKE_nla_tweakedit_remap(adt, cfra, NLATIME_CONVERT_UNMAP);
}
}
if (ale->type == ANIMTYPE_GPLAYER) {
bGPDlayer *gpl = (bGPDlayer *)ale->data;

@ -461,8 +461,6 @@ static int get_undo_system(bContext *C)
}
}
else {
Object *obact = CTX_data_active_object(C);
if (obact) {
if (obact->mode & OB_MODE_PARTICLE_EDIT)
return UNDOSYSTEM_PARTICLE;