35using bke::bNodeTreeZone;
36using bke::bNodeTreeZones;
50 elem->
node_id = context->node_id();
51 if (
const bNode *caller_node = context->node()) {
78 elem->
index = context->index();
86 if (
const std::optional<nodes::ClosureSourceLocation> &source =
87 context->closure_source_location())
104 snode.
edittree->ensure_topology_cache();
110 snode, compute_context_cache, node.input_socket(0));
111 if (!socket_context) {
117 id_elem->
id = &ob->
id;
120 for (
const ComputeContext *context = socket_context; context; context = context->parent()) {
138 std::optional<int> item_identifier)
155 bool found_view3d_with_enabled_viewer =
false;
156 View3D *any_view3d_without_viewer =
nullptr;
167 if (item_identifier) {
178 found_view3d_with_enabled_viewer =
true;
181 any_view3d_without_viewer = &v3d;
187 if (!found_view3d_with_enabled_viewer && any_view3d_without_viewer !=
nullptr) {
216 return reinterpret_cast<Object *
>(id);
227 if (elems_vec.
size() < 3) {
237 if (root_id ==
nullptr) {
244 remaining_elems = remaining_elems.
drop_front(1);
249 const int modifier_uid =
252 remaining_elems = remaining_elems.
drop_front(1);
255 if (!
ELEM(elem->type,
282 if (md->persistent_uid != parsed_viewer_path.
modifier_uid) {
291 if (
modifier->node_group ==
nullptr) {
297 ngroup->ensure_topology_cache();
299 switch (path_elem->
type) {
304 typed_elem.sim_output_node_id);
305 if (next_zone ==
nullptr) {
317 typed_elem.repeat_output_node_id);
318 if (next_zone ==
nullptr) {
328 const auto &typed_elem =
331 typed_elem.zone_output_node_id);
332 if (next_zone ==
nullptr) {
343 const bNode *group_node = ngroup->node_by_id(typed_elem.node_id);
344 if (group_node ==
nullptr) {
348 if (parent_zone != zone) {
351 if (group_node->
id ==
nullptr) {
354 ngroup =
reinterpret_cast<const bNodeTree *
>(group_node->
id);
361 const bNode *evaluate_node = ngroup->node_by_id(typed_elem.evaluate_node_id);
362 if (evaluate_node ==
nullptr) {
366 typed_elem.evaluate_node_id);
367 if (parent_zone != zone) {
370 if (!typed_elem.source_node_tree) {
373 const bNode *closure_output_node = typed_elem.source_node_tree->node_by_id(
374 typed_elem.source_output_node_id);
375 if (!closure_output_node) {
378 ngroup = typed_elem.source_node_tree;
380 if (!closure_tree_zones) {
383 zone = closure_tree_zones->
get_zone_by_node(typed_elem.source_output_node_id);
393 if (viewer_node ==
nullptr) {
397 if (tree_zones ==
nullptr) {
431 for (
const bScreen *screen : screens) {
450 snode.
edittree->ensure_topology_cache();
451 const bNode *viewer_node = snode.
edittree->node_by_id(viewer_node_id);
452 if (viewer_node ==
nullptr) {
493 const std::optional<ViewerPathForGeometryNodesViewer> parsed_viewer_path =
495 if (!parsed_viewer_path.has_value()) {
499 snode.
edittree->ensure_topology_cache();
500 bNode *possible_viewer = snode.
edittree->node_by_id(parsed_viewer_path->viewer_node_id);
501 if (possible_viewer ==
nullptr) {
509 return possible_viewer;
526 return &compute_context_cache.
for_modifier(parent_compute_context, elem.modifier_uid);
530 return &compute_context_cache.
for_group_node(parent_compute_context, elem.node_id);
535 elem.sim_output_node_id);
540 parent_compute_context, elem.repeat_output_node_id, elem.iteration);
546 parent_compute_context, elem.zone_output_node_id, elem.index);
550 std::optional<nodes::ClosureSourceLocation> source_location;
551 if (elem.source_node_tree) {
553 elem.source_node_tree,
554 elem.source_output_node_id,
558 parent_compute_context, elem.evaluate_node_id,
nullptr, source_location);
Main * CTX_data_main(const bContext *C)
const char * BKE_id_name(const ID &id)
void BKE_viewer_path_copy(ViewerPath *dst, const ViewerPath *src)
EvaluateClosureNodeViewerPathElem * BKE_viewer_path_elem_new_evaluate_closure()
ViewerNodeViewerPathElem * BKE_viewer_path_elem_new_viewer_node()
@ VIEWER_PATH_EQUAL_FLAG_IGNORE_ITERATION
@ VIEWER_PATH_EQUAL_FLAG_CONSIDER_UI_NAME
void BKE_viewer_path_clear(ViewerPath *viewer_path)
void BKE_viewer_path_init(ViewerPath *viewer_path)
SimulationZoneViewerPathElem * BKE_viewer_path_elem_new_simulation_zone()
ForeachGeometryElementZoneViewerPathElem * BKE_viewer_path_elem_new_foreach_geometry_element_zone()
GroupNodeViewerPathElem * BKE_viewer_path_elem_new_group_node()
IDViewerPathElem * BKE_viewer_path_elem_new_id()
ModifierViewerPathElem * BKE_viewer_path_elem_new_modifier()
RepeatZoneViewerPathElem * BKE_viewer_path_elem_new_repeat_zone()
bool BKE_viewer_path_equal(const ViewerPath *a, const ViewerPath *b, ViewerPathEqualFlag flag=ViewerPathEqualFlag(0))
bScreen * BKE_workspace_active_screen_get(const WorkSpaceInstanceHook *hook) GETTER_ATTRS
WorkSpace * BKE_workspace_active_get(WorkSpaceInstanceHook *hook) GETTER_ATTRS
#define BLI_assert_unreachable()
#define LISTBASE_FOREACH(type, var, list)
BLI_INLINE bool BLI_listbase_is_empty(const ListBase *lb)
void BLI_addtail(ListBase *listbase, void *vlink) ATTR_NONNULL(1)
void BLI_insertlinkafter(ListBase *listbase, void *vprevlink, void *vnewlink) ATTR_NONNULL(1)
void BLI_addhead(ListBase *listbase, void *vlink) ATTR_NONNULL(1)
int BLI_listbase_count(const ListBase *listbase) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL(1)
#define BLI_SCOPED_DEFER(function_to_defer)
char * BLI_strdup(const char *str) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL(1) ATTR_MALLOC
#define SET_FLAG_FROM_TEST(value, test, flag)
void DEG_id_tag_update(ID *id, unsigned int flags)
bool DEG_is_original(const T *id)
@ SPREADSHEET_OBJECT_EVAL_STATE_VIEWER_NODE
@ SPREADSHEET_FLAG_PINNED
@ SPREADSHEET_CLOSURE_NONE
@ VIEWER_PATH_ELEM_TYPE_GROUP_NODE
@ VIEWER_PATH_ELEM_TYPE_SIMULATION_ZONE
@ VIEWER_PATH_ELEM_TYPE_FOREACH_GEOMETRY_ELEMENT_ZONE
@ VIEWER_PATH_ELEM_TYPE_VIEWER_NODE
@ VIEWER_PATH_ELEM_TYPE_REPEAT_ZONE
@ VIEWER_PATH_ELEM_TYPE_MODIFIER
@ VIEWER_PATH_ELEM_TYPE_EVALUATE_CLOSURE
@ VIEWER_PATH_ELEM_TYPE_ID
const ComputeContextHash & hash() const
constexpr Span drop_front(int64_t n) const
constexpr Span drop_back(int64_t n) const
constexpr const T & last(const int64_t n=0) const
void append(const T &value)
const EvaluateClosureComputeContext & for_evaluate_closure(const ComputeContext *parent, int32_t node_id, const bNodeTree *tree=nullptr, const std::optional< nodes::ClosureSourceLocation > &closure_source_location=std::nullopt)
const ModifierComputeContext & for_modifier(const ComputeContext *parent, const NodesModifierData &nmd)
const GroupNodeComputeContext & for_group_node(const ComputeContext *parent, int32_t node_id, const bNodeTree *tree=nullptr)
const ForeachGeometryElementZoneComputeContext & for_foreach_geometry_element_zone(const ComputeContext *parent, int32_t output_node_id, int index)
const RepeatZoneComputeContext & for_repeat_zone(const ComputeContext *parent, int32_t output_node_id, int iteration)
const SimulationZoneComputeContext & for_simulation_zone(const ComputeContext *parent, int output_node_id)
bNodeTreeZone * parent_zone
Vector< bNodeTreeZone * > zones
const bNodeTreeZone * get_zone_by_node(const int32_t node_id) const
std::string node_label(const bNodeTree &ntree, const bNode &node)
const ComputeContext * compute_context_for_edittree_socket(const SpaceNode &snode, bke::ComputeContextCache &compute_context_cache, const bNodeSocket &socket)
ViewerPathElem * viewer_path_elem_for_compute_context(const ComputeContext &compute_context)
void activate_geometry_node(Main &bmain, SpaceNode &snode, bNode &node, std::optional< int > item_identifier=std::nullopt)
Object * parse_object_only(const ViewerPath &viewer_path)
UpdateActiveGeometryNodesViewerResult update_active_geometry_nodes_viewer(const bContext &C, ViewerPath &viewer_path)
std::optional< ViewerPathForGeometryNodesViewer > parse_geometry_nodes_viewer(const ViewerPath &viewer_path)
static void viewer_path_for_geometry_node(const SpaceNode &snode, const bNode &node, ViewerPath &r_dst)
UpdateActiveGeometryNodesViewerResult
bool exists_geometry_nodes_viewer(const ViewerPathForGeometryNodesViewer &parsed_viewer_path)
const ComputeContext * compute_context_for_viewer_path_elem(const ViewerPathElem &elem, bke::ComputeContextCache &compute_context_cache, const ComputeContext *parent_compute_context)
bNode * find_geometry_nodes_viewer(const ViewerPath &viewer_path, SpaceNode &snode)
struct bNodeTree * source_node_tree
int32_t source_output_node_id
int repeat_output_node_id
int32_t sim_output_node_id
struct bNodeTree * edittree
SpreadsheetTableIDGeometry geometry_id
int8_t closure_input_output
SpreadsheetBundlePathElem * bundle_path
uint8_t object_eval_state
int viewer_item_identifier
blender::Vector< const ViewerPathElem * > node_path
void WM_main_add_notifier(uint type, void *reference)