Skip to content

Commit

Permalink
Fixed issue with reloading old anim8 figures, solves #49
Browse files Browse the repository at this point in the history
  • Loading branch information
Kevin-Mattheus-Moerman committed May 30, 2019
1 parent 3c78574 commit b351ecc
Show file tree
Hide file tree
Showing 12 changed files with 29 additions and 6 deletions.
14 changes: 11 additions & 3 deletions docs/html/HELP_anim8.html
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
<!--
This HTML was auto-generated from MATLAB code.
To make changes, update the MATLAB code and republish this document.
--><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">
--><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">
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}

html { min-height:100%; margin-bottom:1px; }
Expand Down Expand Up @@ -66,7 +66,7 @@



</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;
</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;
</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>
</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;
surf(X,Y,Z);
Expand Down Expand Up @@ -210,7 +210,10 @@
animStruct.Set{q}={cNow,Vp,alphaNow}; <span class="comment">%Property values for to set in order to animate</span>
<span class="keyword">end</span>
</pre><p>Start <tt>anim8</tt> gui</p><pre class="codeinput">anim8(hf,animStruct);
</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><!--
</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>);
loadName=fullfile(loadPath,<span class="string">'exampleSavedAnim8Figure.fig'</span>);
anim8(loadName);
</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><!--
##### SOURCE BEGIN #####
%% anim8
% Below is a demonstration of the features of the |anim8| function
Expand Down Expand Up @@ -472,6 +475,11 @@
% Start |anim8| gui
anim8(hf,animStruct);
%% Loading a saved anim8 figure;
loadPath=fullfile(fileparts(fileparts(mfilename('fullpath'))),'data','fig');
loadName=fullfile(loadPath,'exampleSavedAnim8Figure.fig');
anim8(loadName);
%%
%
% <<gibbVerySmall.gif>>
Expand Down
Binary file modified docs/html/HELP_anim8.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified docs/html/HELP_anim8_01.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified docs/html/HELP_anim8_02.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified docs/html/HELP_anim8_03.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified docs/html/HELP_anim8_04.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified docs/html/HELP_anim8_05.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified docs/html/HELP_anim8_06.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified docs/html/HELP_anim8_07.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified docs/html/HELP_anim8_08.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/html/HELP_anim8_09.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
21 changes: 18 additions & 3 deletions lib/anim8.m
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,11 @@
%Add export figure widget
efw(hf);

animStruct=hf.UserData.anim8.animStruct; %Get anim8 structure
if ~isfield(hf.UserData,'anim8')
error('Loaded figure lacks an anim8 structure as UserData');
else
animStruct=hf.UserData.anim8.animStruct; %Get anim8 structure
end
case 2 %Create new
hf=varargin{1}; %Figure handle
animStruct=varargin{2}; %The anim8 structure
Expand Down Expand Up @@ -91,13 +95,24 @@

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%Toolbar

toolbarTag='anim8_toolbar';

%Remove existing anim8 toolbar
hb = findall(hf,'Tag',toolbarTag); % hb = findall(hf,'Type','uitoolbar');
if ~isempty(hb)
if ~isempty(hb)
delete(hb)
else
%Find all toolbars
hb = findall(hf,'Type','uitoolbar');

%Remove them if they are not the default bar
if ~isempty(hb)
for q=1:1:numel(hb)
if ~strcmp(hb(q).Tag,'FigureToolBar')
delete(hb(q));
end
end
end
end

%Create new anim8 toolbar
Expand Down

0 comments on commit b351ecc

Please sign in to comment.