Gizmo Tutorial

From GMLwiki

Jump to: navigation, search
% simple gizmo test
%
% *****************************************************
%  DEPENDENCIES:
%    GIZMOS.xgml
% *****************************************************


usereg

deleteallmacros
newmacro clear
pnm-clear
bns-clear
usereg ioremoveall


[] !sliders




dict !tmpDict
:tmpDict begin
  /nHeight 1 def

  /compute { 0 nHeight 3 vector3 } def
  /model
      {
        [ (0,0,0) (5,0,0) (5,5,0) (0,5,0) ]
        3  poly2doubleface
        exch extrude pop
      } def
  /model-update {
    /mak clearmacro
    compute model
  } def
  /direction (0,0,1) def


  Model begin
    /theModel :tmpDict def
  end

  /mak  newmacro def

  compute model 
end





%%******************************************************
%% create a gizmo for the extrude
dict !gs-slider-linear
:gs-slider-linear begin
   /arrowSize 1.0 def
   /styleA 
      {
         0.2  /std8hi bns-style-ball
         0.1 /std8hi bns-style-stick
         0.2  0.4  /std8hi bns-style-arrow
      } def
   /styleB 
      {
         0.2  /std4hi bns-style-ball
         0.1  /std4hi bns-style-stick
         0.2  0.4 /std4hi bns-style-arrow
      } def
end


:tmpDict
:sliders
:gs-slider-linear 
{
  (2.5,2.5,0)  nHeight putZ
  (2.5,2.5,0)  nHeight putZ
  direction

%  /text
%  slider-point slider-point
%  (1,2,11) 1 pnm-string def

}
{
   /nHeight
   slider-point 
   getZ
%   Model.theModel begin
    def
%   end
   model-update
}
{
} GIZMOS.slider-linear-infinite



%%
%% create and activate the gizmos
%%
:sliders
{ begin gizmo-create gizmo-activate end }
forall
Personal tools