This repository has been archived on 2023-10-09. You can view files and clone it. You cannot open issues or pull requests or push a commit.
Files
blender-archive/source/blender/blenkernel/BKE_node_tree_update.h
Jacques Lucke 720d653b41 Fix T95624: video texture not refreshing when changing offset in node
The main issue is that the image and image user is not updated correctly
in `rna_ImageUser_update`. `BKE_image_user_frame_calc` does not set the
correct frame, because the image is null. Also `IMA_GPU_REFRESH` is not
set for the same reason.

When gpu materials are first created, it is expected that the frame is set
correctly, and the flag is set if necessary. Therefore, somewhere during
depsgraph evaluation, those have to be updated. The depsgraph node
to do the update existed already. Now there is a new relation so that it is
executed when the node tree changed, not only when the frame changed.
2022-02-10 17:31:25 +01:00

116 lines
4.6 KiB
C++

/*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#pragma once
/** \file
* \ingroup bke
*/
struct ID;
struct Main;
struct bNode;
struct bNodeLink;
struct bNodeSocket;
struct bNodeTree;
struct ImageUser;
#ifdef __cplusplus
extern "C" {
#endif
/**
* Tag tree as changed without providing any more information about what has changed exactly.
* The update process has to assume that everything may have changed.
*
* Using one of the methods below to tag the tree after changes is preferred when possible.
*/
void BKE_ntree_update_tag_all(struct bNodeTree *ntree);
/**
* More specialized tag functions that may result in a more efficient update.
*/
void BKE_ntree_update_tag_node_property(struct bNodeTree *ntree, struct bNode *node);
void BKE_ntree_update_tag_node_new(struct bNodeTree *ntree, struct bNode *node);
void BKE_ntree_update_tag_node_removed(struct bNodeTree *ntree);
void BKE_ntree_update_tag_node_mute(struct bNodeTree *ntree, struct bNode *node);
void BKE_ntree_update_tag_node_internal_link(struct bNodeTree *ntree, struct bNode *node);
void BKE_ntree_update_tag_socket_property(struct bNodeTree *ntree, struct bNodeSocket *socket);
void BKE_ntree_update_tag_socket_new(struct bNodeTree *ntree, struct bNodeSocket *socket);
void BKE_ntree_update_tag_socket_type(struct bNodeTree *ntree, struct bNodeSocket *socket);
void BKE_ntree_update_tag_socket_availability(struct bNodeTree *ntree, struct bNodeSocket *socket);
void BKE_ntree_update_tag_socket_removed(struct bNodeTree *ntree);
void BKE_ntree_update_tag_link_changed(struct bNodeTree *ntree);
void BKE_ntree_update_tag_link_removed(struct bNodeTree *ntree);
void BKE_ntree_update_tag_link_added(struct bNodeTree *ntree, struct bNodeLink *link);
void BKE_ntree_update_tag_link_mute(struct bNodeTree *ntree, struct bNodeLink *link);
/** Used when the a new output node becomes active and therefore changes the output. */
void BKE_ntree_update_tag_active_output_changed(struct bNodeTree *ntree);
/** Used after file loading when run-time data on the tree has not been initialized yet. */
void BKE_ntree_update_tag_missing_runtime_data(struct bNodeTree *ntree);
/** Used when the interface sockets/values have changed. */
void BKE_ntree_update_tag_interface(struct bNodeTree *ntree);
/** Used when an id data block changed that might be used by nodes that need to be updated. */
void BKE_ntree_update_tag_id_changed(struct Main *bmain, struct ID *id);
/** Used when an image user is updated that is used by any part of the node tree. */
void BKE_ntree_update_tag_image_user_changed(struct bNodeTree *ntree, struct ImageUser *iuser);
typedef struct NodeTreeUpdateExtraParams {
/**
* Data passed into the callbacks.
*/
void *user_data;
/**
* Called for every tree that has been changed during the update. This can be used to send
* notifiers to trigger redraws or depsgraph updates.
*/
void (*tree_changed_fn)(struct ID *, struct bNodeTree *, void *user_data);
/**
* Called for every tree whose output value may have changed based on the provided update tags.
* This can be used to tag the depsgraph if necessary.
*/
void (*tree_output_changed_fn)(struct ID *, struct bNodeTree *, void *user_data);
} NodeTreeUpdateExtraParams;
/**
* Updates #bmain based on changes to node trees.
*/
void BKE_ntree_update_main(struct Main *bmain, struct NodeTreeUpdateExtraParams *params);
/**
* Same as #BKE_ntree_update_main, but will first only look at the provided tree and only looks
* at #bmain when something relevant for other data-blocks changed. This avoids scanning #bmain in
* many cases.
*
* If #bmain is null, only the provided tree is updated. This should only be used in very rare
* cases because it may result it incorrectly synced data in DNA.
*
* If #tree is null, this is the same as calling #BKE_ntree_update_main.
*/
void BKE_ntree_update_main_tree(struct Main *bmain,
struct bNodeTree *ntree,
struct NodeTreeUpdateExtraParams *params);
#ifdef __cplusplus
}
#endif