mirror of
https://github.com/rojo-rbx/rojo.git
synced 2026-04-25 07:06:12 +00:00
Enable JsonModelPlugin by default as a test
This commit is contained in:
@@ -34,7 +34,7 @@ use core::Config;
|
|||||||
use pathext::canonicalish;
|
use pathext::canonicalish;
|
||||||
use project::{Project, ProjectLoadError};
|
use project::{Project, ProjectLoadError};
|
||||||
use plugin::{PluginChain};
|
use plugin::{PluginChain};
|
||||||
use plugins::{DefaultPlugin, ScriptPlugin};
|
use plugins::{DefaultPlugin, JsonModelPlugin, ScriptPlugin};
|
||||||
use vfs::Vfs;
|
use vfs::Vfs;
|
||||||
use vfs_watch::VfsWatcher;
|
use vfs_watch::VfsWatcher;
|
||||||
|
|
||||||
@@ -153,6 +153,7 @@ fn main() {
|
|||||||
lazy_static! {
|
lazy_static! {
|
||||||
static ref PLUGIN_CHAIN: PluginChain = PluginChain::new(vec![
|
static ref PLUGIN_CHAIN: PluginChain = PluginChain::new(vec![
|
||||||
Box::new(ScriptPlugin::new()),
|
Box::new(ScriptPlugin::new()),
|
||||||
|
Box::new(JsonModelPlugin::new()),
|
||||||
Box::new(DefaultPlugin::new()),
|
Box::new(DefaultPlugin::new()),
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -29,7 +29,11 @@ impl Plugin for JsonModelPlugin {
|
|||||||
|
|
||||||
let mut rbx_item: RbxItem = match serde_json::from_str(contents) {
|
let mut rbx_item: RbxItem = match serde_json::from_str(contents) {
|
||||||
Ok(v) => v,
|
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 {
|
rbx_item.properties.insert("Name".to_string(), RbxValue::String {
|
||||||
|
|||||||
24
test-project/src/hello.model.json
Normal file
24
test-project/src/hello.model.json
Normal 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": {}
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user