Add pbr swatch feature to color picker
This commit is contained in:
@@ -584,6 +584,10 @@ class Project {
|
||||
return { base: base, opacity: 1.0, occlusion: 1.0, roughness: 0.0, metallic: 0.0, normal: 0xff8080ff, emission: 0.0, height: 0.0, subsurface: 0.0 };
|
||||
}
|
||||
|
||||
public static function cloneSwatch(swatch: TSwatchColor) : TSwatchColor {
|
||||
return { base: swatch.base, opacity: swatch.opacity, occlusion: swatch.occlusion, roughness: swatch.roughness, metallic: swatch.metallic, normal: swatch.normal, emission: swatch.emission, height: swatch.height, subsurface: swatch.subsurface };
|
||||
}
|
||||
|
||||
public static function setDefaultSwatches() {
|
||||
// 32-Color Palette by Andrew Kensler
|
||||
// http://eastfarthing.com/blog/2016-05-06-palette/
|
||||
|
||||
@@ -95,7 +95,7 @@ class UIHeader {
|
||||
var uiy = ui._y;
|
||||
App.dragOffX = -(mouse.x - uix - ui._windowX - 3);
|
||||
App.dragOffY = -(mouse.y - uiy - ui._windowY + 1);
|
||||
App.dragSwatch = Project.makeSwatch(h.color.value);
|
||||
App.dragSwatch = Project.cloneSwatch(Context.pickedColor);
|
||||
}
|
||||
if (ui.isHovered) ui.tooltip(tr("Drag and drop picked color to swatches, materials, layers or to the node editor."));
|
||||
if (ui.isHovered && ui.inputReleased) {
|
||||
@@ -107,7 +107,7 @@ class UIHeader {
|
||||
}, 10);
|
||||
}
|
||||
if (ui.button(tr("Add Swatch"))) {
|
||||
var newSwatch = Project.makeSwatch(Context.pickedColor.base);
|
||||
var newSwatch = Project.cloneSwatch(Context.pickedColor);
|
||||
Context.setSwatch(newSwatch);
|
||||
Project.raw.swatches.push(newSwatch);
|
||||
UIStatus.inst.statusHandle.redraws = 1;
|
||||
|
||||
Reference in New Issue
Block a user