Skip to content

Commit b351ecc

Browse files
Fixed issue with reloading old anim8 figures, solves #49
1 parent 3c78574 commit b351ecc

12 files changed

+29
-6
lines changed

docs/html/HELP_anim8.html

+11-3
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
<!--
77
This HTML was auto-generated from MATLAB code.
88
To make changes, update the MATLAB code and republish this document.
9-
--><title>anim8</title><meta name="generator" content="MATLAB 9.6"><link rel="schema.DC" href="http://purl.org/dc/elements/1.1/"><meta name="DC.date" content="2019-05-20"><meta name="DC.source" content="HELP_anim8.m"><style type="text/css">
9+
--><title>anim8</title><meta name="generator" content="MATLAB 9.6"><link rel="schema.DC" href="http://purl.org/dc/elements/1.1/"><meta name="DC.date" content="2019-05-30"><meta name="DC.source" content="HELP_anim8.m"><style type="text/css">
1010
html,body,div,span,applet,object,iframe,h1,h2,h3,h4,h5,h6,p,blockquote,pre,a,abbr,acronym,address,big,cite,code,del,dfn,em,font,img,ins,kbd,q,s,samp,small,strike,strong,sub,sup,tt,var,b,u,i,center,dl,dt,dd,ol,ul,li,fieldset,form,label,legend,table,caption,tbody,tfoot,thead,tr,th,td{margin:0;padding:0;border:0;outline:0;font-size:100%;vertical-align:baseline;background:transparent}body{line-height:1}ol,ul{list-style:none}blockquote,q{quotes:none}blockquote:before,blockquote:after,q:before,q:after{content:'';content:none}:focus{outine:0}ins{text-decoration:none}del{text-decoration:line-through}table{border-collapse:collapse;border-spacing:0}
1111

1212
html { min-height:100%; margin-bottom:1px; }
@@ -66,7 +66,7 @@
6666

6767

6868

69-
</style></head><body><div class="content"><h1>anim8</h1><!--introduction--><p>Below is a demonstration of the features of the <tt>anim8</tt> function</p><!--/introduction--><h2>Contents</h2><div><ul><li><a href="#2">Syntax</a></li><li><a href="#3">Description</a></li><li><a href="#4">Examples</a></li><li><a href="#5">Example 1a: Animating by adjusting a single graphics property, a surface rotation</a></li><li><a href="#11">Example 1b: Animating by adjusting a single graphics property, surface vectors</a></li><li><a href="#17">Example 2a: Animating multiple graphics features, points and curves</a></li><li><a href="#23">Example 2b: Animating multiple graphics features, color changing, bouncing, rotating surface</a></li></ul></div><pre class="codeinput">clear; close <span class="string">all</span>; clc;
69+
</style></head><body><div class="content"><h1>anim8</h1><!--introduction--><p>Below is a demonstration of the features of the <tt>anim8</tt> function</p><!--/introduction--><h2>Contents</h2><div><ul><li><a href="#2">Syntax</a></li><li><a href="#3">Description</a></li><li><a href="#4">Examples</a></li><li><a href="#5">Example 1a: Animating by adjusting a single graphics property, a surface rotation</a></li><li><a href="#11">Example 1b: Animating by adjusting a single graphics property, surface vectors</a></li><li><a href="#17">Example 2a: Animating multiple graphics features, points and curves</a></li><li><a href="#23">Example 2b: Animating multiple graphics features, color changing, bouncing, rotating surface</a></li><li><a href="#27">Loading a saved anim8 figure;</a></li></ul></div><pre class="codeinput">clear; close <span class="string">all</span>; clc;
7070
</pre><h2 id="2">Syntax</h2><p><tt>hf=anim8(varargin);</tt></p><h2 id="3">Description</h2><p>The <tt>anim8</tt> function can be used to interactively animate graphics components. Anything about a figure and its content with a handle whose properties can be accessed/altered using MATLAB can be animated. This includes properties of graphics objects and view settings. To use <tt>anim8</tt> create a figure window with features to animate (e.g. plots, surfaces, views, etc.). Next create a structure containing the object handles, object properties to alter, and the property values. The anim8 function takes in 0, 1, or 2 inputs. No input: Anim8 will assume you want to browse to a previously saved anim8 figure and reload it. 1 input: Anim8 will assume the input is a path to a previously saved anim8 figure to be reloaded. 2 inputs: Anim8 will assume the first input is the figure handle, and the second input the anim8 structure.</p><h2 id="4">Examples</h2><h2 id="5">Example 1a: Animating by adjusting a single graphics property, a surface rotation</h2><p>Creating example data, in this case a surface which will be rotated in the animation by adjusting the angular value of a view property of the axis.</p><pre class="codeinput">[X,Y,Z]=peaks(25); <span class="comment">%Some graphics data</span>
7171
</pre><p>Initiate a visualization in a figure window while storing an object handle, in this case an axis handle to manipulate a view.</p><pre class="codeinput">hf=cFigure;
7272
surf(X,Y,Z);
@@ -210,7 +210,10 @@
210210
animStruct.Set{q}={cNow,Vp,alphaNow}; <span class="comment">%Property values for to set in order to animate</span>
211211
<span class="keyword">end</span>
212212
</pre><p>Start <tt>anim8</tt> gui</p><pre class="codeinput">anim8(hf,animStruct);
213-
</pre><img vspace="5" hspace="5" src="HELP_anim8_08.png" alt=""> <p><img vspace="5" hspace="5" src="gibbVerySmall.gif" alt=""> </p><p><i><b>GIBBON</b></i> <a href="www.gibboncode.org">www.gibboncode.org</a></p><p><i>Kevin Mattheus Moerman</i>, <a href="[email protected]">[email protected]</a></p><p><i><b>GIBBON footer text</b></i></p><p>License: <a href="https://github.com/gibbonCode/GIBBON/blob/master/LICENSE">https://github.com/gibbonCode/GIBBON/blob/master/LICENSE</a></p><p>GIBBON: The Geometry and Image-based Bioengineering add-On. A toolbox for image segmentation, image-based modeling, meshing, and finite element analysis.</p><p>Copyright (C) 2019 Kevin Mattheus Moerman</p><p>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 3 of the License, or (at your option) any later version.</p><p>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.</p><p>You should have received a copy of the GNU General Public License along with this program. If not, see <a href="http://www.gnu.org/licenses/">http://www.gnu.org/licenses/</a>.</p><p class="footer"><br><a href="https://www.mathworks.com/products/matlab/">Published with MATLAB&reg; R2019a</a><br></p></div><!--
213+
</pre><img vspace="5" hspace="5" src="HELP_anim8_08.png" alt=""> <h2 id="27">Loading a saved anim8 figure;</h2><pre class="codeinput">loadPath=fullfile(fileparts(fileparts(mfilename(<span class="string">'fullpath'</span>))),<span class="string">'data'</span>,<span class="string">'fig'</span>);
214+
loadName=fullfile(loadPath,<span class="string">'exampleSavedAnim8Figure.fig'</span>);
215+
anim8(loadName);
216+
</pre><img vspace="5" hspace="5" src="HELP_anim8_09.png" alt=""> <p><img vspace="5" hspace="5" src="gibbVerySmall.gif" alt=""> </p><p><i><b>GIBBON</b></i> <a href="www.gibboncode.org">www.gibboncode.org</a></p><p><i>Kevin Mattheus Moerman</i>, <a href="[email protected]">[email protected]</a></p><p><i><b>GIBBON footer text</b></i></p><p>License: <a href="https://github.com/gibbonCode/GIBBON/blob/master/LICENSE">https://github.com/gibbonCode/GIBBON/blob/master/LICENSE</a></p><p>GIBBON: The Geometry and Image-based Bioengineering add-On. A toolbox for image segmentation, image-based modeling, meshing, and finite element analysis.</p><p>Copyright (C) 2019 Kevin Mattheus Moerman</p><p>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 3 of the License, or (at your option) any later version.</p><p>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.</p><p>You should have received a copy of the GNU General Public License along with this program. If not, see <a href="http://www.gnu.org/licenses/">http://www.gnu.org/licenses/</a>.</p><p class="footer"><br><a href="https://www.mathworks.com/products/matlab/">Published with MATLAB&reg; R2019a</a><br></p></div><!--
214217
##### SOURCE BEGIN #####
215218
%% anim8
216219
% Below is a demonstration of the features of the |anim8| function
@@ -472,6 +475,11 @@
472475
% Start |anim8| gui
473476
anim8(hf,animStruct);
474477
478+
%% Loading a saved anim8 figure;
479+
loadPath=fullfile(fileparts(fileparts(mfilename('fullpath'))),'data','fig');
480+
loadName=fullfile(loadPath,'exampleSavedAnim8Figure.fig');
481+
anim8(loadName);
482+
475483
%%
476484
%
477485
% <<gibbVerySmall.gif>>

docs/html/HELP_anim8.png

0 Bytes
Loading

docs/html/HELP_anim8_01.png

0 Bytes
Loading

docs/html/HELP_anim8_02.png

0 Bytes
Loading

docs/html/HELP_anim8_03.png

-1.37 KB
Loading

docs/html/HELP_anim8_04.png

45 Bytes
Loading

docs/html/HELP_anim8_05.png

0 Bytes
Loading

docs/html/HELP_anim8_06.png

0 Bytes
Loading

docs/html/HELP_anim8_07.png

0 Bytes
Loading

docs/html/HELP_anim8_08.png

0 Bytes
Loading

docs/html/HELP_anim8_09.png

278 KB
Loading

lib/anim8.m

+18-3
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,11 @@
2727
%Add export figure widget
2828
efw(hf);
2929

30-
animStruct=hf.UserData.anim8.animStruct; %Get anim8 structure
30+
if ~isfield(hf.UserData,'anim8')
31+
error('Loaded figure lacks an anim8 structure as UserData');
32+
else
33+
animStruct=hf.UserData.anim8.animStruct; %Get anim8 structure
34+
end
3135
case 2 %Create new
3236
hf=varargin{1}; %Figure handle
3337
animStruct=varargin{2}; %The anim8 structure
@@ -91,13 +95,24 @@
9195

9296
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9397
%Toolbar
94-
9598
toolbarTag='anim8_toolbar';
9699

97100
%Remove existing anim8 toolbar
98101
hb = findall(hf,'Tag',toolbarTag); % hb = findall(hf,'Type','uitoolbar');
99-
if ~isempty(hb)
102+
if ~isempty(hb)
100103
delete(hb)
104+
else
105+
%Find all toolbars
106+
hb = findall(hf,'Type','uitoolbar');
107+
108+
%Remove them if they are not the default bar
109+
if ~isempty(hb)
110+
for q=1:1:numel(hb)
111+
if ~strcmp(hb(q).Tag,'FigureToolBar')
112+
delete(hb(q));
113+
end
114+
end
115+
end
101116
end
102117

103118
%Create new anim8 toolbar

0 commit comments

Comments
 (0)