添加构建样例 [无paint动作]

dev-VirtualTexture
白封羽 2022-12-16 21:44:46 +08:00
parent d5a6c3e3ee
commit f3b0a3069c
7 changed files with 314 additions and 49 deletions

View File

@ -137,6 +137,7 @@
<QtUic Include="RendererWidget.ui" /> <QtUic Include="RendererWidget.ui" />
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<None Include="..\data.json" />
<None Include="darkstyle.qss" /> <None Include="darkstyle.qss" />
<None Include="lightstyle.qss" /> <None Include="lightstyle.qss" />
<None Include="Shaders\depth_init.comp" /> <None Include="Shaders\depth_init.comp" />

View File

@ -232,6 +232,7 @@
<None Include="lightstyle.qss"> <None Include="lightstyle.qss">
<Filter>Resource Files</Filter> <Filter>Resource Files</Filter>
</None> </None>
<None Include="..\data.json" />
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<QtUic Include="EditorWidget.ui"> <QtUic Include="EditorWidget.ui">

View File

@ -4,7 +4,17 @@ EditorWidget::EditorWidget(QWidget *parent) : QWidget(parent)
{ {
ui.setupUi(this); ui.setupUi(this);
previewWindow = ui.Preview; previewWindow = ui.Preview;
QJsonObject source; // test
QFile settingFile;
settingFile.setFileName("../data.json");
settingFile.open(QFile::ReadOnly);
QByteArray setting = settingFile.readAll().trimmed();
QJsonParseError jError;
QJsonDocument jsonDoc(QJsonDocument::fromJson(setting,&jError));
qDebug() << jsonDoc.object().value("height").toDouble();
qDebug() << jError.errorString();
// end test
QJsonObject source=jsonDoc.object();
elementManager = new ElementManager(source); elementManager = new ElementManager(source);
layerManager = new LayerManager(source, elementManager); layerManager = new LayerManager(source, elementManager);
previewWindow->initialize(layerManager); previewWindow->initialize(layerManager);

View File

@ -2,6 +2,7 @@
ElementManager::ElementManager(QJsonObject source) ElementManager::ElementManager(QJsonObject source)
{ {
auto elementsJson = source.value("elements").toArray(); auto elementsJson = source.value("elements").toArray();
qDebug() << elementsJson.size();
for (auto elementJson : elementsJson) for (auto elementJson : elementsJson)
{ {
if (elementJson.toObject().value("type") == "group") if (elementJson.toObject().value("type") == "group")

View File

@ -30,6 +30,7 @@ LayerWrapper::LayerWrapper(QJsonObject json, LayerWrapper *parent)
FolderLayerWrapper::FolderLayerWrapper(QJsonObject json, ElementManager *elementManager, LayerWrapper *parent) FolderLayerWrapper::FolderLayerWrapper(QJsonObject json, ElementManager *elementManager, LayerWrapper *parent)
: LayerWrapper(json, parent) : LayerWrapper(json, parent)
{ {
qDebug() << json.value("name").toString();
QJsonArray childrenJson = json.value("children").toArray(); QJsonArray childrenJson = json.value("children").toArray();
QJsonValue referencedJson = json.value("referenced-by"); QJsonValue referencedJson = json.value("referenced-by");
if (!referencedJson.isNull()) if (!referencedJson.isNull())
@ -52,6 +53,7 @@ FolderLayerWrapper::FolderLayerWrapper(QJsonObject json, ElementManager *element
LeafLayerWrapper::LeafLayerWrapper(QJsonObject json, ElementManager *elementManager, LayerWrapper *parent) LeafLayerWrapper::LeafLayerWrapper(QJsonObject json, ElementManager *elementManager, LayerWrapper *parent)
: LayerWrapper(json, parent) : LayerWrapper(json, parent)
{ {
qDebug() << json.value("name").toString();
int elementIndex = json.value("element").toInt(); int elementIndex = json.value("element").toInt();
wrappedElement = elementManager->getElementById(elementIndex); wrappedElement = elementManager->getElementById(elementIndex);
} }

View File

@ -1,26 +0,0 @@
{
"elements":[
{
"type":"polygon",
"data":{
"points":[{"x":20,"y":30},{"x":20,"y":50},{"x":50,"y":100},{"x":20,"y":30}]
}
},
{
"type":"polygon",
"data":{
"points":[{"x":100,"y":100},{"x":100,"y":500},{"x":500,"y":500},{"x":100,"y":100}]
}
},
{
"type":"round",
"data":{
"x-axis":500,
"y-axis":500,
"angle":360
}
}
]
}

320
data.json
View File

@ -1,26 +1,302 @@
{ {
"elements":[ "height": 1080,
{ "width": 1080,
"type":"polygon", "elements": [
"data":{ {
"points":[{"x":20,"y":30},{"x":20,"y":50},{"x":50,"y":100},{"x":20,"y":30}] "type": "path",
} "data": {
}, "operations": [
{ {
"type":"polygon", "type": "line",
"data":{ "data": {
"points":[{"x":100,"y":100},{"x":100,"y":500},{"x":500,"y":500},{"x":100,"y":100}] "target": {
} "x": 15,
}, "y": 20
{ }
"type":"round", }
"data":{ },
"x-axis":500, {
"y-axis":500, "type": "cubic",
"angle":360 "data": {
"target": {
"x": 18,
"y": 21
},
"control": {
"start": {
"x": 17,
"y": 22
},
"end": {
"x": 20,
"y": 23
}
}
}
},
{
"type": "cubic-smooth",
"data": {
"target": {
"x": 18,
"y": 21
},
"control": {
"x": 18,
"y": 21
}
}
},
{
"type": "quadratic",
"data": {
"target": {
"x": 18,
"y": 21
},
"control": {
"x": 18,
"y": 21
}
}
},
{
"type": "quadratic-smooth",
"data": {
"target": {
"x": 18,
"y": 21
}
}
},
{
"type": "arc",
"data": {
"center": {
"x": 18,
"y": 21
},
"x-axis": 40,
"y-axis": 50,
"angle": 60
}
},
{
"type": "zeal"
}
]
}
},
{
"type": "polygon",
"data": {
"points": [
{
"x": 10,
"y": 20
},
{
"x": 10,
"y": 20
},
{
"x": 10,
"y": 20
},
{
"x": 10,
"y": 20
},
{
"x": 10,
"y": 20
}
]
}
},
{
"type": "round",
"data": {
"x-axis": 30,
"y-axis": 40
}
},
{
"type": "group",
"data": {
"reference-layer": "0.0"
}
} }
],
"root-layer": {
"name": "root",
"offset": {
"x": 0,
"y": 0
},
"transformation": [
0,
0,
0,
0,
0,
0,
0,
0,
0
],
"effects": [],
"is-folder": true,
"referenced-by": null,
"children": [
{
"name": "GroupFolderExample",
"offset": {
"x": 5,
"y": 10
},
"transformation": [
0,
0,
0,
0,
0,
0,
0,
0,
0
],
"effects": [
{
"type": "iterate",
"data": {
"time": 5,
"operations": [
{
"type": "move",
"data": {
"offset": {
"x": 5,
"y": 6
}
}
},
{
"type": "rotate",
"data": {
"center-offset": {
"x": 0,
"y": 0
},
"angle": 60
}
},
{
"type": "zoom",
"data": {
"zoom": 1.5
}
},
{
"type": "flip",
"data": {
"k": 1.2,
"b": 3
}
}
]
}
}
],
"is-folder": true,
"referenced-by": 3,
"children": [
{
"name": "GroupedLayer1",
"offset": {
"x": 10,
"y": 20
},
"transformation": [
5,
0,
0,
0,
6,
0,
0,
0,
0
],
"effects": [],
"is-folder": false,
"element": 0
},
{
"name": "GroupedLayer2",
"offset": {
"x": 15,
"y": 25
},
"transformation": [
5,
0,
0,
0,
6,
0,
0,
0,
0
],
"effects": [],
"is-folder": false,
"element": 1
}
]
},
{
"name": "ReferencingGroupLayer",
"offset": {
"x": 10,
"y": 20
},
"transformation": [
5,
0,
0,
0,
6,
0,
0,
0,
0
],
"effects": [],
"is-folder": false,
"element": 3
},
{
"name": "Layer1",
"offset": {
"x": 10,
"y": 20
},
"transformation": [
5,
0,
0,
0,
6,
0,
0,
0,
0
],
"effects": [],
"is-folder": false,
"element": 3
}
]
} }
]
} }