Cleanup: remove unnecessary calls to as_span
This uses the new implicit conversions and constructors that have been committed in the previous commit. I tested these changes on Linux with gcc and on Windows.
This commit is contained in:
@@ -313,12 +313,12 @@ inline const InputSocketRef &DInputSocket::socket_ref() const
|
||||
|
||||
inline Span<const DOutputSocket *> DInputSocket::linked_sockets() const
|
||||
{
|
||||
return linked_sockets_.as_span();
|
||||
return linked_sockets_;
|
||||
}
|
||||
|
||||
inline Span<const DGroupInput *> DInputSocket::linked_group_inputs() const
|
||||
{
|
||||
return linked_group_inputs_.as_span();
|
||||
return linked_group_inputs_;
|
||||
}
|
||||
|
||||
inline bool DInputSocket::is_linked() const
|
||||
@@ -337,7 +337,7 @@ inline const OutputSocketRef &DOutputSocket::socket_ref() const
|
||||
|
||||
inline Span<const DInputSocket *> DOutputSocket::linked_sockets() const
|
||||
{
|
||||
return linked_sockets_.as_span();
|
||||
return linked_sockets_;
|
||||
}
|
||||
|
||||
/* --------------------------------------------------------------------
|
||||
@@ -361,7 +361,7 @@ inline const DParentNode *DGroupInput::parent() const
|
||||
|
||||
inline Span<const DInputSocket *> DGroupInput::linked_sockets() const
|
||||
{
|
||||
return linked_sockets_.as_span();
|
||||
return linked_sockets_;
|
||||
}
|
||||
|
||||
inline uint DGroupInput::id() const
|
||||
@@ -453,7 +453,7 @@ inline uint DParentNode::id() const
|
||||
|
||||
inline Span<const DNode *> DerivedNodeTree::nodes() const
|
||||
{
|
||||
return nodes_by_id_.as_span();
|
||||
return nodes_by_id_;
|
||||
}
|
||||
|
||||
inline Span<const DNode *> DerivedNodeTree::nodes_by_type(StringRefNull idname) const
|
||||
@@ -469,28 +469,28 @@ inline Span<const DNode *> DerivedNodeTree::nodes_by_type(const bNodeType *nodet
|
||||
return {};
|
||||
}
|
||||
else {
|
||||
return nodes->as_span();
|
||||
return *nodes;
|
||||
}
|
||||
}
|
||||
|
||||
inline Span<const DSocket *> DerivedNodeTree::sockets() const
|
||||
{
|
||||
return sockets_by_id_.as_span();
|
||||
return sockets_by_id_;
|
||||
}
|
||||
|
||||
inline Span<const DInputSocket *> DerivedNodeTree::input_sockets() const
|
||||
{
|
||||
return input_sockets_.as_span();
|
||||
return input_sockets_;
|
||||
}
|
||||
|
||||
inline Span<const DOutputSocket *> DerivedNodeTree::output_sockets() const
|
||||
{
|
||||
return output_sockets_.as_span();
|
||||
return output_sockets_;
|
||||
}
|
||||
|
||||
inline Span<const DGroupInput *> DerivedNodeTree::group_inputs() const
|
||||
{
|
||||
return group_inputs_.as_span();
|
||||
return group_inputs_;
|
||||
}
|
||||
|
||||
} // namespace blender::bke
|
||||
|
||||
@@ -197,12 +197,12 @@ class NodeTreeRef : NonCopyable, NonMovable {
|
||||
|
||||
inline Span<const SocketRef *> SocketRef::linked_sockets() const
|
||||
{
|
||||
return linked_sockets_.as_span();
|
||||
return linked_sockets_;
|
||||
}
|
||||
|
||||
inline Span<const SocketRef *> SocketRef::directly_linked_sockets() const
|
||||
{
|
||||
return directly_linked_sockets_.as_span();
|
||||
return directly_linked_sockets_;
|
||||
}
|
||||
|
||||
inline bool SocketRef::is_linked() const
|
||||
@@ -326,12 +326,12 @@ inline const NodeTreeRef &NodeRef::tree() const
|
||||
|
||||
inline Span<const InputSocketRef *> NodeRef::inputs() const
|
||||
{
|
||||
return inputs_.as_span();
|
||||
return inputs_;
|
||||
}
|
||||
|
||||
inline Span<const OutputSocketRef *> NodeRef::outputs() const
|
||||
{
|
||||
return outputs_.as_span();
|
||||
return outputs_;
|
||||
}
|
||||
|
||||
inline const InputSocketRef &NodeRef::input(uint index) const
|
||||
@@ -400,7 +400,7 @@ inline bool NodeRef::is_group_output_node() const
|
||||
|
||||
inline Span<const NodeRef *> NodeTreeRef::nodes() const
|
||||
{
|
||||
return nodes_by_id_.as_span();
|
||||
return nodes_by_id_;
|
||||
}
|
||||
|
||||
inline Span<const NodeRef *> NodeTreeRef::nodes_by_type(StringRefNull idname) const
|
||||
@@ -416,23 +416,23 @@ inline Span<const NodeRef *> NodeTreeRef::nodes_by_type(const bNodeType *nodetyp
|
||||
return {};
|
||||
}
|
||||
else {
|
||||
return nodes->as_span();
|
||||
return *nodes;
|
||||
}
|
||||
}
|
||||
|
||||
inline Span<const SocketRef *> NodeTreeRef::sockets() const
|
||||
{
|
||||
return sockets_by_id_.as_span();
|
||||
return sockets_by_id_;
|
||||
}
|
||||
|
||||
inline Span<const InputSocketRef *> NodeTreeRef::input_sockets() const
|
||||
{
|
||||
return input_sockets_.as_span();
|
||||
return input_sockets_;
|
||||
}
|
||||
|
||||
inline Span<const OutputSocketRef *> NodeTreeRef::output_sockets() const
|
||||
{
|
||||
return output_sockets_.as_span();
|
||||
return output_sockets_;
|
||||
}
|
||||
|
||||
inline bNodeTree *NodeTreeRef::btree() const
|
||||
|
||||
@@ -52,8 +52,8 @@ NodeTreeRef::NodeTreeRef(bNodeTree *btree) : btree_(btree)
|
||||
RNA_pointer_create(&btree->id, &RNA_NodeSocket, bsocket, &socket.rna_);
|
||||
}
|
||||
|
||||
input_sockets_.extend(node.inputs_);
|
||||
output_sockets_.extend(node.outputs_);
|
||||
input_sockets_.extend(node.inputs_.as_span());
|
||||
output_sockets_.extend(node.outputs_.as_span());
|
||||
|
||||
node_mapping.add_new(bnode, &node);
|
||||
}
|
||||
|
||||
@@ -78,7 +78,7 @@ class GVectorArray : NonCopyable, NonMovable {
|
||||
|
||||
operator GVArraySpan() const
|
||||
{
|
||||
return GVArraySpan(type_, starts_.as_span(), lengths_);
|
||||
return GVArraySpan(type_, starts_, lengths_);
|
||||
}
|
||||
|
||||
bool is_empty() const
|
||||
@@ -98,7 +98,7 @@ class GVectorArray : NonCopyable, NonMovable {
|
||||
|
||||
Span<const void *> starts() const
|
||||
{
|
||||
return starts_.as_span();
|
||||
return starts_;
|
||||
}
|
||||
|
||||
Span<uint> lengths() const
|
||||
|
||||
@@ -481,7 +481,7 @@ inline Span<MFInputSocket *> MFOutputSocket::targets()
|
||||
|
||||
inline Span<const MFInputSocket *> MFOutputSocket::targets() const
|
||||
{
|
||||
return targets_.as_span();
|
||||
return targets_;
|
||||
}
|
||||
|
||||
/* --------------------------------------------------------------------
|
||||
|
||||
@@ -287,14 +287,14 @@ void constant_folding(MFNetwork &network, ResourceCollector &resources)
|
||||
}
|
||||
|
||||
Array<MFOutputSocket *> folded_sockets = compute_constant_sockets_and_add_folded_nodes(
|
||||
network, inputs_to_fold.as_span(), resources);
|
||||
network, inputs_to_fold, resources);
|
||||
|
||||
for (uint i : inputs_to_fold.index_range()) {
|
||||
MFOutputSocket &original_socket = *inputs_to_fold[i]->origin();
|
||||
network.relink(original_socket, *folded_sockets[i]);
|
||||
}
|
||||
|
||||
network.remove(temporary_nodes.as_span());
|
||||
network.remove(temporary_nodes);
|
||||
}
|
||||
|
||||
/** \} */
|
||||
|
||||
Reference in New Issue
Block a user