39using bke::bNodeTreeZone;
40using bke::bNodeTreeZones;
46 elem->
id =
const_cast<ID *
>(context->id());
63 elem->
node_id = context->node_id();
64 if (
const bNode *caller_node = context->node()) {
91 elem->
index = context->index();
99 if (
const std::optional<nodes::ClosureSourceLocation> &source =
100 context->closure_source_location())
117 snode.
edittree->ensure_topology_cache();
123 snode, compute_context_cache,
node);
128 for (
const ComputeContext *context = node_context; context; context = context->parent()) {
146 std::optional<int> item_identifier)
163 bool found_view3d_with_enabled_viewer =
false;
164 View3D *any_view3d_without_viewer =
nullptr;
175 if (item_identifier) {
186 found_view3d_with_enabled_viewer =
true;
189 any_view3d_without_viewer = &v3d;
195 if (!found_view3d_with_enabled_viewer && any_view3d_without_viewer !=
nullptr) {
224 return reinterpret_cast<Object *
>(
id);
235 if (elems_vec.
size() < 3) {
245 if (root_id ==
nullptr) {
252 remaining_elems = remaining_elems.
drop_front(1);
257 const int modifier_uid =
260 remaining_elems = remaining_elems.
drop_front(1);
263 if (!
ELEM(elem->type,
305 ngroup->ensure_topology_cache();
307 switch (path_elem->
type) {
312 typed_elem.sim_output_node_id);
313 if (next_zone ==
nullptr) {
325 typed_elem.repeat_output_node_id);
326 if (next_zone ==
nullptr) {
336 const auto &typed_elem =
339 typed_elem.zone_output_node_id);
340 if (next_zone ==
nullptr) {
351 const bNode *group_node = ngroup->node_by_id(typed_elem.node_id);
352 if (group_node ==
nullptr) {
356 if (parent_zone != zone) {
359 if (group_node->
id ==
nullptr) {
362 ngroup =
reinterpret_cast<const bNodeTree *
>(group_node->
id);
369 const bNode *evaluate_node = ngroup->node_by_id(typed_elem.evaluate_node_id);
370 if (evaluate_node ==
nullptr) {
374 typed_elem.evaluate_node_id);
375 if (parent_zone != zone) {
378 if (!typed_elem.source_node_tree) {
381 const bNode *closure_output_node = typed_elem.source_node_tree->node_by_id(
382 typed_elem.source_output_node_id);
383 if (!closure_output_node) {
386 ngroup = typed_elem.source_node_tree;
388 if (!closure_tree_zones) {
391 zone = closure_tree_zones->
get_zone_by_node(typed_elem.source_output_node_id);
401 if (viewer_node ==
nullptr) {
405 if (tree_zones ==
nullptr) {
439 for (
const bScreen *screen : screens) {
440 for (
const ScrArea &area : screen->areabase) {
458 snode.
edittree->ensure_topology_cache();
459 const bNode *viewer_node = snode.
edittree->node_by_id(viewer_node_id);
460 if (viewer_node ==
nullptr) {
504 const std::optional<ViewerPathForGeometryNodesViewer> parsed_viewer_path =
506 if (!parsed_viewer_path.has_value()) {
510 snode.
edittree->ensure_topology_cache();
511 bNode *possible_viewer = snode.
edittree->node_by_id(parsed_viewer_path->viewer_node_id);
512 if (possible_viewer ==
nullptr) {
520 return possible_viewer;
535 const auto &elem =
reinterpret_cast<const IDViewerPathElem &
>(elem_generic);
536 if (elem.id ==
nullptr) {
539 return &compute_context_cache.
for_data_block(parent_compute_context, *elem.id);
548 return &compute_context_cache.
for_group_node(parent_compute_context, elem.node_id);
553 elem.sim_output_node_id);
558 parent_compute_context, elem.repeat_output_node_id, elem.iteration);
564 parent_compute_context, elem.zone_output_node_id, elem.index);
568 std::optional<nodes::ClosureSourceLocation> source_location;
569 if (elem.source_node_tree) {
571 elem.source_node_tree,
572 elem.source_output_node_id,
576 parent_compute_context, elem.evaluate_node_id,
nullptr, source_location);
#define BLI_SCOPED_DEFER(function_to_defer)
#define BLI_assert_unreachable()
#define SET_FLAG_FROM_TEST(value, test, flag)
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 GeometryNodesModifierComputeContext & for_geometry_nodes_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 DataBlockComputeContext & for_data_block(const ComputeContext *parent, const uint32_t orig_session_uid, const ID *id=nullptr)
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_node(const SpaceNode &snode, bke::ComputeContextCache &compute_context_cache, const bNode &node)
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)
void WM_main_add_notifier(uint type, void *reference)
BLI_assert(slot->slot_subtype.map==BMO_OP_SLOT_SUBTYPE_MAP_FLT)
GroupNodeViewerPathElem * BKE_viewer_path_elem_new_group_node()
ViewerNodeViewerPathElem * BKE_viewer_path_elem_new_viewer_node()
void BKE_viewer_path_init(ViewerPath *viewer_path)
void BLI_addhead(ListBase *listbase, void *vlink) ATTR_NONNULL(1)
@ SPREADSHEET_OBJECT_EVAL_STATE_VIEWER_NODE
SimulationZoneViewerPathElem * BKE_viewer_path_elem_new_simulation_zone()
IDViewerPathElem * BKE_viewer_path_elem_new_id()
ModifierViewerPathElem * BKE_viewer_path_elem_new_modifier()
@ SPREADSHEET_FLAG_PINNED
bScreen * BKE_workspace_active_screen_get(const WorkSpaceInstanceHook *hook) GETTER_ATTRS
const char * BKE_id_name(const ID &id)
WorkSpace * BKE_workspace_active_get(WorkSpaceInstanceHook *hook) GETTER_ATTRS
bool DEG_is_original(const T *id)
ForeachGeometryElementZoneViewerPathElem * BKE_viewer_path_elem_new_foreach_geometry_element_zone()
void DEG_id_tag_update(ID *id, unsigned int flags)
@ VIEWER_PATH_EQUAL_FLAG_IGNORE_ITERATION
@ VIEWER_PATH_EQUAL_FLAG_CONSIDER_UI_NAME
void BKE_viewer_path_copy(ViewerPath *dst, const ViewerPath *src)
@ VIEWER_PATH_ELEM_TYPE_REPEAT_ZONE
@ VIEWER_PATH_ELEM_TYPE_SIMULATION_ZONE
@ VIEWER_PATH_ELEM_TYPE_MODIFIER
@ VIEWER_PATH_ELEM_TYPE_GROUP_NODE
@ VIEWER_PATH_ELEM_TYPE_VIEWER_NODE
@ VIEWER_PATH_ELEM_TYPE_EVALUATE_CLOSURE
@ VIEWER_PATH_ELEM_TYPE_FOREACH_GEOMETRY_ELEMENT_ZONE
@ VIEWER_PATH_ELEM_TYPE_ID
@ SPREADSHEET_CLOSURE_NONE
bool BKE_viewer_path_equal(const ViewerPath *a, const ViewerPath *b, ViewerPathEqualFlag flag=ViewerPathEqualFlag(0))
RepeatZoneViewerPathElem * BKE_viewer_path_elem_new_repeat_zone()
void BLI_addtail(ListBase *listbase, void *vlink) ATTR_NONNULL(1)
Main * CTX_data_main(const bContext *C)
char * BLI_strdup(const char *str) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL(1) ATTR_MALLOC
ID_Type GS(const char *name)
void BKE_viewer_path_clear(ViewerPath *viewer_path)
EvaluateClosureNodeViewerPathElem * BKE_viewer_path_elem_new_evaluate_closure()
int32_t source_output_node_id
struct bNodeTree * source_node_tree
ListBaseT< wmWindowManager > wm
ListBaseT< ModifierData > modifiers
int repeat_output_node_id
ListBaseT< SpaceLink > spacedata
int32_t sim_output_node_id
struct bNodeTree * edittree
SpreadsheetTableIDGeometry geometry_id
SpreadsheetClosureInputOutput closure_input_output
SpreadsheetBundlePathElem * bundle_path
SpreadsheetBundleTreeViewPath viewer_item_bundle_path
int viewer_item_identifier
uint8_t object_eval_state
ListBaseT< ViewerPathElem > path
ListBaseT< struct ScrArea > areabase
Vector< const ViewerPathElem * > node_path
struct WorkSpaceInstanceHook * workspace_hook