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
8ec9713b
Commit
8ec9713b
authored
Dec 21, 2015
by
Yumin Yuan
Browse files
Modified some tags in session exporting and importing
parent
8ff0325e
Changes
7
Hide whitespace changes
Inline
Side-by-side
smtk/io/ExportJSON.cxx
View file @
8ec9713b
...
...
@@ -520,6 +520,7 @@ int ExportJSON::forManagerSessionPartial(const smtk::common::UUID& sessionid,
cJSON
*
sess
=
cJSON_CreateObject
();
cJSON_AddItemToObject
(
node
,
sessionid
.
toString
().
c_str
(),
sess
);
cJSON_AddStringToObject
(
sess
,
"type"
,
"session"
);
cJSON_AddStringToObject
(
sess
,
"name"
,
session
->
name
().
c_str
());
SessionIOJSONPtr
delegate
=
...
...
smtk/io/ImportJSON.cxx
View file @
8ec9713b
...
...
@@ -827,24 +827,8 @@ int ImportJSON::ofLocalSession(cJSON* node, ManagerPtr context)
sref
.
session
()
->
createIODelegate
(
"json"
));
if
(
delegate
)
{
status
=
delegate
->
importJSON
(
context
,
sref
.
session
(),
node
);
}
return
status
;
}
/**\brief Create local sessions and import JSON into the sessions.
*
* This iterates over the session child nodes in parent json \a node,
* and then call ofLocalSession to import the json description into
* each session.
*/
int
ImportJSON
::
ofLocalSessions
(
cJSON
*
node
,
ManagerPtr
context
)
{
int
status
=
0
;
cJSON
*
sessentry
;
for
(
sessentry
=
node
->
child
;
sessentry
;
sessentry
=
sessentry
->
next
)
{
status
&=
ImportJSON
::
ofLocalSession
(
sessentry
,
context
);
status
=
1
;
//status = delegate->importJSON(context, sref.session(), node);
}
return
status
;
}
...
...
smtk/io/ImportJSON.h
View file @
8ec9713b
...
...
@@ -46,7 +46,6 @@ public:
static
int
forManagerMeshes
(
smtk
::
mesh
::
ManagerPtr
meshes
,
cJSON
*
,
smtk
::
model
::
ManagerPtr
modelMgr
);
static
int
ofRemoteSession
(
cJSON
*
,
smtk
::
model
::
DefaultSessionPtr
destSession
,
smtk
::
model
::
ManagerPtr
context
);
static
int
ofLocalSession
(
cJSON
*
,
smtk
::
model
::
ManagerPtr
context
);
static
int
ofLocalSessions
(
cJSON
*
,
smtk
::
model
::
ManagerPtr
context
);
static
int
ofOperator
(
cJSON
*
node
,
smtk
::
model
::
OperatorPtr
&
op
,
smtk
::
model
::
ManagerPtr
context
);
static
int
ofOperatorResult
(
cJSON
*
node
,
smtk
::
model
::
OperatorResult
&
resOut
,
smtk
::
model
::
RemoteOperatorPtr
op
);
...
...
smtk/model/SessionIOJSON.cxx
View file @
8ec9713b
...
...
@@ -49,10 +49,21 @@ int SessionIOJSON::importJSON(ManagerPtr modelMgr,
int
status
=
0
;
smtk
::
common
::
UUIDs
models
=
modelMgr
->
entitiesMatchingFlags
(
smtk
::
model
::
MODEL_ENTITY
);
cJSON
*
modelsObj
=
cJSON_GetObjectItem
(
sessionRec
,
"models"
);
if
(
!
modelsObj
)
{
smtkInfoMacro
(
modelMgr
->
log
(),
"Expecting a
\"
models
\"
entry!"
);
return
status
;
}
cJSON
*
modelentry
;
// import all model entites, should only have meta info
for
(
modelentry
=
sessionRec
->
child
;
modelentry
;
modelentry
=
modelentry
->
next
)
for
(
modelentry
=
modelsObj
->
child
;
modelentry
;
modelentry
=
modelentry
->
next
)
{
if
(
!
modelentry
->
string
||
!
modelentry
->
string
[
0
])
continue
;
smtk
::
common
::
UUID
modelid
=
smtk
::
common
::
UUID
(
modelentry
->
string
);
if
(
modelid
.
isNull
())
{
...
...
@@ -132,6 +143,9 @@ int SessionIOJSON::exportJSON(ManagerPtr modelMgr,
const
smtk
::
common
::
UUIDs
&
modelIds
,
cJSON
*
sessionRec
)
{
cJSON
*
jmodels
=
cJSON_CreateObject
();
cJSON_AddItemToObject
(
sessionRec
,
"models"
,
jmodels
);
// we will write each model seperately
smtk
::
common
::
UUIDs
::
const_iterator
modit
;
for
(
modit
=
modelIds
.
begin
();
modit
!=
modelIds
.
end
();
++
modit
)
...
...
@@ -159,7 +173,7 @@ int SessionIOJSON::exportJSON(ManagerPtr modelMgr,
// When writing a single collection, all its MeshSets will also be written out.
smtk
::
io
::
ExportJSON
::
forModelMeshes
(
*
modit
,
jmodel
,
modelMgr
);
cJSON_AddItemToObject
(
sessionRec
,
modit
->
toString
().
c_str
(),
jmodel
);
cJSON_AddItemToObject
(
jmodels
,
modit
->
toString
().
c_str
(),
jmodel
);
}
return
1
;
}
...
...
smtk/model/operators/ExportSMTKModel.cxx
View file @
8ec9713b
...
...
@@ -61,7 +61,7 @@ smtk::model::OperatorResult ExportSMTKModel::operateInternal()
}
cJSON
*
top
=
cJSON_CreateObject
();
cJSON_AddItemToObject
(
top
,
"type"
,
cJSON_CreateString
(
"Session"
));
cJSON_AddItemToObject
(
top
,
"type"
,
cJSON_CreateString
(
"
SMTK_
Session"
));
// Add the output smtk model name to the model "smtk_url", so that the individual session can
// use that name to construct a filename for saving native models of the session.
...
...
smtk/model/operators/ImportSMTKModel.cxx
View file @
8ec9713b
...
...
@@ -75,9 +75,9 @@ smtk::model::OperatorResult ImportSMTKModel::operateInternal()
{
cJSON
*
mtyp
=
cJSON_GetObjectItem
(
root
,
"type"
);
if
(
mtyp
&&
mtyp
->
type
==
cJSON_String
&&
mtyp
->
valuestring
&&
!
strcmp
(
mtyp
->
valuestring
,
"Session"
))
!
strcmp
(
mtyp
->
valuestring
,
"
SMTK_
Session"
))
{
status
=
smtk
::
io
::
ImportJSON
::
ofLocalSession
s
(
root
,
this
->
manager
());
status
=
smtk
::
io
::
ImportJSON
::
ofLocalSession
(
root
->
child
,
this
->
manager
());
}
}
...
...
smtk/typesystem.xml
View file @
8ec9713b
...
...
@@ -101,7 +101,6 @@
<suppress-warning
text=
"skipping function 'smtk::io::ImportJSON::ofManagerStringProperties', unmatched parameter type 'cJSON*'"
/>
<suppress-warning
text=
"skipping function 'smtk::io::ImportJSON::ofManagerTessellation', unmatched parameter type 'cJSON*'"
/>
<suppress-warning
text=
"skipping function 'smtk::io::ImportJSON::ofLocalSession', unmatched parameter type 'cJSON*'"
/>
<suppress-warning
text=
"skipping function 'smtk::io::ImportJSON::ofLocalSessions', unmatched parameter type 'cJSON*'"
/>
<suppress-warning
text=
"skipping function 'smtk::io::ImportJSON::ofLog', unmatched parameter type 'cJSON*'"
/>
<suppress-warning
text=
"skipping function 'smtk::io::ImportJSON::ofMeshesOfModel', unmatched parameter type 'cJSON*'"
/>
<suppress-warning
text=
"skipping function 'smtk::io::ImportJSON::ofRemoteSession', unmatched parameter type 'cJSON*'"
/>
...
...
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