Custom brush nodes
This commit is contained in:
@@ -78,7 +78,9 @@ class ArmBridge {
|
||||
public static var Path = arm.sys.Path;
|
||||
public static var File = arm.sys.File;
|
||||
public static var NodesMaterial = arm.node.NodesMaterial;
|
||||
public static var NodesBrush = arm.node.NodesBrush;
|
||||
public static var Material = arm.node.Material;
|
||||
public static var Brush = arm.node.Brush;
|
||||
public static var UISidebar = arm.ui.UISidebar;
|
||||
public static var UINodes = arm.ui.UINodes;
|
||||
public static var UIFiles = arm.ui.UIFiles;
|
||||
|
||||
@@ -2,8 +2,9 @@ package arm.node;
|
||||
|
||||
import zui.Nodes;
|
||||
|
||||
class Logic {
|
||||
class Brush {
|
||||
|
||||
public static var customNodes = untyped __js__("new Map()");
|
||||
static var nodes: Array<TNode>;
|
||||
static var links: Array<TNodeLink>;
|
||||
|
||||
@@ -11,7 +12,7 @@ class Logic {
|
||||
static var parsed_labels: Map<String, String> = null;
|
||||
static var nodeMap: Map<String, LogicNode>;
|
||||
|
||||
public static var packageName = "arm.node.logic";
|
||||
public static var packageName = "arm.node.brush";
|
||||
|
||||
public static function getNode(id: Int): TNode {
|
||||
for (n in nodes) if (n.id == id) return n;
|
||||
@@ -218,6 +219,11 @@ class Logic {
|
||||
}
|
||||
|
||||
static function createClassInstance(className: String, args: Array<Dynamic>): Dynamic {
|
||||
if (customNodes.get(className) != null) {
|
||||
var node = new LogicNode(args[0]);
|
||||
untyped node.get = customNodes.get(className);
|
||||
return node;
|
||||
}
|
||||
var cname = Type.resolveClass(packageName + "." + className);
|
||||
if (cname == null) return null;
|
||||
return Type.createInstance(cname, args);
|
||||
@@ -161,7 +161,6 @@ class MaterialParser {
|
||||
}
|
||||
|
||||
public static function parseBrush() {
|
||||
Logic.packageName = "arm.node.brush";
|
||||
Logic.parse(Context.brush.canvas, false);
|
||||
Brush.parse(Context.brush.canvas, false);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -189,6 +189,9 @@ class RenderUtil {
|
||||
|
||||
if (RenderPathPaint.liveLayerLocked) return;
|
||||
|
||||
var current = @:privateAccess kha.graphics4.Graphics2.current;
|
||||
if (current != null) current.end();
|
||||
|
||||
// Prepare layers
|
||||
if (RenderPathPaint.liveLayer == null) {
|
||||
RenderPathPaint.liveLayer = new arm.data.LayerSlot("_live");
|
||||
@@ -366,5 +369,7 @@ class RenderUtil {
|
||||
|
||||
Context.brush.previewReady = true;
|
||||
Context.brushBlendDirty = true;
|
||||
|
||||
if (current != null) current.begin(false);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user