I desire that slides in beamer presentations have own framesubtiles. For this @samcarter_is_at_topanswers.xyz help me with this answer. It fulfil my basic request, but now I discover, that at figures in my presentation (which are numbered on request of audience) which are in "slides \only<+>{\framesubtitle{...} <slide content>} doesn't increment caption numbers and referencing this figures anywhere in presentation doesn't work.
MWE, which demonstrate my problem, is:
\documentclass{beamer}
\setbeamertemplate{caption}[numbered]
\makeatletter
\newcommand*{\slideinframe}{\number\beamer@slideinframe}
\newcounter{bar}
\newcommand{\foo}{%
\setcounter{bar}{\insertframeendpage}%
\addtocounter{bar}{-\insertframestartpage}%
\addtocounter{bar}{1}%
(\slideinframe/\thebar)%
}
\makeatother
\usepackage{lipsum}
\begin{document}
\begin{frame}
\frametitle{Foo \foo}
\only<+>{
\framesubtitle{Bar}
\lipsum[1][1-3], see figure \ref{fig:ena}
\begin{figure}%\centering
\includegraphics[width=0.5\linewidth]{example-image-a}
\caption{Figure ena}
\label{fig:ena}
\end{figure}
}
\only<+>{
\framesubtitle{Baz}
\lipsum[1][4-7], see figure \ref{fig:dva}
\begin{figure}%\centering
\includegraphics[width=0.5\linewidth]{example-image-b}
\caption{Figure dva}
\label{fig:dva}
\end{figure}
}
\end{frame}
\end{document}
Result after three times of compilation is:

