PageRenderTime 302ms CodeModel.GetById 121ms app.highlight 10ms RepoModel.GetById 111ms app.codeStats 0ms

/indra/newview/llfloatermodelwizard.h

https://bitbucket.org/lindenlab/viewer-beta/
C++ Header | 140 lines | 83 code | 31 blank | 26 comment | 0 complexity | 15153f7b4aab0a8ff4cf801c7f37d5cc MD5 | raw file
  1/** 
  2 * @file llfloatermodelwizard.h
  3 *
  4 * $LicenseInfo:firstyear=2009&license=viewerlgpl$
  5 * Second Life Viewer Source Code
  6 * Copyright (C) 2010, Linden Research, Inc.
  7 * 
  8 * This library is free software; you can redistribute it and/or
  9 * modify it under the terms of the GNU Lesser General Public
 10 * License as published by the Free Software Foundation;
 11 * version 2.1 of the License only.
 12 * 
 13 * This library is distributed in the hope that it will be useful,
 14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 16 * Lesser General Public License for more details.
 17 * 
 18 * You should have received a copy of the GNU Lesser General Public
 19 * License along with this library; if not, write to the Free Software
 20 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
 21 * 
 22 * Linden Research, Inc., 945 Battery Street, San Francisco, CA  94111  USA
 23 * $/LicenseInfo$
 24 */
 25
 26#ifndef LLFLOATERMODELWIZARD_H
 27#define LLFLOATERMODELWIZARD_H
 28
 29
 30#include "llmeshrepository.h"
 31#include "llmodel.h"
 32#include "llthread.h"
 33#include "llfloatermodeluploadbase.h"
 34
 35
 36class LLModelPreview;
 37
 38
 39class LLFloaterModelWizard : public LLFloaterModelUploadBase
 40{
 41public:
 42	
 43	class DecompRequest : public LLPhysicsDecomp::Request
 44	{
 45	public:
 46		S32 mContinue;
 47		LLPointer<LLModel> mModel;
 48		
 49		DecompRequest(const std::string& stage, LLModel* mdl);
 50		virtual S32 statusCallback(const char* status, S32 p1, S32 p2);
 51		virtual void completed();
 52		
 53	};
 54	
 55	static LLFloaterModelWizard* sInstance;
 56
 57	LLFloaterModelWizard(const LLSD& key);
 58	virtual ~LLFloaterModelWizard();
 59	/*virtual*/	BOOL	postBuild();
 60	void			draw();
 61	void            refresh();
 62	
 63	BOOL handleMouseDown(S32 x, S32 y, MASK mask);
 64	BOOL handleMouseUp(S32 x, S32 y, MASK mask);
 65	BOOL handleHover(S32 x, S32 y, MASK mask);
 66	BOOL handleScrollWheel(S32 x, S32 y, S32 clicks);
 67
 68	void setDetails(F32 x, F32 y, F32 z, F32 streaming_cost, F32 physics_cost);
 69	void modelLoadedCallback();
 70	void modelChangedCallback();
 71	void initDecompControls();
 72	
 73	// shows warning message if agent has no permissions to upload model
 74	/*virtual*/ void onPermissionsReceived(const LLSD& result);
 75
 76	// called when error occurs during permissions request
 77	/*virtual*/ void setPermissonsErrorStatus(U32 status, const std::string& reason);
 78
 79	/*virtual*/ void onModelPhysicsFeeReceived(const LLSD& result, std::string upload_url);
 80
 81	/*virtual*/ void setModelPhysicsFeeErrorStatus(U32 status, const std::string& reason);
 82
 83	/*virtual*/ void onModelUploadSuccess();
 84
 85	/*virtual*/ void onModelUploadFailure();
 86
 87	const LLRect& getPreviewRect() const { return mPreviewRect; }
 88
 89	LLPhysicsDecomp::decomp_params mDecompParams;
 90	std::set<LLPointer<DecompRequest> > mCurRequest;
 91	std::string mStatusMessage;
 92	static void executePhysicsStage(std::string stage_name);
 93
 94private:
 95	enum EWizardState
 96	{
 97		CHOOSE_FILE = 0,
 98		OPTIMIZE,
 99		PHYSICS,
100		REVIEW,
101		UPLOAD
102	};
103
104	void setState(int state);
105	void updateButtons();
106	void onClickSwitchToAdvanced();
107	void onClickRecalculateGeometry();
108	void onClickRecalculatePhysics();
109	void onClickCalculateUploadFee();
110	void onClickCancel();
111	void onClickBack();
112	void onClickNext();
113	bool onEnableNext();
114	bool onEnableBack();
115	void loadModel();
116	void onPreviewLODCommit(LLUICtrl*);
117	void onUpload();
118
119	LLModelPreview*	mModelPreview;
120	LLRect			mPreviewRect;
121	int mState;
122
123	S32				mLastMouseX;
124	S32				mLastMouseY;
125
126	U32			    mLastEnabledState;
127
128	LLButton*		mRecalculateGeometryBtn;
129	LLButton*		mRecalculatePhysicsBtn;
130	LLButton*		mRecalculatingPhysicsBtn;
131	LLButton*		mCalculateWeightsBtn;
132	LLButton*		mCalculatingWeightsBtn;
133
134	LLView*		mChooseFilePreviewPanel;
135	LLView*		mOptimizePreviewPanel;
136	LLView*		mPhysicsPreviewPanel;
137};
138
139
140#endif