Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/source
diff options
context:
space:
mode:
authorBastien Montagne <montagne29@wanadoo.fr>2020-01-16 18:08:17 +0300
committerBastien Montagne <montagne29@wanadoo.fr>2020-01-16 18:08:17 +0300
commit5b8c2301d8b7400013903fe0b02071ba19aafb9f (patch)
tree68e48ef00213eced561c84f18c5e409d573bd72d /source
parent59d3e4357a9054fd65be455198051634e4b40156 (diff)
parentd74f9c4b7b4f2b9b72462f908bdd7e251a42f478 (diff)
Merge branch 'blender-v2.82-release'
Diffstat (limited to 'source')
-rw-r--r--source/blender/blenkernel/BKE_node.h3
-rw-r--r--source/blender/blenkernel/intern/node.c14
-rw-r--r--source/blender/draw/engines/eevee/shaders/lightprobe_planar_display_vert.glsl4
-rw-r--r--source/blender/editors/space_outliner/outliner_tree.c34
-rw-r--r--source/blender/gpu/intern/gpu_codegen.c17
-rw-r--r--source/blender/nodes/shader/node_shader_tree.c2
6 files changed, 40 insertions, 34 deletions
diff --git a/source/blender/blenkernel/BKE_node.h b/source/blender/blenkernel/BKE_node.h
index 11f151af44d..b599e1e1b2c 100644
--- a/source/blender/blenkernel/BKE_node.h
+++ b/source/blender/blenkernel/BKE_node.h
@@ -545,7 +545,8 @@ void nodeRemoveNode(struct Main *bmain,
struct bNode *BKE_node_copy_ex(struct bNodeTree *ntree,
const struct bNode *node_src,
- const int flag);
+ const int flag,
+ const bool unique_name);
/* Same as BKE_node_copy_ex() but stores pointers to a new node and its sockets in the source
* node.
diff --git a/source/blender/blenkernel/intern/node.c b/source/blender/blenkernel/intern/node.c
index 13169d9ace8..75e0d044c7c 100644
--- a/source/blender/blenkernel/intern/node.c
+++ b/source/blender/blenkernel/intern/node.c
@@ -1089,7 +1089,11 @@ static void node_socket_copy(bNodeSocket *sock_dst, const bNodeSocket *sock_src,
/* keep socket listorder identical, for copying links */
/* ntree is the target tree */
-bNode *BKE_node_copy_ex(bNodeTree *ntree, const bNode *node_src, const int flag)
+/* unique_name needs to be true. It's only disabled for speed when doing GPUnodetrees. */
+bNode *BKE_node_copy_ex(bNodeTree *ntree,
+ const bNode *node_src,
+ const int flag,
+ const bool unique_name)
{
bNode *node_dst = MEM_callocN(sizeof(bNode), "dupli node");
bNodeSocket *sock_dst, *sock_src;
@@ -1098,7 +1102,9 @@ bNode *BKE_node_copy_ex(bNodeTree *ntree, const bNode *node_src, const int flag)
*node_dst = *node_src;
/* can be called for nodes outside a node tree (e.g. clipboard) */
if (ntree) {
- nodeUniqueName(ntree, node_dst);
+ if (unique_name) {
+ nodeUniqueName(ntree, node_dst);
+ }
BLI_addtail(&ntree->nodes, node_dst);
}
@@ -1186,7 +1192,7 @@ static void node_set_new_pointers(bNode *node_src, bNode *new_node)
bNode *BKE_node_copy_store_new_pointers(bNodeTree *ntree, bNode *node_src, const int flag)
{
- bNode *new_node = BKE_node_copy_ex(ntree, node_src, flag);
+ bNode *new_node = BKE_node_copy_ex(ntree, node_src, flag, true);
node_set_new_pointers(node_src, new_node);
return new_node;
}
@@ -1516,7 +1522,7 @@ void BKE_node_tree_copy_data(Main *UNUSED(bmain),
GHash *new_pointers = BLI_ghash_ptr_new("BKE_node_tree_copy_data");
for (const bNode *node_src = ntree_src->nodes.first; node_src; node_src = node_src->next) {
- bNode *new_node = BKE_node_copy_ex(ntree_dst, node_src, flag_subdata);
+ bNode *new_node = BKE_node_copy_ex(ntree_dst, node_src, flag_subdata, true);
BLI_ghash_insert(new_pointers, (void *)node_src, new_node);
/* Store mapping to inputs. */
bNodeSocket *new_input_sock = new_node->inputs.first;
diff --git a/source/blender/draw/engines/eevee/shaders/lightprobe_planar_display_vert.glsl b/source/blender/draw/engines/eevee/shaders/lightprobe_planar_display_vert.glsl
index 540f2ac4728..65506e5c7b1 100644
--- a/source/blender/draw/engines/eevee/shaders/lightprobe_planar_display_vert.glsl
+++ b/source/blender/draw/engines/eevee/shaders/lightprobe_planar_display_vert.glsl
@@ -9,7 +9,7 @@ flat out int probeIdx;
void main()
{
- gl_Position = ViewProjectionMatrix * probe_mat * vec4(pos, 1.0);
- worldPosition = (probe_mat * vec4(pos, 1.0)).xyz;
+ worldPosition = (probe_mat * vec4(-pos.x, pos.y, 0.0, 1.0)).xyz;
+ gl_Position = ViewProjectionMatrix * vec4(worldPosition, 1.0);
probeIdx = probe_id;
}
diff --git a/source/blender/editors/space_outliner/outliner_tree.c b/source/blender/editors/space_outliner/outliner_tree.c
index ed0d85477f1..1bb1a1c5964 100644
--- a/source/blender/editors/space_outliner/outliner_tree.c
+++ b/source/blender/editors/space_outliner/outliner_tree.c
@@ -1267,6 +1267,7 @@ static TreeElement *outliner_add_library_contents(Main *mainvar,
for (a = 0; a < tot; a++) {
if (lbarray[a] && lbarray[a]->first) {
ID *id = lbarray[a]->first;
+ const bool is_library = (GS(id->name) == ID_LI) && (lib != NULL);
/* check if there's data in current lib */
for (; id; id = id->next) {
@@ -1275,7 +1276,9 @@ static TreeElement *outliner_add_library_contents(Main *mainvar,
}
}
- if (id) {
+ /* We always want to create an entry for libraries, even if/when we have no more IDs from
+ * them. This invalid state is important to show to user as well.*/
+ if (id != NULL || is_library) {
if (!tenlib) {
/* Create library tree element on demand, depending if there are any data-blocks. */
if (lib) {
@@ -1288,18 +1291,20 @@ static TreeElement *outliner_add_library_contents(Main *mainvar,
}
/* Create data-block list parent element on demand. */
- if (filter_id_type) {
- ten = tenlib;
- }
- else {
- ten = outliner_add_element(soops, &tenlib->subtree, lbarray[a], NULL, TSE_ID_BASE, 0);
- ten->directdata = lbarray[a];
- ten->name = outliner_idcode_to_plural(GS(id->name));
- }
+ if (id != NULL) {
+ if (filter_id_type) {
+ ten = tenlib;
+ }
+ else {
+ ten = outliner_add_element(soops, &tenlib->subtree, lbarray[a], NULL, TSE_ID_BASE, 0);
+ ten->directdata = lbarray[a];
+ ten->name = outliner_idcode_to_plural(GS(id->name));
+ }
- for (id = lbarray[a]->first; id; id = id->next) {
- if (outliner_library_id_show(lib, id, filter_id_type)) {
- outliner_add_element(soops, &ten->subtree, id, ten, 0, 0);
+ for (id = lbarray[a]->first; id; id = id->next) {
+ if (outliner_library_id_show(lib, id, filter_id_type)) {
+ outliner_add_element(soops, &ten->subtree, id, ten, 0, 0);
+ }
}
}
}
@@ -2306,9 +2311,8 @@ void outliner_build_tree(
for (lib = mainvar->libraries.first; lib; lib = lib->id.next) {
ten = outliner_add_library_contents(mainvar, soops, &soops->tree, lib);
- if (ten) {
- lib->id.newid = (ID *)ten;
- }
+ BLI_assert(ten != NULL);
+ lib->id.newid = (ID *)ten;
}
/* make hierarchy */
ten = soops->tree.first;
diff --git a/source/blender/gpu/intern/gpu_codegen.c b/source/blender/gpu/intern/gpu_codegen.c
index 1da7274b2cd..5a5c3ace552 100644
--- a/source/blender/gpu/intern/gpu_codegen.c
+++ b/source/blender/gpu/intern/gpu_codegen.c
@@ -1340,17 +1340,12 @@ static char *code_generate_geometry(ListBase *nodes, const char *geom_code, cons
"barycentricPosg[2]);\n");
}
- BLI_dynstr_append(ds, "\tgl_Position = gl_in[0].gl_Position;\n");
- BLI_dynstr_append(ds, "\tpass_attr(0);\n");
- BLI_dynstr_append(ds, "\tEmitVertex();\n");
-
- BLI_dynstr_append(ds, "\tgl_Position = gl_in[1].gl_Position;\n");
- BLI_dynstr_append(ds, "\tpass_attr(1);\n");
- BLI_dynstr_append(ds, "\tEmitVertex();\n");
-
- BLI_dynstr_append(ds, "\tgl_Position = gl_in[2].gl_Position;\n");
- BLI_dynstr_append(ds, "\tpass_attr(2);\n");
- BLI_dynstr_append(ds, "\tEmitVertex();\n");
+ for (int i = 0; i < 3; i++) {
+ BLI_dynstr_appendf(ds, "\tgl_Position = gl_in[%d].gl_Position;\n", i);
+ BLI_dynstr_appendf(ds, "\tgl_ClipDistance[0] = gl_in[%d].gl_ClipDistance[0];\n", i);
+ BLI_dynstr_appendf(ds, "\tpass_attr(%d);\n", i);
+ BLI_dynstr_append(ds, "\tEmitVertex();\n");
+ }
BLI_dynstr_append(ds, "}\n");
}
}
diff --git a/source/blender/nodes/shader/node_shader_tree.c b/source/blender/nodes/shader/node_shader_tree.c
index ffeeb7525d5..dfbc49577e3 100644
--- a/source/blender/nodes/shader/node_shader_tree.c
+++ b/source/blender/nodes/shader/node_shader_tree.c
@@ -636,7 +636,7 @@ static bNode *ntree_shader_copy_branch(bNodeTree *ntree,
if (node->tmp_flag >= 0) {
int id = node->tmp_flag;
nodes_copy[id] = BKE_node_copy_ex(
- ntree, node, LIB_ID_CREATE_NO_USER_REFCOUNT | LIB_ID_CREATE_NO_MAIN);
+ ntree, node, LIB_ID_CREATE_NO_USER_REFCOUNT | LIB_ID_CREATE_NO_MAIN, false);
nodes_copy[id]->tmp_flag = -2; /* Copy */
/* Make sure to clear all sockets links as they are invalid. */
LISTBASE_FOREACH (bNodeSocket *, sock, &nodes_copy[id]->inputs) {