Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
David Thompson
SMTK
Commits
048a0acf
Commit
048a0acf
authored
Jan 11, 2016
by
Yumin Yuan
Browse files
Dont overwrite url for existing model while importing smtk model
parent
99e021d6
Changes
1
Hide whitespace changes
Inline
Side-by-side
smtk/model/SessionIOJSON.cxx
View file @
048a0acf
...
...
@@ -44,7 +44,8 @@ int SessionIOJSON::importJSON(ManagerPtr modelMgr,
smtkInfoMacro
(
modelMgr
->
log
(),
"Expecting a
\"
models
\"
entry!"
);
return
0
;
}
std
::
map
<
smtk
::
common
::
UUID
,
std
::
string
>
existingURLs
;
cJSON
*
modelentry
;
// import all native models model entites, should only have meta info
for
(
modelentry
=
modelsObj
->
child
;
modelentry
;
modelentry
=
modelentry
->
next
)
...
...
@@ -104,9 +105,23 @@ int SessionIOJSON::importJSON(ManagerPtr modelMgr,
}
}
}
else
if
(
modelMgr
->
hasStringProperty
(
modelid
,
"url"
))
{
smtk
::
model
::
StringList
const
&
nprop
(
modelMgr
->
stringProperty
(
modelid
,
"url"
));
if
(
!
nprop
.
empty
())
{
existingURLs
[
modelid
]
=
nprop
[
0
];
}
}
}
int
status
=
this
->
loadModelsRecord
(
modelMgr
,
sessionRec
);
status
&=
this
->
loadMeshesRecord
(
modelMgr
,
sessionRec
);
// recover "url" property for models already loaded
std
::
map
<
smtk
::
common
::
UUID
,
std
::
string
>::
const_iterator
mit
;
for
(
mit
=
existingURLs
.
begin
();
mit
!=
existingURLs
.
end
();
++
mit
)
{
modelMgr
->
setStringProperty
(
mit
->
first
,
"url"
,
mit
->
second
);
}
return
status
;
}
...
...
Write
Preview
Supports
Markdown
0%
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!
Cancel
Please
register
or
sign in
to comment