Initial code for the upload model wizard - loading model is working, not much else

meow-7.2.2
leyla_linden 2010-12-09 17:30:17 -08:00
parent a1e59112d0
commit db1af2445d
23 changed files with 469 additions and 26 deletions

View File

@ -201,6 +201,7 @@ set(viewer_SOURCE_FILES
llfloatermediasettings.cpp
llfloatermemleak.cpp
llfloatermodelpreview.cpp
llfloatermodelwizard.cpp
llfloaternamedesc.cpp
llfloaternotificationsconsole.cpp
llfloateropenobject.cpp
@ -741,6 +742,7 @@ set(viewer_HEADER_FILES
llfloatermediasettings.h
llfloatermemleak.h
llfloatermodelpreview.h
llfloatermodelwizard.h
llfloaternamedesc.h
llfloaternotificationsconsole.h
llfloateropenobject.h

View File

@ -212,24 +212,18 @@ BOOL stop_gloderror()
return FALSE;
}
class LLMeshFilePicker : public LLFilePickerThread
{
public:
LLFloaterModelPreview* mFMP;
S32 mLOD;
LLMeshFilePicker(LLFloaterModelPreview* fmp, S32 lod)
LLMeshFilePicker::LLMeshFilePicker(LLModelPreview* mp, S32 lod)
: LLFilePickerThread(LLFilePicker::FFLOAD_COLLADA)
{
mFMP = fmp;
mMP = mp;
mLOD = lod;
}
virtual void notify(const std::string& filename)
{
mFMP->mModelPreview->loadModel(mFile, mLOD);
}
};
void LLMeshFilePicker::notify(const std::string& filename)
{
mMP->loadModel(mFile, mLOD);
}
//-----------------------------------------------------------------------------
@ -242,7 +236,6 @@ LLFloater(key)
mLastMouseX = 0;
mLastMouseY = 0;
mGLName = 0;
mLoading = FALSE;
}
//-----------------------------------------------------------------------------
@ -294,6 +287,7 @@ BOOL LLFloaterModelPreview::postBuild()
mModelPreview = new LLModelPreview(512, 512, this);
mModelPreview->setPreviewTarget(16.f);
mModelPreview->setAspect((F32) mPreviewRect.getWidth()/mPreviewRect.getHeight());
//set callbacks for left click on line editor rows
for (U32 i = 0; i <= LLModel::LOD_HIGH; i++)
@ -348,9 +342,9 @@ LLFloaterModelPreview::~LLFloaterModelPreview()
void LLFloaterModelPreview::loadModel(S32 lod)
{
mLoading = TRUE;
mModelPreview->mLoading = true;
(new LLMeshFilePicker(this, lod))->getFile();
(new LLMeshFilePicker(mModelPreview, lod))->getFile();
}
void LLFloaterModelPreview::setLimit(S32 lod, S32 limit)
@ -493,7 +487,7 @@ void LLFloaterModelPreview::draw()
mModelPreview->update();
if (!mLoading)
if (!mModelPreview->mLoading)
{
childSetTextArg("status", "[STATUS]", getString("status_idle"));
}
@ -1966,7 +1960,7 @@ LLColor4 LLModelLoader::getDaeColor(daeElement* element)
// LLModelPreview
//-----------------------------------------------------------------------------
LLModelPreview::LLModelPreview(S32 width, S32 height, LLFloaterModelPreview* fmp)
LLModelPreview::LLModelPreview(S32 width, S32 height, LLFloater* fmp)
: LLViewerDynamicTexture(width, height, 3, ORDER_MIDDLE, FALSE), LLMutex(NULL)
{
mNeedsUpdate = TRUE;
@ -1978,6 +1972,7 @@ LLModelPreview::LLModelPreview(S32 width, S32 height, LLFloaterModelPreview* fmp
mPreviewLOD = 0;
mModelLoader = NULL;
mDirty = false;
mLoading = false;
for (U32 i = 0; i < LLModel::NUM_LODS; i++)
{
@ -2216,7 +2211,7 @@ void LLModelPreview::loadModel(std::string filename, S32 lod)
mFMP->closeFloater(false);
}
mFMP->mLoading = false;
mLoading = false;
return;
}
@ -2339,7 +2334,7 @@ void LLModelPreview::loadModelCallback(S32 lod)
resetPreviewTarget();
}
mFMP->mLoading = FALSE;
mLoading = false;
refresh();
}
@ -3369,9 +3364,7 @@ BOOL LLModelPreview::render()
glClear(GL_DEPTH_BUFFER_BIT);
F32 aspect = (F32) mFMP->mPreviewRect.getWidth()/mFMP->mPreviewRect.getHeight();
LLViewerCamera::getInstance()->setAspect(aspect);
LLViewerCamera::getInstance()->setAspect(mAspect);
LLViewerCamera::getInstance()->setView(LLViewerCamera::getInstance()->getDefaultFOV() / mCameraZoom);
LLVector3 offset = mCameraOffset;

View File

@ -34,6 +34,7 @@
#include "llmeshrepository.h"
#include "llmodel.h"
#include "llthread.h"
#include "llviewermenufile.h"
class LLComboBox;
class LLJoint;
@ -202,7 +203,6 @@ protected:
S32 mLastMouseY;
LLRect mPreviewRect;
U32 mGLName;
BOOL mLoading;
static S32 sUploadAmount;
LLPointer<DecompRequest> mCurRequest;
@ -210,11 +210,23 @@ protected:
};
class LLMeshFilePicker : public LLFilePickerThread
{
public:
LLMeshFilePicker(LLModelPreview* mp, S32 lod);
virtual void notify(const std::string& filename);
private:
LLModelPreview* mMP;
S32 mLOD;
};
class LLModelPreview : public LLViewerDynamicTexture, public LLMutex
{
public:
LLModelPreview(S32 width, S32 height, LLFloaterModelPreview* fmp);
LLModelPreview(S32 width, S32 height, LLFloater* fmp);
virtual ~LLModelPreview();
void resetPreviewTarget();
@ -244,15 +256,18 @@ class LLModelPreview : public LLViewerDynamicTexture, public LLMutex
void clearIncompatible(S32 lod);
void updateStatusMessages();
bool containsRiggedAsset( void );
void setAspect(F32 aspect) { mAspect = aspect; };
//void setLoading(bool loading) { mLoading = loading; };
static void textureLoadedCallback( BOOL success, LLViewerFetchedTexture *src_vi, LLImageRaw* src, LLImageRaw* src_aux, S32 discard_level, BOOL final, void* userdata );
protected:
friend class LLFloaterModelPreview;
friend class LLFloaterModelWizard;
friend class LLFloaterModelPreview::DecompRequest;
friend class LLPhysicsDecomp;
LLFloaterModelPreview* mFMP;
LLFloater* mFMP;
BOOL mNeedsUpdate;
bool mDirty;
@ -268,6 +283,8 @@ class LLModelPreview : public LLViewerDynamicTexture, public LLMutex
U32 mResourceCost;
S32 mLimit[LLModel::NUM_LODS];
std::string mLODFile[LLModel::NUM_LODS];
F32 mAspect;
bool mLoading;
LLModelLoader* mModelLoader;

View File

@ -0,0 +1,112 @@
/**
* @file llfloatermodelwizard.cpp
* @author Leyla Farazha
* @brief Implementation of the LLFloaterModelWizard class.
*
* $LicenseInfo:firstyear=2002&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2010, Linden Research, Inc.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
*
* This library 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
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
#include "llviewerprecompiledheaders.h"
#include "lldrawable.h"
#include "llfloater.h"
#include "llfloatermodelwizard.h"
#include "llfloatermodelpreview.h"
#include "llfloaterreg.h"
LLFloaterModelWizard::LLFloaterModelWizard(const LLSD& key)
: LLFloater(key)
{
}
void LLFloaterModelWizard::loadModel()
{
mModelPreview->mLoading = TRUE;
(new LLMeshFilePicker(mModelPreview, 3))->getFile();
}
BOOL LLFloaterModelWizard::postBuild()
{
LLView* preview_panel = getChild<LLView>("preview_panel");
childSetValue("import_scale", (F32) 0.67335826);
getChild<LLUICtrl>("browse")->setCommitCallback(boost::bind(&LLFloaterModelWizard::loadModel, this));
mPreviewRect = preview_panel->getRect();
mModelPreview = new LLModelPreview(512, 512, this);
mModelPreview->setPreviewTarget(16.f);
mModelPreview->setAspect((F32) mPreviewRect.getWidth()/mPreviewRect.getHeight());
center();
return TRUE;
}
void LLFloaterModelWizard::draw()
{
LLFloater::draw();
LLRect r = getRect();
mModelPreview->update();
if (mModelPreview)
{
gGL.color3f(1.f, 1.f, 1.f);
gGL.getTexUnit(0)->bind(mModelPreview);
LLView* preview_panel = getChild<LLView>("preview_panel");
LLRect rect = preview_panel->getRect();
if (rect != mPreviewRect)
{
mModelPreview->refresh();
mPreviewRect = preview_panel->getRect();
}
LLRect item_rect;
preview_panel->localRectToOtherView(preview_panel->getLocalRect(), &item_rect, this);
gGL.begin( LLRender::QUADS );
{
gGL.texCoord2f(0.f, 1.f);
gGL.vertex2i(mPreviewRect.mLeft, item_rect.mTop);
gGL.texCoord2f(0.f, 0.f);
gGL.vertex2i(mPreviewRect.mLeft, item_rect.mBottom);
gGL.texCoord2f(1.f, 0.f);
gGL.vertex2i(mPreviewRect.mRight, item_rect.mBottom);
gGL.texCoord2f(1.f, 1.f);
gGL.vertex2i(mPreviewRect.mRight, item_rect.mTop);
}
gGL.end();
gGL.getTexUnit(0)->unbind(LLTexUnit::TT_TEXTURE);
}
}

View File

@ -0,0 +1,58 @@
/**
* @file llfloatermodelwizard.h
*
* $LicenseInfo:firstyear=2009&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2010, Linden Research, Inc.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
*
* This library 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
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
#ifndef LLFLOATERMODELWIZARD_H
#define LLFLOATERMODELWIZARD_H
class LLModelPreview;
class LLFloaterModelWizard : public LLFloater
{
public:
LLFloaterModelWizard(const LLSD& key);
virtual ~LLFloaterModelWizard() {};
/*virtual*/ BOOL postBuild();
void draw();
void loadModel();
//void onSave();
//void onReset();
//void onCancel();
///*virtual*/ void onOpen(const LLSD& key);
private:
LLModelPreview* mModelPreview;
LLRect mPreviewRect;
};
/*
namespace LLFloaterDisplayNameUtil
{
// Register with LLFloaterReg
void registerFloater();
}
*/
#endif

View File

@ -72,6 +72,7 @@
#include "llfloaterlandholdings.h"
#include "llfloatermap.h"
#include "llfloatermemleak.h"
#include "llfloatermodelwizard.h"
#include "llfloaternamedesc.h"
#include "llfloaternotificationsconsole.h"
#include "llfloateropenobject.h"
@ -251,6 +252,7 @@ void LLViewerFloaterReg::registerFloaters()
LLFloaterReg::add("upload_image", "floater_image_preview.xml", (LLFloaterBuildFunc)&LLFloaterReg::build<LLFloaterImagePreview>, "upload");
LLFloaterReg::add("upload_sound", "floater_sound_preview.xml", (LLFloaterBuildFunc)&LLFloaterReg::build<LLFloaterSoundPreview>, "upload");
LLFloaterReg::add("upload_model", "floater_model_preview.xml", (LLFloaterBuildFunc)&LLFloaterReg::build<LLFloaterModelPreview>, "upload");
LLFloaterReg::add("upload_model_wizard", "floater_model_wizard.xml", (LLFloaterBuildFunc)&LLFloaterReg::build<LLFloaterModelWizard>, "upload");
LLFloaterReg::add("voice_controls", "floater_voice_controls.xml", (LLFloaterBuildFunc)&LLFloaterReg::build<LLCallFloater>);
LLFloaterReg::add("voice_effect", "floater_voice_effect.xml", (LLFloaterBuildFunc)&LLFloaterReg::build<LLFloaterVoiceEffect>);

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.8 KiB

View File

@ -0,0 +1,247 @@
<?xml version="1.0" encoding="utf-8" standalone="yes" ?>
<floater
legacy_header_height="18"
layout="topleft"
name="Model Wizard"
help_topic="model_wizard"
bg_opaque_image_overlay="0.5 0.5 0.5 1"
height="450"
save_rect="true"
title="UPLOAD MODEL WIZARD"
width="530">
<panel
height="600">
<button
top="30"
left="410"
height="32"
name="upload"
enabled="false"
label="5. Upload"
border="false"
image_unselected="model_wizard/middle_button_off.png"
image_selected="model_wizard/middle_button_press.png"
image_hover_unselected="model_wizard/middle_button_over.png"
image_disabled="model_wizard/middle_button_disabled.png"
image_disabled_selected="model_wizard/middle_button_disabled.png"
width="110"/>
<button
top="30"
left="310"
height="32"
tab_stop="false"
name="review"
label="4. Review"
enabled="false"
border="false"
image_unselected="model_wizard/middle_button_off.png"
image_selected="model_wizard/middle_button_press.png"
image_hover_unselected="model_wizard/middle_button_over.png"
image_disabled="model_wizard/middle_button_disabled.png"
image_disabled_selected="model_wizard/middle_button_disabled.png"
width="110"/>
<button
top="30"
left="210"
height="32"
name="physics"
label="3. Physics"
tab_stop="false"
enabled="false"
border="false"
image_unselected="model_wizard/middle_button_off.png"
image_selected="model_wizard/middle_button_press.png"
image_hover_unselected="model_wizard/middle_button_over.png"
image_disabled="model_wizard/middle_button_disabled.png"
image_disabled_selected="model_wizard/middle_button_disabled.png"
width="110"/>
<button
top="30"
left="115"
name="optimize"
label="2. Optimize"
tab_stop="false"
height="32"
border="false"
image_unselected="model_wizard/middle_button_off.png"
image_selected="model_wizard/middle_button_press.png"
image_hover_unselected="model_wizard/middle_button_over.png"
image_disabled="model_wizard/middle_button_disabled.png"
image_disabled_selected="model_wizard/middle_button_disabled.png"
width="110"/>
<button
top="30"
left="15"
name="choose_file"
enabled="false"
label="1. Choose File"
height="32"
image_unselected="model_wizard/left_button_off.png"
image_selected="model_wizard/left_button_press.png"
image_hover_unselected="model_wizard/left_button_over.png"
image_disabled="model_wizard/left_button_disabled.png"
image_disabled_selected="model_wizard/left_button_disabled.png"
width="110"/>
<panel
top_pad="20"
height="20"
width="500"
bg_opaque_color="DkGray2"
background_visible="true"
background_opaque="true"
left="20">
<text
width="200"
left="10"
top="2"
height="10"
font="SansSerifBig"
layout="topleft"
>
Upload Model
</text></panel>
<text
top_pad="14"
width="460"
height="20"
font="SansSerifSmall"
layout="topleft"
word_wrap="true"
left_delta="0">
This wizard will help you import mesh models to Second Life. First specify a file containing the model you wish to import. Second Life supports COLLADA (.dae) files.
</text>
<panel
top_delta="40"
left="15"
height="240"
width="500"
bg_opaque_color="DkGray2"
background_visible="true"
background_opaque="true">
<text
type="string"
length="1"
follows="left|top"
top="10"
height="10"
layout="topleft"
left_delta="10"
name="Cache location"
width="300">
Filename:
</text>
<line_editor
control_name="CacheLocationTopFolder"
border_style="line"
border_thickness="1"
follows="left|top"
font="SansSerifSmall"
height="20"
layout="topleft"
left_delta="0"
max_length="4096"
name="cache_location"
top_pad="5"
width="220" />
<button
follows="left|top"
height="23"
label="Browse..."
label_selected="Browse..."
layout="topleft"
left_pad="10"
name="browse"
top_delta="-1"
width="75">
</button>
<text
top_delta="-15"
width="200"
height="15"
font="SansSerifSmall"
layout="topleft"
left_pad="24">
Model Preview:
</text>
<!-- Placeholder panel for 3D preview render -->
<panel
left_delta="-2"
top_pad="0"
name="preview_panel"
bevel_style="none"
border_style="line"
border="true"
height="150"
follows="all"
width="150">
</panel>
<text
top_pad="10"
width="130"
height="15"
left="340"
word_wrap="true"
>
Dimensions (meters):
</text>
<text
top_pad="5"
width="10"
height="15"
left_delta="0"
>
X:
</text>
<text
top_delta="0"
width="10"
height="15"
left_pad="25"
>
Y:
</text>
<text
top_delta="0"
width="10"
height="15"
left_pad="25"
>
Z:
</text>
<text
top="100"
width="320"
height="40"
left="10"
word_wrap="true"
>
Note:
Advanced users familiar with 3d content creation tools may prefer to use the Advanced Mesh Import window.
</text>
</panel>
<button
top="410"
right="-175"
width="80"
height="20"
label="&lt;&lt; Back" />
<button
top="410"
right="-92"
width="80"
height="20"
label="Next &gt;&gt; " />
<button
top="410"
right="-15"
width="70"
height="20"
label="Cancel" />
</panel>
<spinner visible="false" left="10" height="20" follows="top|left" width="80" top_pad="-50" value="1.0" min_val="0.01" max_val="64.0" name="import_scale"/>
</floater>

View File

@ -972,6 +972,18 @@
<menu_item_call.on_visible
function="File.MeshEnabled"/>
</menu_item_call>
<menu_item_call
label="Model Wizard..."
layout="topleft"
name="Upload Model Wizard">
<menu_item_call.on_click
function="Floater.Show"
parameter="upload_model_wizard" />
<menu_item_call.on_enable
function="File.EnableUploadModel" />
<menu_item_call.on_visible
function="File.MeshEnabled"/>
</menu_item_call>
<menu_item_call
label="Bulk (L$[COST] per file)..."
layout="topleft"