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
fcb17af2
Commit
fcb17af2
authored
2 years ago
by
Rye Mutt
Browse files
Options
Downloads
Patches
Plain Diff
Fix shutdown crash
parent
5afe2ed9
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
indra/newview/llgltfmateriallist.cpp
+102
-94
102 additions, 94 deletions
indra/newview/llgltfmateriallist.cpp
with
102 additions
and
94 deletions
indra/newview/llgltfmateriallist.cpp
+
102
−
94
View file @
fcb17af2
...
@@ -223,100 +223,108 @@ class LLGLTFMaterialOverrideDispatchHandler : public LLDispatchHandler
...
@@ -223,100 +223,108 @@ class LLGLTFMaterialOverrideDispatchHandler : public LLDispatchHandler
bool
mSuccess
;
bool
mSuccess
;
};
};
// fromJson() is performance heavy offload to a thread.
try
main_queue
->
postTo
(
{
general_queue
,
// fromJson() is performance heavy offload to a thread.
[
object_override
]()
// Work done on general queue
main_queue
->
postTo
(
{
general_queue
,
std
::
vector
<
ReturnData
>
results
;
[
object_override
]()
// Work done on general queue
{
if
(
!
object_override
.
mSides
.
empty
())
std
::
vector
<
ReturnData
>
results
;
{
results
.
reserve
(
object_override
.
mSides
.
size
());
if
(
!
object_override
.
mSides
.
empty
())
// parse json
{
std
::
unordered_map
<
S32
,
std
::
string
>::
const_iterator
iter
=
object_override
.
mSides
.
begin
();
results
.
reserve
(
object_override
.
mSides
.
size
());
std
::
unordered_map
<
S32
,
std
::
string
>::
const_iterator
end
=
object_override
.
mSides
.
end
();
// parse json
while
(
iter
!=
end
)
std
::
unordered_map
<
S32
,
std
::
string
>::
const_iterator
iter
=
object_override
.
mSides
.
begin
();
{
std
::
unordered_map
<
S32
,
std
::
string
>::
const_iterator
end
=
object_override
.
mSides
.
end
();
LLPointer
<
LLGLTFMaterial
>
override_data
=
new
LLGLTFMaterial
();
while
(
iter
!=
end
)
std
::
string
warn_msg
,
error_msg
;
{
LLPointer
<
LLGLTFMaterial
>
override_data
=
new
LLGLTFMaterial
();
bool
success
=
override_data
->
fromJSON
(
iter
->
second
,
warn_msg
,
error_msg
);
std
::
string
warn_msg
,
error_msg
;
ReturnData
result
;
bool
success
=
override_data
->
fromJSON
(
iter
->
second
,
warn_msg
,
error_msg
);
result
.
mSuccess
=
success
;
result
.
mSide
=
iter
->
first
;
ReturnData
result
;
result
.
mSuccess
=
success
;
if
(
success
)
result
.
mSide
=
iter
->
first
;
{
result
.
mMaterial
=
override_data
;
if
(
success
)
}
{
else
result
.
mMaterial
=
override_data
;
{
}
LL_WARNS
(
"GLTF"
)
<<
"failed to parse GLTF override data. errors: "
<<
error_msg
<<
" | warnings: "
<<
warn_msg
<<
LL_ENDL
;
else
}
{
LL_WARNS
(
"GLTF"
)
<<
"failed to parse GLTF override data. errors: "
<<
error_msg
<<
" | warnings: "
<<
warn_msg
<<
LL_ENDL
;
results
.
push_back
(
result
);
}
iter
++
;
}
results
.
push_back
(
result
);
}
iter
++
;
return
results
;
}
},
}
[
object_override
,
this
](
std
::
vector
<
ReturnData
>
results
)
// Callback to main thread
return
results
;
{
},
LLViewerObject
*
obj
=
gObjectList
.
findObject
(
object_override
.
mObjectId
);
[
object_override
,
this
](
std
::
vector
<
ReturnData
>
results
)
// Callback to main thread
{
if
(
results
.
size
()
>
0
)
LLViewerObject
*
obj
=
gObjectList
.
findObject
(
object_override
.
mObjectId
);
{
std
::
unordered_set
<
S32
>
side_set
;
if
(
results
.
size
()
>
0
)
{
for
(
int
i
=
0
;
i
<
results
.
size
();
++
i
)
std
::
unordered_set
<
S32
>
side_set
;
{
if
(
results
[
i
].
mSuccess
)
for
(
int
i
=
0
;
i
<
results
.
size
();
++
i
)
{
{
// flag this side to not be nulled out later
if
(
results
[
i
].
mSuccess
)
side_set
.
insert
(
results
[
i
].
mSide
);
{
// flag this side to not be nulled out later
if
(
obj
)
side_set
.
insert
(
results
[
i
].
mSide
);
{
obj
->
setTEGLTFMaterialOverride
(
results
[
i
].
mSide
,
results
[
i
].
mMaterial
);
if
(
obj
)
}
{
}
obj
->
setTEGLTFMaterialOverride
(
results
[
i
].
mSide
,
results
[
i
].
mMaterial
);
}
// unblock material editor
}
if
(
obj
&&
obj
->
getTE
(
results
[
i
].
mSide
)
&&
obj
->
getTE
(
results
[
i
].
mSide
)
->
isSelected
())
{
// unblock material editor
doSelectionCallbacks
(
object_override
.
mObjectId
,
results
[
i
].
mSide
);
if
(
obj
&&
obj
->
getTE
(
results
[
i
].
mSide
)
&&
obj
->
getTE
(
results
[
i
].
mSide
)
->
isSelected
())
}
{
}
doSelectionCallbacks
(
object_override
.
mObjectId
,
results
[
i
].
mSide
);
}
if
(
obj
&&
side_set
.
size
()
!=
obj
->
getNumTEs
())
}
{
// object exists and at least one texture entry needs to have its override data nulled out
for
(
int
i
=
0
;
i
<
obj
->
getNumTEs
();
++
i
)
if
(
obj
&&
side_set
.
size
()
!=
obj
->
getNumTEs
())
{
{
// object exists and at least one texture entry needs to have its override data nulled out
if
(
side_set
.
find
(
i
)
==
side_set
.
end
())
for
(
int
i
=
0
;
i
<
obj
->
getNumTEs
();
++
i
)
{
{
obj
->
setTEGLTFMaterialOverride
(
i
,
nullptr
);
if
(
side_set
.
find
(
i
)
==
side_set
.
end
())
if
(
obj
->
getTE
(
i
)
&&
obj
->
getTE
(
i
)
->
isSelected
())
{
{
obj
->
setTEGLTFMaterialOverride
(
i
,
nullptr
);
doSelectionCallbacks
(
object_override
.
mObjectId
,
i
);
if
(
obj
->
getTE
(
i
)
&&
obj
->
getTE
(
i
)
->
isSelected
())
}
{
}
doSelectionCallbacks
(
object_override
.
mObjectId
,
i
);
}
}
}
}
}
}
else
if
(
obj
)
}
{
// override list was empty or an error occurred, null out all overrides for this object
}
for
(
int
i
=
0
;
i
<
obj
->
getNumTEs
();
++
i
)
else
if
(
obj
)
{
{
// override list was empty or an error occurred, null out all overrides for this object
obj
->
setTEGLTFMaterialOverride
(
i
,
nullptr
);
for
(
int
i
=
0
;
i
<
obj
->
getNumTEs
();
++
i
)
if
(
obj
->
getTE
(
i
)
&&
obj
->
getTE
(
i
)
->
isSelected
())
{
{
obj
->
setTEGLTFMaterialOverride
(
i
,
nullptr
);
doSelectionCallbacks
(
obj
->
getID
(),
i
);
if
(
obj
->
getTE
(
i
)
&&
obj
->
getTE
(
i
)
->
isSelected
())
}
{
}
doSelectionCallbacks
(
obj
->
getID
(),
i
);
}
}
});
}
}
});
}
catch
(
const
LLThreadSafeQueueInterrupt
&
)
{
// Shutdown
LL_WARNS
()
<<
"Tried to start decoding on shutdown"
<<
LL_ENDL
;
}
}
}
private
:
private
:
...
...
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