Enable JsonModelPlugin by default as a test

This commit is contained in:
Lucien Greathouse
2018-01-02 15:41:10 -08:00
parent d7e2a3542c
commit 73117edbe7
3 changed files with 31 additions and 2 deletions

View File

@@ -34,7 +34,7 @@ use core::Config;
use pathext::canonicalish;
use project::{Project, ProjectLoadError};
use plugin::{PluginChain};
use plugins::{DefaultPlugin, ScriptPlugin};
use plugins::{DefaultPlugin, JsonModelPlugin, ScriptPlugin};
use vfs::Vfs;
use vfs_watch::VfsWatcher;
@@ -153,6 +153,7 @@ fn main() {
lazy_static! {
static ref PLUGIN_CHAIN: PluginChain = PluginChain::new(vec![
Box::new(ScriptPlugin::new()),
Box::new(JsonModelPlugin::new()),
Box::new(DefaultPlugin::new()),
]);
}

View File

@@ -29,7 +29,11 @@ impl Plugin for JsonModelPlugin {
let mut rbx_item: RbxItem = match serde_json::from_str(contents) {
Ok(v) => v,
Err(_) => return TransformFileResult::Pass, // This should be an error in the future
Err(_) => {
eprintln!("Unable to parse JSON Model File named {}", name);
return TransformFileResult::Pass; // This should be an error in the future!
},
};
rbx_item.properties.insert("Name".to_string(), RbxValue::String {

View File

@@ -0,0 +1,24 @@
{
"name": "hello",
"className": "Model",
"children": [
{
"name": "Some Part",
"className": "Part",
"children": [],
"properties": {}
},
{
"name": "Some StringValue",
"className": "StringValue",
"children": [],
"properties": {
"Value": {
"type": "string",
"value": "Hello, world!"
}
}
}
],
"properties": {}
}