Merge branch 'master' into blender2.8

# Conflicts:
#	intern/cycles/blender/blender_mesh.cpp
#	source/blender/editors/screen/screen_ops.c
#	source/blender/editors/space_view3d/drawobject.c
This commit is contained in:
Germano Cavalcante 2018-01-21 18:45:47 -02:00
commit 790025c01e
14 changed files with 103 additions and 77 deletions

View File

@ -448,6 +448,7 @@ struct bNodeSocket *nodeInsertStaticSocket(struct bNodeTree *ntree, struct bNode
struct bNodeSocket *next_sock, const char *identifier, const char *name);
void nodeRemoveSocket(struct bNodeTree *ntree, struct bNode *node, struct bNodeSocket *sock);
void nodeRemoveAllSockets(struct bNodeTree *ntree, struct bNode *node);
void nodeModifySocketType(struct bNodeTree *ntree, struct bNode *node, struct bNodeSocket *sock, int type, int subtype);
struct bNode *nodeAddNode(const struct bContext *C, struct bNodeTree *ntree, const char *idname);
struct bNode *nodeAddStaticNode(const struct bContext *C, struct bNodeTree *ntree, int type);

View File

@ -506,6 +506,26 @@ static bNodeSocket *make_socket(bNodeTree *ntree, bNode *UNUSED(node), int in_ou
return sock;
}
void nodeModifySocketType(bNodeTree *ntree, bNode *UNUSED(node), bNodeSocket *sock,
int type, int subtype)
{
const char *idname = nodeStaticSocketType(type, subtype);
if (!idname) {
printf("Error: static node socket type %d undefined\n", type);
return;
}
if (sock->default_value) {
MEM_freeN(sock->default_value);
sock->default_value = NULL;
}
sock->type = type;
BLI_strncpy(sock->idname, idname, sizeof(sock->idname));
node_socket_set_typeinfo(ntree, sock, nodeSocketTypeFind(idname));
}
bNodeSocket *nodeAddSocket(bNodeTree *ntree, bNode *node, int in_out, const char *idname,
const char *identifier, const char *name)
{

View File

@ -4505,7 +4505,8 @@ Sequence *BKE_sequencer_foreground_frame_get(Scene *scene, int frame)
/* Only use strips that generate an image, not ones that combine
* other strips or apply some effect. */
if (ELEM(seq->type, SEQ_TYPE_IMAGE, SEQ_TYPE_META, SEQ_TYPE_SCENE,
SEQ_TYPE_MOVIE, SEQ_TYPE_COLOR, SEQ_TYPE_TEXT)) {
SEQ_TYPE_MOVIE, SEQ_TYPE_COLOR, SEQ_TYPE_TEXT))
{
if (seq->machine > best_machine) {
best_seq = seq;
best_machine = seq->machine;

View File

@ -175,7 +175,7 @@ static void shrinkwrap_calc_nearest_vertex(ShrinkwrapCalcData *calc)
settings.userdata_chunk = &nearest;
settings.userdata_chunk_size = sizeof(nearest);
BLI_task_parallel_range(0, calc->numVerts,
&data,shrinkwrap_calc_nearest_vertex_cb_ex,
&data, shrinkwrap_calc_nearest_vertex_cb_ex,
&settings);
free_bvhtree_from_mesh(&treeData);

View File

@ -1552,7 +1552,7 @@ static void ccgDM_copyFinalLoopArray(DerivedMesh *dm, MLoop *mloop)
BLI_edgehash_insert(ehash, medge[i].v1, medge[i].v2, SET_INT_IN_POINTER(i));
}
atomic_cas_ptr((void**)&ccgdm->ehash, ccgdm->ehash, ehash);
atomic_cas_ptr((void **)&ccgdm->ehash, ccgdm->ehash, ehash);
}
BLI_mutex_unlock(&ccgdm->loops_cache_lock);
}

View File

@ -182,7 +182,7 @@ typedef struct ParallelRangeSettings {
} ParallelRangeSettings;
BLI_INLINE void BLI_parallel_range_settings_defaults(
ParallelRangeSettings* settings);
ParallelRangeSettings *settings);
void BLI_task_parallel_range(
const int start, const int stop,
@ -210,7 +210,7 @@ void BLI_task_parallel_mempool(
/* TODO(sergey): Think of a better place for this. */
BLI_INLINE void BLI_parallel_range_settings_defaults(
ParallelRangeSettings* settings)
ParallelRangeSettings *settings)
{
memset(settings, 0, sizeof(*settings));
settings->use_threading = true;

View File

@ -875,7 +875,7 @@ static void non_recursive_bvh_div_nodes_task_cb(
* to use multithread building.
*
* To archive this is necessary to find how much leafs are accessible from a certain branch, BVHBuildHelper
* implicit_needed_branches and implicit_leafs_index are auxiliary functions to solve that "optimal-split".
* #implicit_needed_branches and #implicit_leafs_index are auxiliary functions to solve that "optimal-split".
*/
static void non_recursive_bvh_div_nodes(
const BVHTree *tree, BVHNode *branches_array, BVHNode **leafs_array, int num_leafs)
@ -888,25 +888,24 @@ static void non_recursive_bvh_div_nodes(
BVHBuildHelper data;
int depth;
/* set parent from root node to NULL */
BVHNode *tmp = &branches_array[0];
tmp->parent = NULL;
/* Most of bvhtree code relies on 1-leaf trees having at least one branch
* We handle that special case here */
if (num_leafs == 1) {
BVHNode *root = &branches_array[0];
refit_kdop_hull(tree, root, 0, num_leafs);
root->main_axis = get_largest_axis(root->bv) / 2;
root->totnode = 1;
root->children[0] = leafs_array[0];
root->children[0]->parent = root;
return;
{
/* set parent from root node to NULL */
BVHNode *root = &branches_array[1];
root->parent = NULL;
/* Most of bvhtree code relies on 1-leaf trees having at least one branch
* We handle that special case here */
if (num_leafs == 1) {
refit_kdop_hull(tree, root, 0, num_leafs);
root->main_axis = get_largest_axis(root->bv) / 2;
root->totnode = 1;
root->children[0] = leafs_array[0];
root->children[0]->parent = root;
return;
}
}
branches_array--; /* Implicit trees use 1-based indexs */
build_implicit_tree_helper(tree, &data);
BVHDivNodesData cb_data = {
@ -1053,9 +1052,6 @@ void BLI_bvhtree_free(BVHTree *tree)
void BLI_bvhtree_balance(BVHTree *tree)
{
int i;
BVHNode *branches_array = tree->nodearray + tree->totleaf;
BVHNode **leafs_array = tree->nodes;
/* This function should only be called once
@ -1063,13 +1059,14 @@ void BLI_bvhtree_balance(BVHTree *tree)
BLI_assert(tree->totbranch == 0);
/* Build the implicit tree */
non_recursive_bvh_div_nodes(tree, branches_array, leafs_array, tree->totleaf);
non_recursive_bvh_div_nodes(tree, tree->nodearray + (tree->totleaf - 1), leafs_array, tree->totleaf);
/* current code expects the branches to be linked to the nodes array
* we perform that linkage here */
tree->totbranch = implicit_needed_branches(tree->tree_type, tree->totleaf);
for (i = 0; i < tree->totbranch; i++)
tree->nodes[tree->totleaf + i] = branches_array + i;
for (int i = 0; i < tree->totbranch; i++) {
tree->nodes[tree->totleaf + i] = &tree->nodearray[tree->totleaf + i];
}
#ifdef USE_SKIP_LINKS
build_skip_links(tree, tree->nodes[tree->totleaf], NULL, NULL);

View File

@ -1485,7 +1485,7 @@ void ED_keymap_ui(wmKeyConfig *keyconf)
* through until a suitable eyedropper for the active button is found */
WM_keymap_add_item(keymap, "UI_OT_eyedropper_color", EKEY, KM_PRESS, 0, 0);
WM_keymap_add_item(keymap, "UI_OT_eyedropper_colorband", EKEY, KM_PRESS, 0, 0);
WM_keymap_add_item(keymap, "UI_OT_eyedropper_colorband_point", EKEY, KM_PRESS , KM_ALT, 0);
WM_keymap_add_item(keymap, "UI_OT_eyedropper_colorband_point", EKEY, KM_PRESS, KM_ALT, 0);
WM_keymap_add_item(keymap, "UI_OT_eyedropper_id", EKEY, KM_PRESS, 0, 0);
WM_keymap_add_item(keymap, "UI_OT_eyedropper_depth", EKEY, KM_PRESS, 0, 0);

View File

@ -288,7 +288,7 @@ static void drawscredge_area(ScrArea *sa, int sizex, int sizey, unsigned int pos
}
/**
* Only for edge lines between areas, and the blended join arrows.
* Only for edge lines between areas.
*/
void ED_screen_draw_edges(wmWindow *win)
{
@ -326,6 +326,12 @@ void ED_screen_draw_edges(wmWindow *win)
screen->do_draw = false;
}
/**
* The blended join arrows.
*
* \param sa1: Area from which the resultant originates.
* \param sa2: Target area that will be replaced.
*/
void ED_screen_draw_join_shape(ScrArea *sa1, ScrArea *sa2)
{
unsigned int pos = GWN_vertformat_attr_add(immVertexFormat(), "pos", GWN_COMP_F32, 2, GWN_FETCH_FLOAT);

View File

@ -1470,8 +1470,6 @@ static void SCREEN_OT_area_move(wmOperatorType *ot)
*/
typedef struct sAreaSplitData {
int x, y; /* last used mouse position */
int origval; /* for move areas */
int bigger, smaller; /* constraints for moving new edge */
int delta; /* delta move edge */
@ -1718,9 +1716,6 @@ static int area_split_invoke(bContext *C, wmOperator *op, const wmEvent *event)
sd = (sAreaSplitData *)op->customdata;
sd->x = event->x;
sd->y = event->y;
if (event->type == EVT_ACTIONZONE_AREA) {
/* do the split */
@ -1792,8 +1787,15 @@ static int area_split_modal(bContext *C, wmOperator *op, const wmEvent *event)
const int dir = RNA_property_enum_get(op->ptr, prop_dir);
sd->delta = (dir == 'v') ? event->x - sd->origval : event->y - sd->origval;
if (sd->previewmode == 0)
area_move_apply_do(C, sd->delta, sd->origval, dir, sd->bigger, sd->smaller, sd->do_snap);
if (sd->previewmode == 0) {
if (sd->do_snap) {
const int snap_loc = area_snap_calc_location(
CTX_wm_screen(C), sd->delta, sd->origval, dir, sd->bigger, sd->smaller);
sd->delta = snap_loc - sd->origval;
}
area_move_apply_do(C, sd->delta, sd->origval, dir, sd->bigger, sd->smaller, false);
}
else {
if (sd->sarea) {
ED_area_tag_redraw(sd->sarea);
@ -1802,7 +1804,26 @@ static int area_split_modal(bContext *C, wmOperator *op, const wmEvent *event)
sd->sarea = BKE_screen_find_area_xy(CTX_wm_screen(C), SPACE_TYPE_ANY, event->x, event->y);
if (sd->sarea) {
ED_area_tag_redraw(sd->sarea);
ScrArea *sa = sd->sarea;
if (dir == 'v') {
sd->origsize = sa->winx;
sd->origmin = sa->totrct.xmin;
}
else {
sd->origsize = sa->winy;
sd->origmin = sa->totrct.ymin;
}
if (sd->do_snap) {
sa->v1->editflag = sa->v2->editflag = sa->v3->editflag = sa->v4->editflag = 1;
const int snap_loc = area_snap_calc_location(
CTX_wm_screen(C), sd->delta, sd->origval, dir, sd->origmin + sd->origsize, -sd->origmin);
sa->v1->editflag = sa->v2->editflag = sa->v3->editflag = sa->v4->editflag = 0;
sd->delta = snap_loc - sd->origval;
}
update_factor = true;
}
@ -1836,8 +1857,6 @@ static int area_split_modal(bContext *C, wmOperator *op, const wmEvent *event)
RNA_property_enum_set(op->ptr, prop_dir, (dir == 'v') ? 'h' : 'v');
area_split_preview_update_cursor(C, op);
update_factor = true;
ED_area_tag_redraw(sd->sarea);
}
}
}
@ -1857,31 +1876,12 @@ static int area_split_modal(bContext *C, wmOperator *op, const wmEvent *event)
if (update_factor) {
const int dir = RNA_property_enum_get(op->ptr, prop_dir);
float fac;
float fac = (float)(sd->delta + sd->origval - sd->origmin) / sd->origsize;
RNA_float_set(op->ptr, "factor", fac);
if (dir == 'v') {
sd->origsize = sd->sarea->winx;
sd->origmin = sd->sarea->totrct.xmin;
if (sd->sarea) {
ED_area_tag_redraw(sd->sarea);
}
else {
sd->origsize = sd->sarea->winy;
sd->origmin = sd->sarea->totrct.ymin;
}
if (sd->do_snap) {
ScrArea *sa = sd->sarea;
sa->v1->editflag = sa->v2->editflag = sa->v3->editflag = sa->v4->editflag = 1;
int snap_loc = area_snap_calc_location(
CTX_wm_screen(C), sd->delta, sd->origval, dir, sd->origmin + sd->origsize, -sd->origmin);
sa->v1->editflag = sa->v2->editflag = sa->v3->editflag = sa->v4->editflag = 0;
fac = snap_loc - sd->origmin;
}
else {
fac = (dir == 'v') ? event->x - sd->origmin : event->y - sd->origmin;
}
RNA_float_set(op->ptr, "factor", fac / (float)sd->origsize);
}
return OPERATOR_RUNNING_MODAL;

View File

@ -2792,7 +2792,8 @@ static int graph_driver_delete_invalid_exec(bContext *C, wmOperator *op)
DEG_relations_tag_update(CTX_data_main(C));
WM_event_add_notifier(C, NC_ANIMATION | ND_KEYFRAME | NA_REMOVED, NULL);
WM_reportf(RPT_INFO, "Deleted %u drivers", deleted);
} else {
}
else {
WM_report(RPT_INFO, "No drivers deleted");
}

View File

@ -1034,7 +1034,7 @@ static void drawcube_size(float size, unsigned pos)
{ size, size, size}
};
const GLubyte indices[24] = {0,1,1,3,3,2,2,0,0,4,4,5,5,7,7,6,6,4,1,5,3,7,2,6};
const GLubyte indices[24] = {0, 1, 1, 3, 3, 2, 2, 0, 0, 4, 4, 5, 5, 7, 7, 6, 6, 4, 1, 5, 3, 7, 2, 6};
#if 0
glEnableClientState(GL_VERTEX_ARRAY);
@ -8065,7 +8065,7 @@ static void imm_draw_box(const float vec[8][3], bool solid, unsigned pos)
if (solid) {
/* Adpated from "Optimizing Triangle Strips for Fast Rendering" by F. Evans, S. Skiena and A. Varshney
* (http://www.cs.umd.edu/gvil/papers/av_ts.pdf). */
static const GLubyte tris_strip_indices[14] = {0,1,3,2,6,1,5,0,4,3,7,6,4,5};
static const GLubyte tris_strip_indices[14] = {0, 1, 3, 2, 6, 1, 5, 0, 4, 3, 7, 6, 4, 5};
immBegin(GWN_PRIM_TRI_STRIP, 14);
for (int i = 0; i < 14; ++i) {
immVertex3fv(pos, vec[tris_strip_indices[i]]);
@ -8073,7 +8073,8 @@ static void imm_draw_box(const float vec[8][3], bool solid, unsigned pos)
immEnd();
}
else {
static const GLubyte line_indices[24] = {0,1,1,2,2,3,3,0,0,4,4,5,5,6,6,7,7,4,1,5,2,6,3,7};
static const GLubyte line_indices[24] =
{0, 1, 1, 2, 2, 3, 3, 0, 0, 4, 4, 5, 5, 6, 6, 7, 7, 4, 1, 5, 2, 6, 3, 7};
immBegin(GWN_PRIM_LINES, 24);
for (int i = 0; i < 24; ++i) {
immVertex3fv(pos, vec[line_indices[i]]);

View File

@ -193,7 +193,7 @@ LogImageFile *dpxOpen(const unsigned char *byteStuff, int fromMemory, size_t buf
dpx->srcFormat = format_DPX;
dpx->numElements = swap_ushort(header.imageHeader.elements_per_image, dpx->isMSB);
size_t max_elements = sizeof(header.imageHeader.element)/sizeof(header.imageHeader.element[0]);
size_t max_elements = sizeof(header.imageHeader.element) / sizeof(header.imageHeader.element[0]);
if (dpx->numElements == 0 || dpx->numElements >= max_elements) {
if (verbose) printf("DPX: Wrong number of elements: %d\n", dpx->numElements);
logImageClose(dpx);

View File

@ -112,22 +112,21 @@ static bNodeSocket *verify_socket_template(bNodeTree *ntree, bNode *node, int in
break;
}
if (sock) {
sock->type = stemp->type;
if (sock->type != stemp->type) {
nodeModifySocketType(ntree, node, sock, stemp->type, stemp->subtype);
}
sock->limit = (stemp->limit == 0 ? 0xFFF : stemp->limit);
sock->flag |= stemp->flag;
BLI_remlink(socklist, sock);
return sock;
}
else {
/* no socket for this template found, make a new one */
sock = node_add_socket_from_template(ntree, node, stemp, in_out);
/* remove the new socket from the node socket list first,
* will be added back after verification.
*/
BLI_remlink(socklist, sock);
}
/* remove the new socket from the node socket list first,
* will be added back after verification. */
BLI_remlink(socklist, sock);
return sock;
}