Added aqua_speed for rite geo 50 tryker
[ryzomcore.git] / nel / tools / 3d / object_viewer / particle_dlg.h
blob52bf013e6f0bfdcf04bb5d24c2322dd0a7d8f59e
1 // NeL - MMORPG Framework <http://dev.ryzom.com/projects/nel/>
2 // Copyright (C) 2010 Winch Gate Property Limited
3 //
4 // This program is free software: you can redistribute it and/or modify
5 // it under the terms of the GNU Affero General Public License as
6 // published by the Free Software Foundation, either version 3 of the
7 // License, or (at your option) any later version.
8 //
9 // This program is distributed in the hope that it will be useful,
10 // but WITHOUT ANY WARRANTY; without even the implied warranty of
11 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 // GNU Affero General Public License for more details.
14 // You should have received a copy of the GNU Affero General Public License
15 // along with this program. If not, see <http://www.gnu.org/licenses/>.
18 #if !defined(AFX_PARTICLE_DLG_H__AD58E337_952E_4C0D_A6D8_F87AFFEA3A24__INCLUDED_)
19 #define AFX_PARTICLE_DLG_H__AD58E337_952E_4C0D_A6D8_F87AFFEA3A24__INCLUDED_
23 #if _MSC_VER > 1000
24 #pragma once
25 #endif // _MSC_VER > 1000
26 // particle_dlg.h : header file
30 #include "object_viewer.h"
31 #include "particle_tree_ctrl.h"
32 #include "nel/misc/matrix.h"
33 #include "particle_workspace.h"
35 namespace NL3D
37 class CParticleSystem;
38 class CParticleSystemModel;
39 class CFontManager;
40 class CFontGenerator;
44 class CStartStopParticleSystem;
45 class CSceneDlg;
46 class CParticleTreeCtrl;
47 class CMainFrame;
48 class CAnimationDlg;
53 /////////////////////////////////////////////////////////////////////////////
54 // CParticleDlg dialog
56 class CParticleDlg : public CDialog, public CObjectViewer::IMainLoopCallBack
58 // Construction
59 public:
60 CParticleDlg::CParticleDlg(class CObjectViewer* main, CWnd *pParent, CMainFrame* mainFrame, CAnimationDlg *animDLG);
61 ~CParticleDlg();
62 void setRightPane(CWnd *pane);
63 BOOL Create(UINT nIDTemplate, CWnd* pParentWnd = NULL);
65 // Dialog Data
66 //{{AFX_DATA(CParticleDlg)
67 enum { IDD = IDD_PARTICLE };
68 //}}AFX_DATA
71 // Overrides
72 // ClassWizard generated virtual function overrides
73 //{{AFX_VIRTUAL(CParticleDlg)
74 protected:
75 virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support
76 virtual LRESULT WindowProc(UINT message, WPARAM wParam, LPARAM lParam);
77 //}}AFX_VIRTUAL
79 // Implementation
81 public:
82 // the tree for viewing the system
83 CParticleTreeCtrl *ParticleTreeCtrl;
84 // inherited from CObjectViewer::IMainLoopCallBack
85 void goPostRender();
86 void goPreRender() {}
87 public:
88 friend class CParticleTreeCtrl;
89 /** Active a new node of the workspace
90 * Current active node is ready for edition.
91 * Its bbox is displayed.
93 void setActiveNode(CParticleWorkspace::CNode *node);
94 // Get the node of the workspace that is currently active
95 CParticleWorkspace::CNode *getActiveNode() const { return _ActiveNode; }
96 // Get the particle system model that is currently active
97 NL3D::CParticleSystemModel *getActivePSM() const { return _ActiveNode ? _ActiveNode->getPSModel() : NULL; }
98 // get matrix of current fx
99 const NLMISC::CMatrix &getPSMatrix() const;
100 // set matrix of current fx
101 void setPSMatrix(const NLMISC::CMatrix &mat);
102 // get world matrix of current fx
103 const NLMISC::CMatrix &getPSWorldMatrix() const;
104 // set world matrix of current fx
105 void setPSWorldMatrix(const NLMISC::CMatrix &mat);
106 // move the current selected element using the given matrix
107 void moveElement(const NLMISC::CMatrix &mat);
108 // get the matrix of the current selected element selected, or identity if there's none
109 NLMISC::CMatrix getElementMatrix(void) const;
110 // the scene dialog
111 CMainFrame *MainFrame;
112 // the fonts used for particle edition
113 NL3D::CFontManager *FontManager;
114 NL3D::CFontGenerator *FontGenerator;
115 // get the current right pane of the editor (NULL if none)
116 CWnd *getRightPane(void) { return CurrentRightPane; }
117 const CWnd *getRightPane(void) const { return CurrentRightPane; }
118 // auto bbox for fx
119 void setAutoBBox(bool enable) { _AutoUpdateBBox = enable; }
120 bool getAutoBBox() const { return _AutoUpdateBBox; }
121 // reset the auto bbox
122 void resetAutoBBox() { _EmptyBBox = true; }
123 // get the object viewer instance
124 CObjectViewer *getObjectViewer() const { return _ObjView; }
125 /** Stick the current edited fx to a skeleton.
126 * This also reset the fx matrix, and prevent from changing it.
128 void stickPSToSkeleton(CParticleWorkspace::CNode *node,
129 NL3D::CSkeletonModel *skel,
130 uint bone,
131 const std::string &parentSkelName, // -> saved in the workspace
132 const std::string &parentBoneName
134 // unstick the current edited fx from its parent skeleton (if there's one)
135 void unstickPSFromSkeleton(CParticleWorkspace::CNode *node);
136 // return true is the current edited fx is sticked to a skeleton.
137 bool isPSStickedToSkeleton() const { return _ActiveNode != NULL ? _ActiveNode->getParentSkel() != NULL : false; }
138 CParticleWorkspace *getParticleWorkspace() const { return _PW; }
139 // get a model from a ps pointer. The ps must belong to the workspace
140 NL3D::CParticleSystemModel *getModelFromPS(NL3D::CParticleSystem *ps) const;
141 CStartStopParticleSystem *StartStopDlg;
142 // set text of the status bar
143 void setStatusBarText(CString &str);
144 // Check if the current workspace has been modified, and prompt the user to save it if so
145 void checkModifiedWorkSpace();
146 // Load a new particle workspace (without asking if current workspace has been modified)
147 void loadWorkspace(const std::string &fullPath);
148 protected:
149 CStatusBar _StatusBar;
150 CObjectViewer *_ObjView;
151 CParticleWorkspace *_PW;
152 // currently active node of the workspace
153 CParticleWorkspace::CNode *_ActiveNode;
155 // the current system that is being edited
156 //NL3D::CParticleSystem *_CurrPS;
158 // the current model that holds our system
159 //NL3D::CParticleSystemModel *_CurrSystemModel;
161 // the system bbox must be updated automatically
162 bool _AutoUpdateBBox;
164 // the last computed bbox for the system
165 bool _EmptyBBox;
166 NLMISC::CAABBox _CurrBBox;
169 // the current right pane of the editor
170 CWnd *CurrentRightPane;
171 sint32 CurrRightPaneWidth, CurrRightPaneHeight;
173 CRect getTreeRect(int cx, int cy) const;
176 // Generated message map functions
177 //{{AFX_MSG(CParticleDlg)
178 afx_msg void OnDestroy();
179 virtual BOOL OnInitDialog();
180 afx_msg void OnSize(UINT nType, int cx, int cy);
181 afx_msg void OnShowWindow(BOOL bShow, UINT nStatus);
182 afx_msg void OnChar(UINT nChar, UINT nRepCnt, UINT nFlags);
183 afx_msg void OnCreateNewPsWorkspace();
184 afx_msg void OnLoadPSWorkspace();
185 afx_msg void OnSaveAllPsWorkspace();
186 afx_msg void OnSavePsWorkspace();
187 afx_msg void OnViewPsFilename();
188 //}}AFX_MSG
189 DECLARE_MESSAGE_MAP()
191 // Save the workspace structure
192 void saveWorkspaceStructure();
193 // Save the workspace content
194 void saveWorkspaceContent(bool askToSaveModifiedPS);
195 // Cloase the workspace without saving or asking the user
196 void closeWorkspace();
197 public:
198 /** Save a single particle system
199 * \param askToContinueWhenError If an error occurs, the user will be asked if loading must continue (if there are other ps to save)
200 * \return true if loading should continue for remaining ps, false if loading failed and if user didn't want to continue loading
202 bool savePS(HWND parent, CParticleWorkspace::CNode &ps, bool askToContinueWhenError);
203 bool savePSAs(HWND parent, CParticleWorkspace::CNode &ps, const std::string &fullPath, bool askToContinueWhenError);
204 // Enum to describe the behaviour of loadPS
205 enum TLoadPSBehav
207 Silent, // loading error are not prompted
208 ReportError, // report error
209 ReportErrorSkippable // report error and ask if the user want errors to be reported again
211 /** Try to load a particle system. Prompt msg as necessary for error loading
212 * \param behav Behaviour in case of error
213 * \return true if the user want see further error (e.g he hasn't checked the 'don't show egain' message box.
215 bool loadPS(HWND parent, CParticleWorkspace::CNode &ps, TLoadPSBehav behav);
217 uint computeStatusBarWidth() const;
218 void updateMenu();
221 //{{AFX_INSERT_LOCATION}}
222 // Microsoft Visual C++ will insert additional declarations immediately before the previous line.
224 #endif // !defined(AFX_PARTICLE_DLG_H__AD58E337_952E_4C0D_A6D8_F87AFFEA3A24__INCLUDED_)