Improve project import

This commit is contained in:
luboslenco
2019-03-23 12:59:39 +01:00
parent df528f95f0
commit f119ec753d
2 changed files with 12 additions and 7 deletions
+5 -2
View File
@@ -61,7 +61,7 @@ class Project {
for (m in UITrait.inst.materials) {
var c = Reflect.copy(UINodes.inst.canvasMap.get(m));
for (n in c.nodes) {
if (n.type == "TEX_IMAGE") {
if (n.type == "TEX_IMAGE") { // Convert image path from absolute to relative
n.buttons[0].data = toRelative(UITrait.inst.projectPath, n.buttons[0].data);
}
}
@@ -236,10 +236,13 @@ class Project {
UITrait.inst.materials = [];
for (n in project.material_nodes) {
for (node in n.nodes) {
if (node.type == "TEX_IMAGE") {
if (node.type == "TEX_IMAGE") { // Convert image path from relative to absolute
var abs = base + node.buttons[0].data;
node.buttons[0].data = abs;
}
for (inp in node.inputs) { // Round input socket values
if (inp.type == "VALUE") inp.default_value = Math.round(inp.default_value * 100) / 100;
}
}
var mat = new MaterialSlot(m0);
UINodes.inst.canvasMap.set(mat, n);
+7 -5
View File
@@ -1301,7 +1301,9 @@ class UITrait extends iron.Trait {
}
}
else {
brushRadius = ui.slider(brushRadiusHandle, "Radius", 0.0, 2.0, true);
if (selectedTool != ToolFill) {
brushRadius = ui.slider(brushRadiusHandle, "Radius", 0.0, 2.0, true);
}
if (selectedTool == ToolBrush ||
selectedTool == ToolFill ||
@@ -1319,7 +1321,7 @@ class UITrait extends iron.Trait {
brushOpacity = ui.slider(Id.handle({value: brushOpacity}), "Opacity", 0.0, 1.0, true);
if (selectedTool == ToolBrush || selectedTool == ToolEraser || selectedTool == ToolFill) {
if (selectedTool == ToolBrush || selectedTool == ToolEraser) {
brushHardness = ui.slider(Id.handle({value: brushHardness}), "Hardness", 0.0, 1.0, true);
}
if (selectedTool == ToolBrush || selectedTool == ToolEraser || selectedTool == ToolFill || selectedTool == ToolClone || selectedTool == ToolBlur) {
@@ -1337,7 +1339,7 @@ class UITrait extends iron.Trait {
}
if (selectedTool == ToolFill) {
ui.combo(fillTypeHandle, ["Object", "Face"], "Fill");
ui.combo(fillTypeHandle, ["Object", "Face"], "Fill Mode");
if (fillTypeHandle.changed) {
if (fillTypeHandle.position == 1) {
ui.g.end();
@@ -2305,9 +2307,9 @@ class UITrait extends iron.Trait {
ui.g.begin(false);
armory.data.Config.save();
}
ui.row([1/2, 1/2]);
// ui.row([1/2, 1/2]);
penPressure = ui.check(Id.handle({selected: penPressure}), "Pen Pressure");
instantMat = ui.check(Id.handle({selected: instantMat}), "Material Preview");
// instantMat = ui.check(Id.handle({selected: instantMat}), "Material Preview");
}
#if arm_debug