Merge branch 'master' of https://github.com/armory3d/armorpaint
This commit is contained in:
+2
-1
@@ -461,8 +461,9 @@ class App {
|
|||||||
Krom.setMouseCursor(0); // Arrow
|
Krom.setMouseCursor(0); // Arrow
|
||||||
isDragging = false;
|
isDragging = false;
|
||||||
}
|
}
|
||||||
if (Context.colorPickerCallback != null && mouse.released()) {
|
if (Context.colorPickerCallback != null && (mouse.released() || mouse.released("right"))) {
|
||||||
Context.colorPickerCallback = null;
|
Context.colorPickerCallback = null;
|
||||||
|
Context.selectTool(Context.colorPickerPreviousTool);
|
||||||
}
|
}
|
||||||
|
|
||||||
handleDropPaths();
|
handleDropPaths();
|
||||||
|
|||||||
@@ -66,6 +66,7 @@ class Context {
|
|||||||
public static var swatch: TSwatchColor;
|
public static var swatch: TSwatchColor;
|
||||||
public static var pickedColor: TSwatchColor = Project.makeSwatch();
|
public static var pickedColor: TSwatchColor = Project.makeSwatch();
|
||||||
public static var colorPickerCallback: TSwatchColor->Void = null;
|
public static var colorPickerCallback: TSwatchColor->Void = null;
|
||||||
|
public static var colorPickerPreviousTool = ToolBrush;
|
||||||
public static var materialIdPicked = 0;
|
public static var materialIdPicked = 0;
|
||||||
public static var uvxPicked = 0.0;
|
public static var uvxPicked = 0.0;
|
||||||
public static var uvyPicked = 0.0;
|
public static var uvyPicked = 0.0;
|
||||||
|
|||||||
@@ -132,20 +132,26 @@ class TabSwatches {
|
|||||||
h.color = Context.swatch.base;
|
h.color = Context.swatch.base;
|
||||||
|
|
||||||
Context.swatch.base = zui.Ext.colorWheel(ui, h, false, null, 11 * ui.t.ELEMENT_H * ui.SCALE(), true, function () {
|
Context.swatch.base = zui.Ext.colorWheel(ui, h, false, null, 11 * ui.t.ELEMENT_H * ui.SCALE(), true, function () {
|
||||||
|
Context.colorPickerPreviousTool = Context.tool;
|
||||||
Context.selectTool(ToolPicker);
|
Context.selectTool(ToolPicker);
|
||||||
Context.colorPickerCallback = function (color: TSwatchColor) {
|
Context.colorPickerCallback = function (color: TSwatchColor) {
|
||||||
Project.raw.swatches[i].base = color.base;
|
Project.raw.swatches[i] = Project.cloneSwatch(color);
|
||||||
};
|
};
|
||||||
});
|
});
|
||||||
var hopacity = Id.handle({ value: Context.swatch.opacity });
|
var hopacity = Id.handle();
|
||||||
|
hopacity.value = Context.swatch.opacity;
|
||||||
Context.swatch.opacity = ui.slider(hopacity, "Opacity", 0, 1, true);
|
Context.swatch.opacity = ui.slider(hopacity, "Opacity", 0, 1, true);
|
||||||
var hocclusion = Id.handle({ value: Context.swatch.occlusion });
|
var hocclusion = Id.handle();
|
||||||
|
hocclusion.value = Context.swatch.occlusion;
|
||||||
Context.swatch.occlusion = ui.slider(hocclusion, "Occlusion", 0, 1, true);
|
Context.swatch.occlusion = ui.slider(hocclusion, "Occlusion", 0, 1, true);
|
||||||
var hroughness = Id.handle({ value: Context.swatch.roughness });
|
var hroughness = Id.handle();
|
||||||
|
hroughness.value = Context.swatch.roughness;
|
||||||
Context.swatch.roughness = ui.slider(hroughness, "Roughness", 0, 1, true);
|
Context.swatch.roughness = ui.slider(hroughness, "Roughness", 0, 1, true);
|
||||||
var hmetallic = Id.handle({ value: Context.swatch.metallic });
|
var hmetallic = Id.handle();
|
||||||
|
hmetallic.value = Context.swatch.metallic;
|
||||||
Context.swatch.metallic = ui.slider(hmetallic, "Metallic", 0, 1, true);
|
Context.swatch.metallic = ui.slider(hmetallic, "Metallic", 0, 1, true);
|
||||||
var hheight = Id.handle({ value: Context.swatch.height });
|
var hheight = Id.handle();
|
||||||
|
hheight.value = Context.swatch.height;
|
||||||
Context.swatch.height = ui.slider(hheight, "Height", 0, 1, true);
|
Context.swatch.height = ui.slider(hheight, "Height", 0, 1, true);
|
||||||
|
|
||||||
if (ui.changed || ui.isTyping) UIMenu.keepOpen = true;
|
if (ui.changed || ui.isTyping) UIMenu.keepOpen = true;
|
||||||
|
|||||||
@@ -683,6 +683,7 @@ class UINodes {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (nodes.colorPickerCallback != null) {
|
if (nodes.colorPickerCallback != null) {
|
||||||
|
Context.colorPickerPreviousTool = Context.tool;
|
||||||
Context.selectTool(ToolPicker);
|
Context.selectTool(ToolPicker);
|
||||||
var tmp = nodes.colorPickerCallback;
|
var tmp = nodes.colorPickerCallback;
|
||||||
Context.colorPickerCallback = function(color: TSwatchColor) {
|
Context.colorPickerCallback = function(color: TSwatchColor) {
|
||||||
|
|||||||
@@ -815,7 +815,7 @@ class UISidebar {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Show picked material next to cursor
|
// Show picked material next to cursor
|
||||||
if (Context.tool == ToolPicker && Context.pickerSelectMaterial) {
|
if (Context.tool == ToolPicker && Context.pickerSelectMaterial && Context.colorPickerCallback == null) {
|
||||||
var img = Context.material.imageIcon;
|
var img = Context.material.imageIcon;
|
||||||
#if kha_opengl
|
#if kha_opengl
|
||||||
g.drawScaledImage(img, mx + 10, my + 10 + img.height, img.width, -img.height);
|
g.drawScaledImage(img, mx + 10, my + 10 + img.height, img.width, -img.height);
|
||||||
@@ -823,6 +823,12 @@ class UISidebar {
|
|||||||
g.drawImage(img, mx + 10, my + 10);
|
g.drawImage(img, mx + 10, my + 10);
|
||||||
#end
|
#end
|
||||||
}
|
}
|
||||||
|
if (Context.tool == ToolPicker && Context.colorPickerCallback != null) {
|
||||||
|
var img = Res.get("icons.k");
|
||||||
|
var rect = Res.tile50(img, ToolPicker, 0);
|
||||||
|
|
||||||
|
g.drawSubImage(img, mx + 10, my + 10, rect.x, rect.y, rect.w, rect.h);
|
||||||
|
}
|
||||||
|
|
||||||
var cursorImg = Res.get("cursor.k");
|
var cursorImg = Res.get("cursor.k");
|
||||||
var psize = Std.int(cursorImg.width * (Context.brushRadius * Context.brushNodesRadius) * ui.SCALE());
|
var psize = Std.int(cursorImg.width * (Context.brushRadius * Context.brushNodesRadius) * ui.SCALE());
|
||||||
|
|||||||
Reference in New Issue
Block a user