Menu

GizmoEx Rotation Values

Help
2016-02-28
2016-11-22
  • Rick Newman

    Rick Newman - 2016-02-28

    Hi, i'm trying to rotate an object with GizmoEx and it's working perfectly but the values are kind of a mess.

    Let me explain this, when I roll an object with Gizmo, not only the RollAngle change, it also change TurnAngle and PitchAngle.

    is there any way to, using gizmo, change the rotation values more exactly (no variation in others values) ?

    Thanks in Advance.

    Regards.

    Rick Newman.

     

    Last edit: Rick Newman 2016-02-29
  • Jerome.D (BeanzMaster)

    Hi,

    it also change TurnAngle and PitchAngle.
    If you want to constraint rotation you must take care of not selecting the grey Hilighting sphere in the middle, be carefull to select only Red, green, Yellow highlighting "torus" You can also try to change Rotation increment in properties like "0.01" for having more precision

     
    • Rick Newman

      Rick Newman - 2016-03-01

      Jerome, thanks a lot for your quick response.

      I'm using those "Torus" to Turn/Pitch/Roll, but, for example, when I Pitch a little bit , the Roll Value goes to -180 instead of standing ZERO.

      Also if I Turn, All the Values changes (Roll -180, Turn-226, Pitch -180).

      If I change the values applying ResetPitchTurnRoll works really well, but with gizmo the values go crazy.

       
  • Jerome.D (BeanzMaster)

    Rick what the GLScene version you're using ?
    It is the same problem in the GLGizmoEx demo ?

     
    • Rick Newman

      Rick Newman - 2016-03-02

      Hi Jerome, I'm using 1.2.1.6404 version.
      In the GizmoEx demo happens the same. The values change in the same way.

      ¿It's the new version (GLScene_v1.4_December_2015_VCL) retrocompatible?

      Thanks a lot for your help.

      Rick.

       
  • Jerome.D (BeanzMaster)

    Ok rick i'll take look. But before have you make a new install or just update pas files ? What Delphi version you're using ?
    Try to clear all DCU and recompile. If it is work try to update GLScene from CVS. Delete all dcu and other temporary file and reinstall.

     
    • Rick Newman

      Rick Newman - 2016-03-02

      I'm in really heavy development sprint right now, and I can not take the risk changing the GLScene version. That's why I asked for the retro-compatibility.

      I really appreciate your help Jerome.

      Regards.

       
  • Jerome.D (BeanzMaster)

    Don't be afraid, just make a backup before. I recommend you update GLScene, many little bug have been corrected since your version. And the functions and organization are not changed :)

    Ok, So can you tell us more about your project ?

    For the GLScene Editor Project i'v rewright a little the Gizmo (is unfinished i don't have many time to code now, but work well) so try the units attached here.

    and use it like this :

    interface
    
    uses UGLsceneEditingTools;
    
    type
      TMainForm = class(TForm)
    
    private
        { Déclarations privées }
        SceneHelper: TGLSceneEditingHelper;
     end;
    
    implementation
    
    procedure TMainForm.DoStartCreateObject(Sender: TObject; CreateObjectType: TCreationObjectType);
    begin
      UpdateTreeView;
    end;
    
    procedure TMainForm.DoStepCreateObject(Sender: TObject; CreationType: TCreationObjectType; Obj: TGLBaseSceneObject;
      Step: Integer; Length: TVector);
    begin
      UpdateTreeView;
    end;
    
    procedure TMainForm.DoEndCreateObject(Sender: TObject);
    begin
      UpdateTreeView;
    end;
    
    procedure TMainForm.FormShow(Sender: TObject);
    begin
      SceneHelper              := TGLSceneEditingHelper.Create(self);
      SceneHelper.Viewer       := SceneViewer;
      SceneHelper.Scene        := GLScene1;
      SceneHelper.Cadencer     := GLCadencer1;
    
    //  SceneHelper.ExcludeObjects := true;
    //  SceneHelper.ExcludeObjectsList.Add('DCNaviCube');
    
      SceneHelper.OperationMode := omNone;
    
      SceneHelper.OnStartCreateObject := DoStartCreateObject;
      SceneHelper.OnStepCreateObject  := DoStepCreateObject;
      SceneHelper.OnEndCreateObject   := DoEndCreateObject;
    
    
      GLCadencer1.Enabled := True;
    end;
    
    procedure TMainForm.GLCadencer1Progress(Sender: TObject; const deltaTime, newTime: Double);
    begin
      SceneViewer.Invalidate();
    end;
    
    procedure TMainForm.btnGizmoOpMoveClick(Sender: TObject);
    begin
      SceneHelper.OperationMode := omTranslate;
    end;
    
    procedure TMainForm.btnGizmoOpRotateClick(Sender: TObject);
    begin
      SceneHelper.OperationMode := omRotate;
    end;
    
    procedure TMainForm.btnGizmoOpScaleClick(Sender: TObject);
    begin
      SceneHelper.OperationMode := omScale;
    end;
    
    procedure TMainForm.btnGizmoOpSelectClick(Sender: TObject);
    begin
      SceneHelper.OperationMode := omSelect;
    end;
    
    procedure TMainForm.cbxChooseCameraChange(Sender: TObject);
    begin
      case cbxChooseCamera.ItemIndex of
        0:
          begin
            SceneHelper.CameraMode:= cmTop;
          end;
        1:
          begin
            SceneHelper.CameraMode:= cmFront;
          end;
        2:
          begin
            SceneHelper.CameraMode:= cmLeft;
          end;
        3:
          begin
            SceneHelper.CameraMode:= cmBottom;
          end;
        4:
          begin
            SceneHelper.CameraMode:= cmBack;
          end;
        5:
          begin
            SceneHelper.CameraMode:= cmRight;
          end;
        6:
          begin
            SceneHelper.CameraMode:= cmFree;
          end;
      end;
    end;
    
    procedure TMainForm.btnCreate_CubeClick(Sender: TObject);
    // Var
    // ff: TGLFreeForm;
    // mo:TGLCustomEditingMeshObject;
    begin
    
      if chkAsMesh.Checked then
      begin
        SceneHelper.CreateObjectType := coCube;
      end else begin
        SceneHelper.CreateObjectType := coGLCube;
      end;
      SceneHelper.OperationMode := omCreate;
    
      // mo:=TGLCustomEditingMeshObject.Create;
      // mo.MakeCube(1,1,1);
      // mo.SetMaterial('LibMaterial');
      // ff:=TGLFreeForm.CreateAsChild(World);
      // ff.MaterialLibrary := GLMaterialLibrary1;
      // ff.Material.LibMaterialName := 'LibMaterial';
      // ff.MeshObjects.Add(mo);
      // ff.StructureChanged;
    end;
    
    procedure TMainForm.SceneViewerKeyDown(Sender: TObject; var Key: Word; Shift: TShiftState);
    begin
       sceneHelper.CanAddObjToSelectionList:=(key=VK_Control);
       sceneHelper.CanRemoveObjFromSelectionList:=(Key=VK_MENU);
    end;
    
    procedure TMainForm.SceneViewerKeyUp(Sender: TObject; var Key: Word; Shift: TShiftState);
    begin
       sceneHelper.CanAddObjToSelectionList:=false;
       sceneHelper.CanRemoveObjFromSelectionList:=false;
    end;
    

    Notice : All Cameras, grids and others objects, are automatically created by the helper. And Set you cadencer enabled property to false

     

    Last edit: Jerome.D (BeanzMaster) 2016-03-03
    • Rick Newman

      Rick Newman - 2016-03-03

      Jerome I can't be more gratefull right now. I will try it and I let you know.

      Thanks again!

      Regards!

       

      Last edit: Rick Newman 2016-03-03
  • RBob

    RBob - 2016-06-08

    Hi Jerome,
    I have a bit tested your SceneHelper and it's very good!
    but I see some aspects imlpemented in GLGizmoEx are not yet usable in SceneHelper (support for history or zoomfactor for example);
    maybe, have you update your uglsceneeditingtools.pas than the previous attached one?

    thanks, in advance

     
  • Jerome.D (BeanzMaster)

    Hi RBob, i m very very busy since few month so no made update. But see in code for History you have :

        property EnableActionHistory: Boolean read FEnableHistory write FEnableHistory default True;
        property HistoryStepsCount: Integer read FHistoryStepsCount write SetHistoryStepsCount;
        * This must be set with a value greater than 0 (10/15 is good value i think)
        and
    
        procedure UndoAdd(const AObject: TObject);
        function Undo: TGLActionHistoryItem;
        function Redo: TGLActionHistoryItem;    
    

    -
    the property zoomfactor is deleted the gizmo now have always the same size on screen

     

    Last edit: Jerome.D (BeanzMaster) 2016-06-21
  • RBob

    RBob - 2016-06-21

    Hi Jerome,
    ok, thank you for the suggestion; now I'm busy too, so I will test it in the future..
    thanks,

    Bob

     
  • Sakis Goumenidis

    Hello
    Is it possible to have an example project using the uglsceneeditingtools.pas

    Thank you

     
  • Mark Stephen Day

    Hi all,

    I am creating a GLSene raytracing application and hoping that uglsceneeditingtools will be of benefit to my application.
    .
    Just looking at the cbxCameraChange procedure code above. A far more elegant approach that compacts the code is as follows:

    procedure TMainForm.cbxChooseCameraChange(Sender: TObject);
       begin //avoids an unnecessary camera change
           if( SceneHelper.CameraMode <>  TGLCameraMode( cbxChooseCamera.ItemIndex ) then
            SceneHelper.CameraMode :=  TGLCameraMode( cbxChooseCamera.ItemIndex );
       end;
    

    then all is need is to paste cmFree, cmTop, cmBottom, cmLeft, cmRight, cmFront, cmBack, cmCustom into the ComboBox items list and every thing is set to go. I use the same code to change the GLScene antialiasing at runtime.

     

    Last edit: Mark Stephen Day 2016-09-19
  • Jerome.D (BeanzMaster)

    Hi Mark, thanks is clearly a better and quickiest way !:) I'll do the changes.

     
  • RBob

    RBob - 2016-09-19

    Hi all,
    some time ago I have a bit tested Jerome's code developing a very simple example to understand how use the code.. I started from another GZimo demo removing a lot of code, and leaving only the basic commands.. I attach you the demo with a little modification in the file uglsceneeditingtools.pas (the runtime creation and destruction of TGLActionHistoryCollection list to to support history aspect).
    As you can see in the demo, I add the follow instructions in FormCreate event, so I can create some GLScene objects at design time...

    SceneHelper              := TGLSceneEditingHelper.Create(self);
    SceneHelper.Viewer       := GLSceneViewer1;
    GLRootObjects.MoveTo(SceneHelper.RootObjects);
    

    I also include last Mark suggestion..

     
  • Eric Hardinge

    Eric Hardinge - 2016-09-21

    Hi Bob,
    [dcc32 Fatal Error] uglsceneeditingtools.pas(20): F2063 Could not compile used unit 'GLViewer.pas'
    This error occured when attempting to compile GLEditingHelperTest0 using Version 1.4.0.6695
    VCL download version 6906. GLViewer.dcu is contained in the source files but not GLViewer.pas
    Eric Hardinge

     
    • RBob

      RBob - 2016-09-21

      Hi Eric,
      GLViewer.pas is a GLScene source file; maybe there is an error in "Delphi options|Library path"

       
  • Eric Hardinge

    Eric Hardinge - 2016-09-22

    Hi Bob,
    I have made some changes so that it compiles for me.

     
    • RBob

      RBob - 2016-09-22

      Ok Eric,
      I didn't remember about that GLViewer discussion...
      I think I'm working with GLScene_v1.4_December_2015_VCL download...

       
  • RBob

    RBob - 2016-11-22

    Hi Jerome,
    probably in next days I will work with your HelpEditor: pheraps, have you update the files in recent months?

    thx

     

Log in to post a comment.

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.