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
diff options
context:
space:
mode:
authorJacques Lucke <jacques@blender.org>2021-10-25 14:02:43 +0300
committerJacques Lucke <jacques@blender.org>2021-10-25 14:03:57 +0300
commit039094c1ec50636cdff89132a67598841889cda9 (patch)
treef71922b969742f759e7d8c6903669e0baea1dfa5 /source/blender/editors/space_node/node_add.cc
parent2b91445ddd0d24e4ac362c33b79a9e9c8e63f5d5 (diff)
Geometry Nodes: new Image Texture node
This adds a new image texture node for geometry nodes. It does not reuse the same node that is used in shading, because we want to be able to expose the image and frame as sockets. There is a known update issue when a movie or image sequence is used. That will be fixed separately (also see D12957). Currently, the image socket is just a pointer to an Image ID data block. This can contain single images but also movies and image sequences. In the future, the definition of an image socket can be expanded to include images that are generated from scratch in the node tree. For more details read the discussion in D12827. Some of the code is a direct port from cycles and should be cleaned up a bit in the future. For example `image_cubic_texture_lookup`. For still images, the frame input is ignored. Otherwise, the frame has to be in a valid range for the node to work. In the future we may add e.g. automatic looping functionality. Differential Revision: https://developer.blender.org/D12827
Diffstat (limited to 'source/blender/editors/space_node/node_add.cc')
-rw-r--r--source/blender/editors/space_node/node_add.cc14
1 files changed, 12 insertions, 2 deletions
diff --git a/source/blender/editors/space_node/node_add.cc b/source/blender/editors/space_node/node_add.cc
index 7b6ca5e6e61..cb66d0dbd2b 100644
--- a/source/blender/editors/space_node/node_add.cc
+++ b/source/blender/editors/space_node/node_add.cc
@@ -758,7 +758,7 @@ static bool node_add_file_poll(bContext *C)
{
const SpaceNode *snode = CTX_wm_space_node(C);
return ED_operator_node_editable(C) &&
- ELEM(snode->nodetree->type, NTREE_SHADER, NTREE_TEXTURE, NTREE_COMPOSIT);
+ ELEM(snode->nodetree->type, NTREE_SHADER, NTREE_TEXTURE, NTREE_COMPOSIT, NTREE_GEOMETRY);
}
static int node_add_file_exec(bContext *C, wmOperator *op)
@@ -784,6 +784,9 @@ static int node_add_file_exec(bContext *C, wmOperator *op)
case NTREE_COMPOSIT:
type = CMP_NODE_IMAGE;
break;
+ case NTREE_GEOMETRY:
+ type = GEO_NODE_IMAGE_TEXTURE;
+ break;
default:
return OPERATOR_CANCELLED;
}
@@ -797,7 +800,14 @@ static int node_add_file_exec(bContext *C, wmOperator *op)
return OPERATOR_CANCELLED;
}
- node->id = (ID *)ima;
+ if (type == GEO_NODE_IMAGE_TEXTURE) {
+ bNodeSocket *image_socket = (bNodeSocket *)node->inputs.first;
+ bNodeSocketValueImage *socket_value = (bNodeSocketValueImage *)image_socket->default_value;
+ socket_value->value = ima;
+ }
+ else {
+ node->id = (ID *)ima;
+ }
/* When adding new image file via drag-drop we need to load imbuf in order
* to get proper image source.