Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
Alchemy Viewer
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Locked files
Deploy
Releases
Package registry
Operate
Terraform modules
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Silent mode is enabled
All outbound communications are blocked.
Learn more
.
Show more breadcrumbs
Alchemy Viewer
Alchemy Viewer
Commits
d605b79e
Commit
d605b79e
authored
15 years ago
by
Eric M. Tulla (BigPapi)
Browse files
Options
Downloads
Plain Diff
Automated merge with
ssh://hg.lindenlab.com/viewer/viewer-2-0/
parents
6aa46cc5
6d27a9e2
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
indra/newview/llagentwearables.cpp
+207
-23
207 additions, 23 deletions
indra/newview/llagentwearables.cpp
with
207 additions
and
23 deletions
indra/newview/llagentwearables.cpp
+
207
−
23
View file @
d605b79e
...
@@ -95,19 +95,38 @@ class LLLibraryOutfitsFetch : public LLInventoryFetchDescendentsObserver
...
@@ -95,19 +95,38 @@ class LLLibraryOutfitsFetch : public LLInventoryFetchDescendentsObserver
enum
ELibraryOutfitFetchStep
{
enum
ELibraryOutfitFetchStep
{
LOFS_FOLDER
=
0
,
LOFS_FOLDER
=
0
,
LOFS_OUTFITS
,
LOFS_OUTFITS
,
LOFS_LIBRARY
,
LOFS_IMPORTED
,
LOFS_CONTENTS
LOFS_CONTENTS
};
};
LLLibraryOutfitsFetch
()
:
mCurrFetchStep
(
LOFS_FOLDER
),
mOutfitsPopulated
(
false
)
{}
LLLibraryOutfitsFetch
()
:
mCurrFetchStep
(
LOFS_FOLDER
),
mOutfitsPopulated
(
false
)
{
mMyOutfitsID
=
LLUUID
::
null
;
mClothingID
=
LLUUID
::
null
;
mLibraryClothingID
=
LLUUID
::
null
;
mImportedClothingID
=
LLUUID
::
null
;
mImportedClothingName
=
"Imported Library Clothing"
;
}
~
LLLibraryOutfitsFetch
()
{}
~
LLLibraryOutfitsFetch
()
{}
virtual
void
done
();
virtual
void
done
();
void
doneIdle
();
void
doneIdle
();
LLUUID
mMyOutfitsID
;
void
importedFolderFetch
();
protected
:
protected
:
void
folderDone
(
void
);
void
folderDone
(
void
);
void
outfitsDone
(
void
);
void
outfitsDone
(
void
);
void
libraryDone
(
void
);
void
importedFolderDone
(
void
);
void
contentsDone
(
void
);
void
contentsDone
(
void
);
enum
ELibraryOutfitFetchStep
mCurrFetchStep
;
enum
ELibraryOutfitFetchStep
mCurrFetchStep
;
std
::
vector
<
std
::
pair
<
LLUUID
,
std
::
string
>
>
mOutfits
;
typedef
std
::
vector
<
std
::
pair
<
LLUUID
,
std
::
string
>
>
cloth_folder_vec_t
;
cloth_folder_vec_t
mLibraryClothingFolders
;
cloth_folder_vec_t
mImportedClothingFolders
;
bool
mOutfitsPopulated
;
bool
mOutfitsPopulated
;
LLUUID
mClothingID
;
LLUUID
mLibraryClothingID
;
LLUUID
mImportedClothingID
;
std
::
string
mImportedClothingName
;
};
};
LLAgentWearables
gAgentWearables
;
LLAgentWearables
gAgentWearables
;
...
@@ -2126,11 +2145,15 @@ void LLAgentWearables::populateMyOutfitsFolder(void)
...
@@ -2126,11 +2145,15 @@ void LLAgentWearables::populateMyOutfitsFolder(void)
// Get the complete information on the items in the inventory and
// Get the complete information on the items in the inventory and
// setup an observer that will wait for that to happen.
// setup an observer that will wait for that to happen.
LLInventoryFetchDescendentsObserver
::
folder_ref_t
folders
;
LLInventoryFetchDescendentsObserver
::
folder_ref_t
folders
;
const
LLUUID
my_o
utfits
_id
=
gInventory
.
findCategoryUUIDForType
(
LLFolderType
::
FT_MY_OUTFITS
);
outfits
->
mMyO
utfits
ID
=
gInventory
.
findCategoryUUIDForType
(
LLFolderType
::
FT_MY_OUTFITS
);
folders
.
push_back
(
my_
outfits
_id
);
folders
.
push_back
(
outfits
->
mMyOutfitsID
);
gInventory
.
addObserver
(
outfits
);
gInventory
.
addObserver
(
outfits
);
outfits
->
fetchDescendents
(
folders
);
outfits
->
fetchDescendents
(
folders
);
if
(
outfits
->
isEverythingComplete
())
{
outfits
->
done
();
}
}
}
void
LLLibraryOutfitsFetch
::
done
()
void
LLLibraryOutfitsFetch
::
done
()
...
@@ -2144,13 +2167,24 @@ void LLLibraryOutfitsFetch::done()
...
@@ -2144,13 +2167,24 @@ void LLLibraryOutfitsFetch::done()
void
LLLibraryOutfitsFetch
::
doneIdle
()
void
LLLibraryOutfitsFetch
::
doneIdle
()
{
{
gInventory
.
addObserver
(
this
);
// Add this back in since it was taken out during ::done()
gInventory
.
addObserver
(
this
);
// Add this back in since it was taken out during ::done()
switch
(
mCurrFetchStep
)
switch
(
mCurrFetchStep
)
{
{
case
LOFS_FOLDER
:
case
LOFS_FOLDER
:
folderDone
();
folderDone
();
mCurrFetchStep
=
LOFS_OUTFITS
;
break
;
break
;
case
LOFS_OUTFITS
:
case
LOFS_OUTFITS
:
outfitsDone
();
outfitsDone
();
mCurrFetchStep
=
LOFS_LIBRARY
;
break
;
case
LOFS_LIBRARY
:
libraryDone
();
mCurrFetchStep
=
LOFS_IMPORTED
;
break
;
case
LOFS_IMPORTED
:
importedFolderDone
();
mCurrFetchStep
=
LOFS_CONTENTS
;
break
;
break
;
case
LOFS_CONTENTS
:
case
LOFS_CONTENTS
:
contentsDone
();
contentsDone
();
...
@@ -2172,67 +2206,217 @@ void LLLibraryOutfitsFetch::doneIdle()
...
@@ -2172,67 +2206,217 @@ void LLLibraryOutfitsFetch::doneIdle()
void
LLLibraryOutfitsFetch
::
folderDone
(
void
)
void
LLLibraryOutfitsFetch
::
folderDone
(
void
)
{
{
// Early out if we already have items in My Outfits.
LLInventoryModel
::
cat_array_t
cat_array
;
LLInventoryModel
::
cat_array_t
cat_array
;
LLInventoryModel
::
item_array_t
wearable_array
;
LLInventoryModel
::
item_array_t
wearable_array
;
gInventory
.
collectDescendents
(
m
CompleteFolders
.
front
()
,
cat_array
,
wearable_array
,
gInventory
.
collectDescendents
(
m
MyOutfitsID
,
cat_array
,
wearable_array
,
LLInventoryModel
::
EXCLUDE_TRASH
);
LLInventoryModel
::
EXCLUDE_TRASH
);
// Early out if we already have items in My Outfits.
if
(
cat_array
.
count
()
>
0
||
wearable_array
.
count
()
>
0
)
if
(
cat_array
.
count
()
>
0
||
wearable_array
.
count
()
>
0
)
{
{
mOutfitsPopulated
=
true
;
mOutfitsPopulated
=
true
;
return
;
return
;
}
}
// Get the UUID of the library's clothing folder
mClothingID
=
gInventory
.
findCategoryUUIDForType
(
LLFolderType
::
FT_CLOTHING
);
const
LLUUID
l
ibrary
_c
lothing
_id
=
gInventory
.
findCategoryUUIDForType
(
LLFolderType
::
FT_CLOTHING
,
false
,
true
);
mL
ibrary
C
lothing
ID
=
gInventory
.
findCategoryUUIDForType
(
LLFolderType
::
FT_CLOTHING
,
false
,
true
);
mCompleteFolders
.
clear
();
mCompleteFolders
.
clear
();
// Get the complete information on the items in the inventory.
// Get the complete information on the items in the inventory.
LLInventoryFetchDescendentsObserver
::
folder_ref_t
folders
;
LLInventoryFetchDescendentsObserver
::
folder_ref_t
folders
;
folders
.
push_back
(
library_c
lothing
_id
);
folders
.
push_back
(
mC
lothing
ID
);
mCurrFetchStep
=
LOFS_OUTFITS
;
folders
.
push_back
(
mLibraryClothingID
)
;
fetchDescendents
(
folders
);
fetchDescendents
(
folders
);
if
(
isEverythingComplete
())
{
done
();
}
}
}
void
LLLibraryOutfitsFetch
::
outfitsDone
(
void
)
void
LLLibraryOutfitsFetch
::
outfitsDone
(
void
)
{
{
LLInventoryModel
::
cat_array_t
cat_array
;
LLInventoryModel
::
cat_array_t
cat_array
;
LLInventoryModel
::
item_array_t
wearable_array
;
LLInventoryModel
::
item_array_t
wearable_array
;
gInventory
.
collectDescendents
(
mCompleteFolders
.
front
(),
cat_array
,
wearable_array
,
LLInventoryModel
::
EXCLUDE_TRASH
);
LLInventoryFetchDescendentsObserver
::
folder_ref_t
folders
;
LLInventoryFetchDescendentsObserver
::
folder_ref_t
folders
;
// Collect the contents of the Library's Clothing folder
gInventory
.
collectDescendents
(
mLibraryClothingID
,
cat_array
,
wearable_array
,
LLInventoryModel
::
EXCLUDE_TRASH
);
llassert
(
cat_array
.
count
()
>
0
);
llassert
(
cat_array
.
count
()
>
0
);
for
(
LLInventoryModel
::
cat_array_t
::
const_iterator
iter
=
cat_array
.
begin
();
for
(
LLInventoryModel
::
cat_array_t
::
const_iterator
iter
=
cat_array
.
begin
();
iter
!=
cat_array
.
end
();
iter
!=
cat_array
.
end
();
++
iter
)
++
iter
)
{
{
const
LLViewerInventoryCategory
*
cat
=
iter
->
get
();
const
LLViewerInventoryCategory
*
cat
=
iter
->
get
();
// Get the names and id's of every outfit in the library, except for ruth and other "misc" outfits.
if
(
cat
->
getName
()
!=
"More Outfits"
&&
cat
->
getName
()
!=
"Ruth"
)
if
(
cat
->
getName
()
!=
"More Outfits"
&&
cat
->
getName
()
!=
"Ruth"
)
{
{
// Get the name of every outfit in the library
folders
.
push_back
(
cat
->
getUUID
());
folders
.
push_back
(
cat
->
getUUID
());
mOutfits
.
push_back
(
std
::
make_pair
(
cat
->
getUUID
(),
cat
->
getName
()));
mLibraryClothingFolders
.
push_back
(
std
::
make_pair
(
cat
->
getUUID
(),
cat
->
getName
()));
}
}
// Collect the contents of your Inventory Clothing folder
cat_array
.
clear
();
wearable_array
.
clear
();
gInventory
.
collectDescendents
(
mClothingID
,
cat_array
,
wearable_array
,
LLInventoryModel
::
EXCLUDE_TRASH
);
// Check if you already have an "Imported Library Clothing" folder
for
(
LLInventoryModel
::
cat_array_t
::
const_iterator
iter
=
cat_array
.
begin
();
iter
!=
cat_array
.
end
();
++
iter
)
{
const
LLViewerInventoryCategory
*
cat
=
iter
->
get
();
if
(
cat
->
getName
()
==
mImportedClothingName
)
{
mImportedClothingID
=
cat
->
getUUID
();
}
}
}
}
mCompleteFolders
.
clear
();
mCompleteFolders
.
clear
();
fetchDescendents
(
folders
);
if
(
isEverythingComplete
())
{
done
();
}
}
class
LLLibraryOutfitsCopyDone
:
public
LLInventoryCallback
{
public:
LLLibraryOutfitsCopyDone
(
LLLibraryOutfitsFetch
*
fetcher
)
:
mFireCount
(
0
),
mLibraryOutfitsFetcher
(
fetcher
)
{
}
virtual
~
LLLibraryOutfitsCopyDone
()
{
if
(
mLibraryOutfitsFetcher
)
{
gInventory
.
addObserver
(
mLibraryOutfitsFetcher
);
mLibraryOutfitsFetcher
->
done
();
}
}
/* virtual */
void
fire
(
const
LLUUID
&
inv_item
)
{
mFireCount
++
;
}
private
:
U32
mFireCount
;
LLLibraryOutfitsFetch
*
mLibraryOutfitsFetcher
;
};
mCurrFetchStep
=
LOFS_CONTENTS
;
void
LLLibraryOutfitsFetch
::
libraryDone
(
void
)
{
// Copy the clothing folders from the library into the imported clothing folder if necessary.
if
(
mImportedClothingID
==
LLUUID
::
null
)
{
gInventory
.
removeObserver
(
this
);
LLPointer
<
LLInventoryCallback
>
copy_waiter
=
new
LLLibraryOutfitsCopyDone
(
this
);
mImportedClothingID
=
gInventory
.
createNewCategory
(
mClothingID
,
LLFolderType
::
FT_NONE
,
mImportedClothingName
);
for
(
cloth_folder_vec_t
::
const_iterator
iter
=
mLibraryClothingFolders
.
begin
();
iter
!=
mLibraryClothingFolders
.
end
();
++
iter
)
{
LLUUID
folder_id
=
gInventory
.
createNewCategory
(
mImportedClothingID
,
LLFolderType
::
FT_NONE
,
iter
->
second
);
LLAppearanceManager
::
getInstance
()
->
shallowCopyCategory
(
iter
->
first
,
folder_id
,
copy_waiter
);
}
}
else
{
// Skip straight to fetching the contents of the imported folder
importedFolderFetch
();
}
}
void
LLLibraryOutfitsFetch
::
importedFolderFetch
(
void
)
{
// Fetch the contents of the Imported Clothing Folder
LLInventoryFetchDescendentsObserver
::
folder_ref_t
folders
;
folders
.
push_back
(
mImportedClothingID
);
mCompleteFolders
.
clear
();
fetchDescendents
(
folders
);
fetchDescendents
(
folders
);
if
(
isEverythingComplete
())
{
done
();
}
}
}
void
LLLibraryOutfitsFetch
::
contents
Done
(
void
)
void
LLLibraryOutfitsFetch
::
importedFolder
Done
(
void
)
{
{
for
(
S32
i
=
0
;
i
<
(
S32
)
mOutfits
.
size
();
++
i
)
LLInventoryModel
::
cat_array_t
cat_array
;
LLInventoryModel
::
item_array_t
wearable_array
;
LLInventoryFetchDescendentsObserver
::
folder_ref_t
folders
;
// Collect the contents of the Imported Clothing folder
gInventory
.
collectDescendents
(
mImportedClothingID
,
cat_array
,
wearable_array
,
LLInventoryModel
::
EXCLUDE_TRASH
);
for
(
LLInventoryModel
::
cat_array_t
::
const_iterator
iter
=
cat_array
.
begin
();
iter
!=
cat_array
.
end
();
++
iter
)
{
const
LLViewerInventoryCategory
*
cat
=
iter
->
get
();
// Get the name of every imported outfit
folders
.
push_back
(
cat
->
getUUID
());
mImportedClothingFolders
.
push_back
(
std
::
make_pair
(
cat
->
getUUID
(),
cat
->
getName
()));
}
mCompleteFolders
.
clear
();
fetchDescendents
(
folders
);
if
(
isEverythingComplete
())
{
done
();
}
}
void
LLLibraryOutfitsFetch
::
contentsDone
(
void
)
{
LLInventoryModel
::
cat_array_t
cat_array
;
LLInventoryModel
::
item_array_t
wearable_array
;
for
(
cloth_folder_vec_t
::
const_iterator
folder_iter
=
mImportedClothingFolders
.
begin
();
folder_iter
!=
mImportedClothingFolders
.
end
();
++
folder_iter
)
{
{
// First, make a folder in the My Outfits directory.
// First, make a folder in the My Outfits directory.
const
LLUUID
parent_id
=
gInventory
.
findCategoryUUIDForType
(
LLFolderType
::
FT_MY_OUTFITS
);
LLUUID
new_outfit_folder_id
=
gInventory
.
createNewCategory
(
mMyOutfitsID
,
LLFolderType
::
FT_OUTFIT
,
folder_iter
->
second
);
LLUUID
folder_id
=
gInventory
.
createNewCategory
(
parent_id
,
LLFolderType
::
FT_OUTFIT
,
cat_array
.
clear
();
mOutfits
[
i
].
second
);
wearable_array
.
clear
();
LLAppearanceManager
::
getInstance
()
->
shallowCopyCategory
(
mOutfits
[
i
].
first
,
folder_id
,
NULL
);
// Collect the contents of each imported clothing folder, so we can create new outfit links for it
gInventory
.
collectDescendents
(
folder_iter
->
first
,
cat_array
,
wearable_array
,
LLInventoryModel
::
EXCLUDE_TRASH
);
for
(
LLInventoryModel
::
item_array_t
::
const_iterator
wearable_iter
=
wearable_array
.
begin
();
wearable_iter
!=
wearable_array
.
end
();
++
wearable_iter
)
{
const
LLViewerInventoryItem
*
item
=
wearable_iter
->
get
();
link_inventory_item
(
gAgent
.
getID
(),
item
->
getLinkedUUID
(),
new_outfit_folder_id
,
item
->
getName
(),
LLAssetType
::
AT_LINK
,
NULL
);
}
}
}
mOutfitsPopulated
=
true
;
mOutfitsPopulated
=
true
;
}
}
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment