First commit
@@ -0,0 +1 @@
|
||||
uid://ievsqm6w1ks4
|
||||
@@ -0,0 +1,670 @@
|
||||
@tool
|
||||
class_name PdGeo
|
||||
## Static geometry helpers for Polydoodle.
|
||||
|
||||
|
||||
# ---------------------------------------------------------------- edges ---
|
||||
static func loop_edges(loop: PackedInt32Array) -> Array:
|
||||
var out: Array = []
|
||||
var n := loop.size()
|
||||
if n < 2:
|
||||
return out
|
||||
for i in n:
|
||||
var a := loop[i]
|
||||
var b := loop[(i + 1) % n]
|
||||
if a == b:
|
||||
continue
|
||||
out.append(Vector2i(mini(a, b), maxi(a, b)))
|
||||
return out
|
||||
|
||||
|
||||
static func unique_edges(faces: Array) -> Array:
|
||||
var seen := {}
|
||||
var out: Array = []
|
||||
for f in faces:
|
||||
for e in loop_edges(f):
|
||||
if not seen.has(e):
|
||||
seen[e] = true
|
||||
out.append(e)
|
||||
return out
|
||||
|
||||
|
||||
# -------------------------------------------------------------- normals ---
|
||||
static func face_normal(pts: PackedVector3Array) -> Vector3:
|
||||
# Newell's method; robust for concave loops.
|
||||
var n := Vector3.ZERO
|
||||
var c := pts.size()
|
||||
if c < 3:
|
||||
return Vector3.ZERO
|
||||
for i in c:
|
||||
var a := pts[i]
|
||||
var b := pts[(i + 1) % c]
|
||||
n.x += (a.y - b.y) * (a.z + b.z)
|
||||
n.y += (a.z - b.z) * (a.x + b.x)
|
||||
n.z += (a.x - b.x) * (a.y + b.y)
|
||||
if n.length() < 1e-9:
|
||||
return Vector3.ZERO
|
||||
return n.normalized()
|
||||
|
||||
|
||||
static func face_center(pts: PackedVector3Array) -> Vector3:
|
||||
var c := Vector3.ZERO
|
||||
for p in pts:
|
||||
c += p
|
||||
return c / float(maxi(1, pts.size()))
|
||||
|
||||
|
||||
# ------------------------------------------------------- triangulation ---
|
||||
## True when a triangle is safe to hand to CanvasItem.draw_polygon /
|
||||
## draw_colored_polygon. Godot triangulates those polygons internally and
|
||||
## prints "ERROR: Invalid polygon data, triangulation failed." for every
|
||||
## zero-area or NaN input - degenerate face triangles (a vertex dragged
|
||||
## through the mesh, bowtie quads) must be filtered out BEFORE drawing,
|
||||
## or the editor spams that error on every redraw.
|
||||
static func tri_drawable(a: Vector2, b: Vector2, c: Vector2) -> bool:
|
||||
if is_nan(a.x) or is_nan(a.y) or is_nan(b.x) or is_nan(b.y) \
|
||||
or is_nan(c.x) or is_nan(c.y):
|
||||
return false
|
||||
if a.distance_squared_to(b) < 1e-14 \
|
||||
or b.distance_squared_to(c) < 1e-14 \
|
||||
or a.distance_squared_to(c) < 1e-14:
|
||||
return false
|
||||
return absf((b - a).cross(c - a)) > 1e-4
|
||||
|
||||
|
||||
static func _signed_area2(p2: PackedVector2Array) -> float:
|
||||
var a := 0.0
|
||||
var n := p2.size()
|
||||
for i in n:
|
||||
var p := p2[i]
|
||||
var q := p2[(i + 1) % n]
|
||||
a += p.x * q.y - q.x * p.y
|
||||
return a * 0.5
|
||||
|
||||
|
||||
static func _point_in_tri(a: Vector2, b: Vector2, c: Vector2, p: Vector2) -> bool:
|
||||
var d1 := (b - a).cross(p - a)
|
||||
var d2 := (c - b).cross(p - b)
|
||||
var d3 := (a - c).cross(p - c)
|
||||
var has_neg := d1 < -1e-9 or d2 < -1e-9 or d3 < -1e-9
|
||||
var has_pos := d1 > 1e-9 or d2 > 1e-9 or d3 > 1e-9
|
||||
return not (has_neg and has_pos)
|
||||
|
||||
|
||||
static func triangulate(pts3: PackedVector3Array) -> PackedInt32Array:
|
||||
# Ear clipping projected onto the face plane; output winding follows
|
||||
# the polygon's own winding. Falls back to a fan for degenerate loops.
|
||||
var out := PackedInt32Array()
|
||||
var n := pts3.size()
|
||||
if n < 3:
|
||||
return out
|
||||
if n == 3:
|
||||
return PackedInt32Array([0, 1, 2])
|
||||
var nrm := face_normal(pts3)
|
||||
if nrm == Vector3.ZERO:
|
||||
for i in range(1, n - 1):
|
||||
out.append_array(PackedInt32Array([0, i, i + 1]))
|
||||
return out
|
||||
var u := Vector3.RIGHT
|
||||
for i in range(1, n):
|
||||
var t := pts3[i] - pts3[0]
|
||||
if t.length() > 1e-7:
|
||||
u = t.normalized()
|
||||
break
|
||||
var v := nrm.cross(u).normalized()
|
||||
var p2 := PackedVector2Array()
|
||||
p2.resize(n)
|
||||
for i in n:
|
||||
var d := pts3[i] - pts3[0]
|
||||
p2[i] = Vector2(d.dot(u), d.dot(v))
|
||||
# normalize winding to CCW and remember the remap
|
||||
var remap := PackedInt32Array()
|
||||
remap.resize(n)
|
||||
for i in n:
|
||||
remap[i] = i
|
||||
if _signed_area2(p2) < 0.0:
|
||||
p2.reverse()
|
||||
for i in n:
|
||||
remap[i] = n - 1 - i
|
||||
var tris: PackedInt32Array = _ear_clip(p2)["tris"]
|
||||
for t in tris:
|
||||
out.append(remap[t])
|
||||
return out
|
||||
|
||||
|
||||
static func _ear_clip(p2: PackedVector2Array) -> Dictionary:
|
||||
# Returns {"tris": PackedInt32Array, "complete": bool}. `complete` is
|
||||
# false when the clipper had to fall back to a fan (or finish a
|
||||
# leftover loop with one) - the caller uses that to decide whether to
|
||||
# attempt a self-intersection split.
|
||||
var n := p2.size()
|
||||
var idx := PackedInt32Array()
|
||||
idx.resize(n)
|
||||
for i in n:
|
||||
idx[i] = i
|
||||
var out := PackedInt32Array()
|
||||
var complete := true
|
||||
var guard := 0
|
||||
while idx.size() > 3 and guard < 4096:
|
||||
guard += 1
|
||||
var clipped := false
|
||||
var m := idx.size()
|
||||
for k in m:
|
||||
var i0 := idx[(k + m - 1) % m]
|
||||
var i1 := idx[k]
|
||||
var i2 := idx[(k + 1) % m]
|
||||
var a := p2[i0]
|
||||
var b := p2[i1]
|
||||
var c := p2[i2]
|
||||
if (b - a).cross(c - a) <= 1e-9:
|
||||
continue
|
||||
var ear := true
|
||||
for j in idx:
|
||||
var p := p2[j]
|
||||
if p == a or p == b or p == c:
|
||||
continue
|
||||
if _point_in_tri(a, b, c, p):
|
||||
ear = false
|
||||
break
|
||||
if ear:
|
||||
out.append_array(PackedInt32Array([i0, i1, i2]))
|
||||
idx.remove_at(k)
|
||||
clipped = true
|
||||
break
|
||||
if not clipped:
|
||||
complete = false
|
||||
break
|
||||
if idx.size() == 3:
|
||||
out.append_array(PackedInt32Array([idx[0], idx[1], idx[2]]))
|
||||
elif idx.size() > 3:
|
||||
# could not finish clipping (self-intersection or numerical
|
||||
# trouble): fan whatever loop is left so no vertex is lost
|
||||
complete = false
|
||||
var m := idx.size()
|
||||
for i in range(1, m - 1):
|
||||
out.append_array(PackedInt32Array([idx[0], idx[i], idx[i + 1]]))
|
||||
elif out.is_empty():
|
||||
# Degenerate loop: fan fallback.
|
||||
complete = false
|
||||
var m := p2.size()
|
||||
for i in range(1, m - 1):
|
||||
out.append_array(PackedInt32Array([0, i, i + 1]))
|
||||
return {"tris": out, "complete": complete}
|
||||
|
||||
|
||||
# ---------------------------------------------------- robust triangulation ---
|
||||
## Segment-segment intersection. Returns {"t","u"} with the crossing at
|
||||
## a + (b-a)*t == c + (d-c)*u, or {} when the segments do not cross.
|
||||
static func _seg_hit(a: Vector2, b: Vector2, c: Vector2, d: Vector2) -> Dictionary:
|
||||
var r := b - a
|
||||
var s := d - c
|
||||
var denom := r.cross(s)
|
||||
if absf(denom) < 1e-12:
|
||||
return {}
|
||||
var ac := c - a
|
||||
var t := ac.cross(s) / denom
|
||||
var u := ac.cross(r) / denom
|
||||
if t < -1e-9 or t > 1.0 + 1e-9 or u < -1e-9 or u > 1.0 + 1e-9:
|
||||
return {}
|
||||
return {"t": t, "u": u}
|
||||
|
||||
|
||||
## First self-crossing between two non-adjacent edges of a closed 2D loop.
|
||||
## Returns {"i","j","t"} (crossing on edge i at parameter t) or {}.
|
||||
static func _first_crossing(p2: PackedVector2Array) -> Dictionary:
|
||||
var n := p2.size()
|
||||
if n < 4 or n > 900:
|
||||
return {}
|
||||
for i in n:
|
||||
var a := p2[i]
|
||||
var b := p2[(i + 1) % n]
|
||||
for j in range(i + 2, n):
|
||||
if i == 0 and j == n - 1:
|
||||
continue # adjacent through the wraparound
|
||||
var c := p2[j]
|
||||
var d := p2[(j + 1) % n]
|
||||
var hit := _seg_hit(a, b, c, d)
|
||||
if not hit.is_empty():
|
||||
hit["i"] = i
|
||||
hit["j"] = j
|
||||
return hit
|
||||
return {}
|
||||
|
||||
|
||||
## Projection basis (u, v) for a vertex index loop - the loop's own plane.
|
||||
static func _loop_basis(verts: PackedVector3Array, ids: Array) -> Array:
|
||||
var pts := PackedVector3Array()
|
||||
pts.resize(ids.size())
|
||||
for k in ids.size():
|
||||
pts[k] = verts[ids[k]]
|
||||
var nrm := face_normal(pts)
|
||||
if nrm == Vector3.ZERO:
|
||||
nrm = Vector3.UP
|
||||
var u := Vector3.RIGHT
|
||||
for k in ids.size():
|
||||
var t: Vector3 = verts[ids[k]] - verts[ids[0]]
|
||||
if t.length() > 1e-7:
|
||||
u = t.normalized()
|
||||
break
|
||||
var v := nrm.cross(u).normalized()
|
||||
return [u, v]
|
||||
|
||||
|
||||
static func _dedupe_loop(verts: PackedVector3Array, idxs: Array) -> Array:
|
||||
# Drop consecutive duplicates (freehand strokes often re-touch their
|
||||
# start point) - zero-area ears would stall the clipper.
|
||||
var ids: Array = []
|
||||
for k in idxs.size():
|
||||
var vi: int = idxs[k]
|
||||
if vi < 0 or vi >= verts.size():
|
||||
continue
|
||||
if not ids.is_empty() and verts[ids[ids.size() - 1]] \
|
||||
.distance_squared_to(verts[vi]) < 1e-12:
|
||||
continue
|
||||
if k == idxs.size() - 1 and not ids.is_empty() \
|
||||
and verts[ids[0]].distance_squared_to(verts[vi]) < 1e-12:
|
||||
continue
|
||||
ids.append(vi)
|
||||
return ids
|
||||
|
||||
|
||||
static func _concat_i(a: PackedInt32Array, b: PackedInt32Array) -> PackedInt32Array:
|
||||
a.append_array(b)
|
||||
return a
|
||||
|
||||
|
||||
## Robust triangulation of a POSSIBLY SELF-INTERSECTING polygon loop
|
||||
## (freehand doodles cross themselves all the time). The loop is split at
|
||||
## crossing points into simple sub-loops and each is ear-clipped, so the
|
||||
## fill covers the union of the drawn loops - a figure-eight fills both
|
||||
## lobes, a scribble fills every enclosed pocket. No engine triangulator
|
||||
## is ever invoked, so "Invalid polygon data" errors cannot happen.
|
||||
##
|
||||
## Returns {"verts": PackedVector3Array, "tris": PackedInt32Array}.
|
||||
## verts may be LONGER than the input (crossing points are appended);
|
||||
## tris index into verts. Winding follows the polygon's own normal side.
|
||||
static func triangulate_robust(pts3: PackedVector3Array) -> Dictionary:
|
||||
if pts3.size() < 3:
|
||||
return {"verts": PackedVector3Array(pts3), "tris": PackedInt32Array()}
|
||||
return _tri_recurse(pts3, _seq(pts3.size()), 0, [])
|
||||
|
||||
|
||||
static func _seq(n: int) -> Array:
|
||||
var a: Array = []
|
||||
a.resize(n)
|
||||
for i in n:
|
||||
a[i] = i
|
||||
return a
|
||||
|
||||
|
||||
static func _tri_recurse(verts: PackedVector3Array, idxs: Array,
|
||||
depth: int, basis: Array) -> Dictionary:
|
||||
var ids := _dedupe_loop(verts, idxs)
|
||||
if ids.size() < 3:
|
||||
return {"verts": verts, "tris": PackedInt32Array()}
|
||||
if basis.is_empty():
|
||||
basis = _loop_basis(verts, ids)
|
||||
var u: Vector3 = basis[0]
|
||||
var v: Vector3 = basis[1]
|
||||
var p0: Vector3 = verts[ids[0]]
|
||||
var p2 := PackedVector2Array()
|
||||
p2.resize(ids.size())
|
||||
for k in ids.size():
|
||||
var d: Vector3 = verts[ids[k]] - p0
|
||||
p2[k] = Vector2(d.dot(u), d.dot(v))
|
||||
if _signed_area2(p2) < 0.0:
|
||||
ids.reverse()
|
||||
for k in ids.size():
|
||||
var d: Vector3 = verts[ids[k]] - p0
|
||||
p2[k] = Vector2(d.dot(u), d.dot(v))
|
||||
var clipped: Dictionary = _ear_clip(p2)
|
||||
var tris: PackedInt32Array = clipped["tris"]
|
||||
if not clipped["complete"] and depth < 24:
|
||||
var cross := _first_crossing(p2)
|
||||
if not cross.is_empty():
|
||||
var i: int = cross["i"]
|
||||
var j: int = cross["j"]
|
||||
var t: float = cross["t"]
|
||||
# 3D crossing point: both edges lie in the loop plane,
|
||||
# so interpolating along edge i lands exactly on it.
|
||||
var p3: Vector3 = verts[ids[i]] \
|
||||
.lerp(verts[ids[(i + 1) % ids.size()]], t)
|
||||
var verts2 := PackedVector3Array(verts)
|
||||
var new_i := verts2.size()
|
||||
verts2.append(p3)
|
||||
var loop_a: Array = []
|
||||
for k in range(0, i + 1):
|
||||
loop_a.append(ids[k])
|
||||
loop_a.append(new_i)
|
||||
for k in range(j + 1, ids.size()):
|
||||
loop_a.append(ids[k])
|
||||
var loop_b: Array = [new_i]
|
||||
for k in range(i + 1, j + 1):
|
||||
loop_b.append(ids[k])
|
||||
var ra := _tri_recurse(verts2, loop_a, depth + 1, basis)
|
||||
var rb := _tri_recurse(ra["verts"], loop_b, depth + 1, basis)
|
||||
return {"verts": rb["verts"],
|
||||
"tris": _concat_i(ra["tris"], rb["tris"])}
|
||||
var out := PackedInt32Array()
|
||||
for t in tris:
|
||||
out.append(ids[t])
|
||||
return {"verts": verts, "tris": out}
|
||||
|
||||
|
||||
# ------------------------------------------------------------ polygon ---
|
||||
static func point_in_poly2(poly: PackedVector2Array, p: Vector2) -> bool:
|
||||
var inside := false
|
||||
var n := poly.size()
|
||||
if n < 3:
|
||||
return false
|
||||
var j := n - 1
|
||||
for i in n:
|
||||
var a := poly[i]
|
||||
var b := poly[j]
|
||||
if (a.y > p.y) != (b.y > p.y):
|
||||
var t := (p.y - a.y) / (b.y - a.y)
|
||||
if p.x < a.x + t * (b.x - a.x):
|
||||
inside = not inside
|
||||
j = i
|
||||
return inside
|
||||
|
||||
|
||||
static func dist_to_seg(p: Vector2, a: Vector2, b: Vector2) -> float:
|
||||
var ab := b - a
|
||||
var l2 := ab.length_squared()
|
||||
if l2 < 1e-9:
|
||||
return p.distance_to(a)
|
||||
var t := clampf((p - a).dot(ab) / l2, 0.0, 1.0)
|
||||
return p.distance_to(a + ab * t)
|
||||
|
||||
|
||||
# ---------------------------------------------------- barycentric UV ---
|
||||
## Barycentric coordinates of `p` inside triangle (a, b, c), computed in
|
||||
## 2D. Barycentric coords are affine-invariant, so they can be computed in
|
||||
## ANY projection of the triangle (e.g. the dominant-axis projection of a
|
||||
## 3D face) and applied to a differently-warped image of the same triangle
|
||||
## - which is exactly how the texture mapping stays consistent with the
|
||||
## GPU's per-vertex interpolation. Returns (-1,-1,-1) for degenerate tris.
|
||||
static func bary2(a: Vector2, b: Vector2, c: Vector2, p: Vector2) -> Vector3:
|
||||
var d := (b.y - c.y) * (a.x - c.x) + (c.x - b.x) * (a.y - c.y)
|
||||
if absf(d) < 1e-12:
|
||||
return Vector3(-1, -1, -1)
|
||||
var l1 := ((b.y - c.y) * (p.x - c.x) + (c.x - b.x) * (p.y - c.y)) / d
|
||||
var l2 := ((c.y - a.y) * (p.x - c.x) + (a.x - c.x) * (p.y - c.y)) / d
|
||||
return Vector3(l1, l2, 1.0 - l1 - l2)
|
||||
|
||||
|
||||
## True when `lam` (from bary2) places the point inside (or on the edge
|
||||
## of) the triangle, with a small negative tolerance for edge texels.
|
||||
static func bary_inside(lam: Vector3, eps := 1.0 / 4096.0) -> bool:
|
||||
return lam.x >= -eps and lam.y >= -eps and lam.z >= -eps
|
||||
|
||||
|
||||
static func rdp(points: PackedVector2Array, eps: float) -> PackedVector2Array:
|
||||
# Ramer-Douglas-Peucker simplification (iterative).
|
||||
var n := points.size()
|
||||
if n < 3:
|
||||
return PackedVector2Array(points)
|
||||
var keep := PackedByteArray()
|
||||
keep.resize(n)
|
||||
for i in n:
|
||||
keep[i] = 0
|
||||
keep[0] = 1
|
||||
keep[n - 1] = 1
|
||||
var stack: Array = [[0, n - 1]]
|
||||
while not stack.is_empty():
|
||||
var job: Array = stack.pop_back()
|
||||
var s := int(job[0])
|
||||
var e := int(job[1])
|
||||
if e <= s + 1:
|
||||
continue
|
||||
var best := -1.0
|
||||
var best_i := -1
|
||||
for i in range(s + 1, e):
|
||||
var d := dist_to_seg(points[i], points[s], points[e])
|
||||
if d > best:
|
||||
best = d
|
||||
best_i = i
|
||||
if best > eps and best_i > 0:
|
||||
keep[best_i] = 1
|
||||
stack.append([s, best_i])
|
||||
stack.append([best_i, e])
|
||||
var out := PackedVector2Array()
|
||||
for i in n:
|
||||
if keep[i] == 1:
|
||||
out.append(points[i])
|
||||
return out
|
||||
|
||||
|
||||
# ---------------------------------------------------------------- ray ---
|
||||
static func ray_tri(o: Vector3, d: Vector3, a: Vector3, b: Vector3, c: Vector3) -> float:
|
||||
# Moller-Trumbore; returns distance along d, or -1.0.
|
||||
var e1 := b - a
|
||||
var e2 := c - a
|
||||
var p := d.cross(e2)
|
||||
var det := e1.dot(p)
|
||||
if absf(det) < 1e-9:
|
||||
return -1.0
|
||||
var inv := 1.0 / det
|
||||
var t := o - a
|
||||
var u := t.dot(p) * inv
|
||||
if u < -1e-6 or u > 1.0 + 1e-6:
|
||||
return -1.0
|
||||
var q := t.cross(e1)
|
||||
var vv := d.dot(q) * inv
|
||||
if vv < -1e-6 or u + vv > 1.0 + 1e-6:
|
||||
return -1.0
|
||||
var dist := e2.dot(q) * inv
|
||||
if dist < 1e-6:
|
||||
return -1.0
|
||||
return dist
|
||||
|
||||
|
||||
static func closest_ray_line(o: Vector3, d: Vector3, p0: Vector3, dir: Vector3) -> Dictionary:
|
||||
# Closest points between a ray (o,d) and an infinite line (p0,dir).
|
||||
var dir2 := dir.normalized()
|
||||
var w0 := o - p0
|
||||
var a := d.dot(d)
|
||||
var b := d.dot(dir2)
|
||||
var cc := dir2.dot(dir2)
|
||||
var dd := d.dot(w0)
|
||||
var e := dir2.dot(w0)
|
||||
var denom := a * cc - b * b
|
||||
var t_ray := 0.0
|
||||
var t_line := 0.0
|
||||
if absf(denom) < 1e-9:
|
||||
t_ray = 0.0
|
||||
t_line = e / maxf(cc, 1e-9)
|
||||
else:
|
||||
t_ray = (b * e - cc * dd) / denom
|
||||
t_line = (a * e - b * dd) / denom
|
||||
t_ray = maxf(t_ray, 0.0)
|
||||
return {
|
||||
"ray": o + d * t_ray,
|
||||
"line": p0 + dir2 * t_line,
|
||||
"t_line": t_line,
|
||||
}
|
||||
|
||||
|
||||
# ------------------------------------------------------- shape makers ---
|
||||
|
||||
static func _orient_out(verts: PackedVector3Array, faces: Array, want := Vector3.ZERO) -> void:
|
||||
# Flip any face loop whose Newell normal disagrees with the outward
|
||||
# direction (radial from `want` origin).
|
||||
for fi in faces.size():
|
||||
var loop: PackedInt32Array = faces[fi]
|
||||
var pts := PackedVector3Array()
|
||||
for vi in loop:
|
||||
pts.append(verts[vi])
|
||||
var n := face_normal(pts)
|
||||
if n == Vector3.ZERO:
|
||||
continue
|
||||
var c := face_center(pts)
|
||||
var dir := c - want
|
||||
if dir.length() < 1e-9:
|
||||
dir = want
|
||||
if n.dot(dir.normalized()) < 0.0:
|
||||
loop.reverse()
|
||||
faces[fi] = loop
|
||||
|
||||
|
||||
|
||||
static func make_cube(s: float = 1.0) -> Dictionary:
|
||||
var h := s * 0.5
|
||||
var v := PackedVector3Array([
|
||||
Vector3(-h, -h, -h), Vector3(h, -h, -h), Vector3(h, h, -h), Vector3(-h, h, -h),
|
||||
Vector3(-h, -h, h), Vector3(h, -h, h), Vector3(h, h, h), Vector3(-h, h, h),
|
||||
])
|
||||
var faces: Array = [
|
||||
PackedInt32Array([3, 2, 6, 7]), # +Y
|
||||
PackedInt32Array([0, 1, 5, 4]), # -Y
|
||||
PackedInt32Array([1, 2, 6, 5]), # +X
|
||||
PackedInt32Array([0, 4, 7, 3]), # -X
|
||||
PackedInt32Array([4, 5, 6, 7]), # +Z
|
||||
PackedInt32Array([1, 0, 3, 2]), # -Z
|
||||
]
|
||||
_orient_out(v, faces, Vector3.ZERO)
|
||||
return {"verts": v, "faces": faces}
|
||||
|
||||
|
||||
static func make_plane(w: float = 1.0, d: float = 1.0, seg: int = 1) -> Dictionary:
|
||||
seg = maxi(1, seg)
|
||||
var v := PackedVector3Array()
|
||||
var faces: Array = []
|
||||
var n := seg + 1
|
||||
for j in n:
|
||||
for i in n:
|
||||
v.append(Vector3(
|
||||
(i / float(seg) - 0.5) * w, 0.0,
|
||||
(j / float(seg) - 0.5) * d))
|
||||
for j in seg:
|
||||
for i in seg:
|
||||
var a := j * n + i
|
||||
faces.append(PackedInt32Array([a, a + 1, a + n + 1, a + n]))
|
||||
_orient_out(v, faces, Vector3.UP)
|
||||
return {"verts": v, "faces": faces}
|
||||
|
||||
|
||||
static func make_prism(s: float = 1.0) -> Dictionary:
|
||||
var h := s * 0.5
|
||||
var v := PackedVector3Array([
|
||||
Vector3(-h, -h, -h * 0.866), Vector3(h, -h, -h * 0.866), Vector3(0, -h, h * 0.866),
|
||||
Vector3(-h, h, -h * 0.866), Vector3(h, h, -h * 0.866), Vector3(0, h, h * 0.866),
|
||||
])
|
||||
var faces: Array = [
|
||||
PackedInt32Array([3, 4, 5]), # +Y
|
||||
PackedInt32Array([0, 2, 1]), # -Y
|
||||
PackedInt32Array([0, 1, 4, 3]), # -Z
|
||||
PackedInt32Array([1, 2, 5, 4]), # +X-ish
|
||||
PackedInt32Array([2, 0, 3, 5]), # -X-ish
|
||||
]
|
||||
_orient_out(v, faces, Vector3.ZERO)
|
||||
return {"verts": v, "faces": faces}
|
||||
|
||||
|
||||
static func make_cylinder(r: float = 0.5, h: float = 1.0, seg: int = 12) -> Dictionary:
|
||||
seg = clampi(seg, 3, 64)
|
||||
var v := PackedVector3Array()
|
||||
var faces: Array = []
|
||||
for i in seg:
|
||||
var a := TAU * i / seg
|
||||
v.append(Vector3(cos(a) * r, -h * 0.5, sin(a) * r))
|
||||
for i in seg:
|
||||
var a := TAU * i / seg
|
||||
v.append(Vector3(cos(a) * r, h * 0.5, sin(a) * r))
|
||||
for i in seg:
|
||||
var j := (i + 1) % seg
|
||||
faces.append(PackedInt32Array([i, j, seg + j, seg + i]))
|
||||
var cap_bottom := PackedInt32Array()
|
||||
for i in seg:
|
||||
cap_bottom.append(seg - 1 - i)
|
||||
faces.append(cap_bottom)
|
||||
var cap_top := PackedInt32Array()
|
||||
for i in seg:
|
||||
cap_top.append(seg + i)
|
||||
faces.append(cap_top)
|
||||
_orient_out(v, faces, Vector3.ZERO)
|
||||
return {"verts": v, "faces": faces}
|
||||
|
||||
|
||||
static func make_sphere(r: float = 0.5, seg: int = 10) -> Dictionary:
|
||||
seg = clampi(seg, 4, 32)
|
||||
var rings := maxi(3, seg / 2)
|
||||
var v := PackedVector3Array()
|
||||
var faces: Array = []
|
||||
v.append(Vector3(0, -r, 0)) # south pole, index 0
|
||||
for j in range(1, rings):
|
||||
var phi := -PI * 0.5 + PI * j / rings
|
||||
for i in seg:
|
||||
var a := TAU * i / seg
|
||||
v.append(Vector3(cos(a) * cos(phi) * r, sin(phi) * r, sin(a) * cos(phi) * r))
|
||||
v.append(Vector3(0, r, 0)) # north pole
|
||||
var top := v.size() - 1
|
||||
var ring_start := func(j: int) -> int: return 1 + (j - 1) * seg
|
||||
# Bottom cap (ring 1 = indices 1..seg).
|
||||
var r1 := ring_start.call(1)
|
||||
for i in seg:
|
||||
faces.append(PackedInt32Array([0, r1 + (i + 1) % seg, r1 + i]))
|
||||
# Middle quads between consecutive rings.
|
||||
for j in range(1, rings - 1):
|
||||
var ra := ring_start.call(j)
|
||||
var rb := ring_start.call(j + 1)
|
||||
for i in seg:
|
||||
var i2 := (i + 1) % seg
|
||||
faces.append(PackedInt32Array([ra + i, ra + i2, rb + i2, rb + i]))
|
||||
# Top cap.
|
||||
var rl := ring_start.call(rings - 1)
|
||||
for i in seg:
|
||||
faces.append(PackedInt32Array([top, rl + i, rl + (i + 1) % seg]))
|
||||
_orient_out(v, faces, Vector3.ZERO)
|
||||
return {"verts": v, "faces": faces}
|
||||
|
||||
|
||||
static func make_torus(R: float = 0.5, r: float = 0.18,
|
||||
seg_main: int = 16, seg_minor: int = 8) -> Dictionary:
|
||||
# Torus lying in the XZ plane, tube around the Y axis, centered at origin.
|
||||
seg_main = clampi(seg_main, 3, 48)
|
||||
seg_minor = clampi(seg_minor, 3, 24)
|
||||
var v := PackedVector3Array()
|
||||
var faces: Array = []
|
||||
for i in seg_main:
|
||||
var a := TAU * i / seg_main
|
||||
var ca := cos(a)
|
||||
var sa := sin(a)
|
||||
for j in seg_minor:
|
||||
var b := TAU * j / seg_minor
|
||||
var rr := R + r * cos(b)
|
||||
v.append(Vector3(ca * rr, r * sin(b), sa * rr))
|
||||
for i in seg_main:
|
||||
var i2 := (i + 1) % seg_main
|
||||
for j in seg_minor:
|
||||
var j2 := (j + 1) % seg_minor
|
||||
faces.append(PackedInt32Array([
|
||||
i * seg_minor + j, i2 * seg_minor + j,
|
||||
i2 * seg_minor + j2, i * seg_minor + j2]))
|
||||
_orient_out(v, faces, Vector3.ZERO)
|
||||
return {"verts": v, "faces": faces}
|
||||
|
||||
|
||||
# ------------------------------------------------- doodle generators ---
|
||||
## Regular n-gon inscribed in the rect (0,0)-(w,h), point up.
|
||||
static func ngon_pts(n: int, w: float, h: float) -> PackedVector2Array:
|
||||
var out := PackedVector2Array()
|
||||
var cx := w * 0.5
|
||||
var cy := h * 0.5
|
||||
for i in maxi(3, n):
|
||||
var a := -PI * 0.5 + TAU * i / maxi(3, n)
|
||||
out.append(Vector2(cx + cos(a) * w * 0.5, cy + sin(a) * h * 0.5))
|
||||
return out
|
||||
|
||||
|
||||
## 5-point star inscribed in the rect, point up.
|
||||
static func star_pts(w: float, h: float) -> PackedVector2Array:
|
||||
var out := PackedVector2Array()
|
||||
var cx := w * 0.5
|
||||
var cy := h * 0.5
|
||||
for i in 10:
|
||||
var a := -PI * 0.5 + PI * i / 5.0
|
||||
var k := 1.0 if i % 2 == 0 else 0.42
|
||||
out.append(Vector2(cx + cos(a) * w * 0.5 * k, cy + sin(a) * h * 0.5 * k))
|
||||
return out
|
||||
@@ -0,0 +1 @@
|
||||
uid://cs0j06a8nqdx5
|
||||
@@ -0,0 +1,79 @@
|
||||
@tool
|
||||
class_name PdIcons
|
||||
## Icon loader. The icons are REAL PNG image files stored in
|
||||
## res://addons/polydoodle/icons/ - generated once, shipped with the
|
||||
## plugin, editable by anyone with an image editor. They are read as raw
|
||||
## bytes through FileAccess (NOT the resource loader), so the plugin has
|
||||
## zero dependency on Godot's import system: no first-boot import errors,
|
||||
## works straight from a fresh unzip.
|
||||
|
||||
const DIR := "res://addons/polydoodle/icons/"
|
||||
|
||||
const NAMES := [
|
||||
"icon", "ws_3d", "ws_uv",
|
||||
"mode_object", "mode_vertex", "mode_edge", "mode_face",
|
||||
"mode_draw", "mode_paint", "draw_tools", "paint_tools",
|
||||
"tool_freehand", "tool_rect", "tool_circle", "tool_triangle",
|
||||
"tool_pentagon", "tool_hexagon", "tool_star", "tool_torus",
|
||||
"tool_brush", "tool_fill", "tool_fillobject", "tool_pixel",
|
||||
"tool_eraser", "tool_picker", "tool_replace",
|
||||
"tool_uv", "uv_reset",
|
||||
"gizmo", "gizmo_move", "gizmo_scale", "gizmo_rotate",
|
||||
"snap", "grid", "doubleside",
|
||||
"add", "duplicate", "delete",
|
||||
"undo", "redo", "save", "open", "export",
|
||||
"arrow_down", "flip", "expand",
|
||||
"eye", "eye_off", "lock", "unlock",
|
||||
"gear", "docs", "rotate", "detach", "image", "import_model",
|
||||
]
|
||||
|
||||
static var _cache := {}
|
||||
|
||||
|
||||
static func get_icon(icon_name: String) -> Texture2D:
|
||||
return _load_sized(icon_name, 0)
|
||||
|
||||
|
||||
## Same icon, resized to an exact `size` x `size` square BEFORE the
|
||||
## texture is built. Needed anywhere Godot's own control has no icon-size
|
||||
## theme knob to scale a source texture down - e.g. Tree.add_button()
|
||||
## always draws its icon at the PNG's native pixel size, so the hierarchy
|
||||
## panel's eye/lock buttons looked huge next to the 16px toolbar icons
|
||||
## (which get scaled down via the "icon_max_width" theme constant that
|
||||
## Button supports but Tree's per-cell buttons do not). Pre-resizing the
|
||||
## source image keeps every icon in the UI at the SAME visual size
|
||||
## regardless of which control ends up drawing it.
|
||||
static func get_icon_sized(icon_name: String, size: int) -> Texture2D:
|
||||
return _load_sized(icon_name, size)
|
||||
|
||||
|
||||
static func _load_sized(icon_name: String, size: int) -> Texture2D:
|
||||
var key := icon_name.trim_suffix(".svg").trim_suffix(".png")
|
||||
var cache_key := key if size <= 0 else "%s@%d" % [key, size]
|
||||
if _cache.has(cache_key):
|
||||
return _cache[cache_key]
|
||||
var path := DIR + key + ".png"
|
||||
var tex: Texture2D = null
|
||||
if FileAccess.file_exists(path):
|
||||
var f := FileAccess.open(path, FileAccess.READ)
|
||||
if f != null:
|
||||
var bytes := f.get_buffer(f.get_length())
|
||||
f.close()
|
||||
var img := Image.new()
|
||||
if img.load_png_from_buffer(bytes) == OK:
|
||||
if size > 0 and (img.get_width() != size
|
||||
or img.get_height() != size):
|
||||
img.resize(size, size, Image.INTERPOLATE_LANCZOS)
|
||||
tex = ImageTexture.create_from_image(img)
|
||||
if tex == null:
|
||||
push_warning("Polydoodle: missing icon '%s'" % key)
|
||||
_cache[cache_key] = tex
|
||||
return tex
|
||||
|
||||
|
||||
## True when every icon file exists - used by the test suite.
|
||||
static func all_present() -> bool:
|
||||
for n in NAMES:
|
||||
if not FileAccess.file_exists(DIR + n + ".png"):
|
||||
return false
|
||||
return true
|
||||
@@ -0,0 +1 @@
|
||||
uid://vttbbohp04p0
|
||||
@@ -0,0 +1 @@
|
||||
uid://5ntgg2uadv1c
|
||||
@@ -0,0 +1,555 @@
|
||||
@tool
|
||||
class_name PdIo
|
||||
## Export & project I/O for Polydoodle: ArrayMesh, .tres, .obj (+ .mtl and
|
||||
## texture PNG), .tscn, add-to-scene, and native .pdoodle project files.
|
||||
|
||||
|
||||
static func build_mesh(o: PdPolyObj, fallback := PdPolyObj.BASE,
|
||||
both_sides := true, use_texture := true,
|
||||
pixel_filter := false, alpha_tex := false) -> ArrayMesh:
|
||||
var st := SurfaceTool.new()
|
||||
st.begin(Mesh.PRIMITIVE_TRIANGLES)
|
||||
var vc := 0
|
||||
var tex_w := 0.0
|
||||
if use_texture:
|
||||
o.ensure_uv()
|
||||
# the atlas ALWAYS has a visual: the empty texture slot
|
||||
# renders through the generated checkerboard placeholder
|
||||
# (a transparent blank when the checker is hidden)
|
||||
tex_w = float(o.atlas_size())
|
||||
# Per-object SHADE SMOOTH: average the face normals at every mesh
|
||||
# vertex so shared corners shade continuously. Flat (default) keeps
|
||||
# the hard per-face normal everywhere.
|
||||
var smooth_on: bool = o.shade_smooth
|
||||
var vnorm := {}
|
||||
if smooth_on:
|
||||
for fi2 in o.nfaces():
|
||||
var n2 := o.face_normal_w(fi2)
|
||||
if n2 == Vector3.ZERO:
|
||||
continue
|
||||
for vi in o.face_loop(fi2):
|
||||
vnorm[vi] = (vnorm.get(vi, Vector3.ZERO) as Vector3) + n2
|
||||
for fi in o.nfaces():
|
||||
# robust triangulation: self-intersecting doodle faces come
|
||||
# out filled (union of their loops) instead of erroring
|
||||
var tr := o.face_triangulation(fi)
|
||||
var pts: PackedVector3Array = tr["verts"]
|
||||
var tris: PackedInt32Array = tr["tris"]
|
||||
if pts.size() < 3 or tris.size() < 3:
|
||||
continue
|
||||
var n := o.face_normal_w(fi)
|
||||
if n == Vector3.ZERO:
|
||||
continue
|
||||
var loop := o.face_loop(fi)
|
||||
for t in range(0, tris.size() - 2, 3):
|
||||
# Godot uses CLOCKWISE winding for front faces; the
|
||||
# triangulator emits CCW (viewed from the normal side),
|
||||
# so reverse each triangle or CULL_BACK shows the
|
||||
# inside of the model.
|
||||
for k in [2, 1, 0]:
|
||||
var nrm: Vector3 = n
|
||||
if smooth_on:
|
||||
var ti: int = tris[t + k]
|
||||
if ti < loop.size():
|
||||
var acc: Vector3 = vnorm.get(
|
||||
loop[ti], n)
|
||||
if acc.length() > 0.0001:
|
||||
nrm = acc.normalized()
|
||||
st.set_normal(nrm)
|
||||
if tex_w > 0.0:
|
||||
st.set_uv(o.uv_of_world(fi, pts[tris[t + k]]))
|
||||
else:
|
||||
var c := o.face_color(fi)
|
||||
st.set_color(fallback if c.a < 0.01 else c)
|
||||
st.add_vertex(pts[tris[t + k]])
|
||||
vc += 1
|
||||
if vc == 0:
|
||||
return null
|
||||
var mat := StandardMaterial3D.new()
|
||||
mat.roughness = 0.85
|
||||
mat.metallic = 0.0
|
||||
if tex_w > 0.0:
|
||||
# alpha_tex = the checker placeholder is NOT served: the
|
||||
# raw page (transparent where unpainted) is used, so the
|
||||
# material must alpha-test the holes. Otherwise the
|
||||
# checker+page composite renders opaque as always.
|
||||
mat.albedo_texture = o.get_texture(not alpha_tex)
|
||||
if alpha_tex:
|
||||
mat.transparency = BaseMaterial3D.TRANSPARENCY_ALPHA_SCISSOR
|
||||
mat.alpha_scissor_threshold = 0.5
|
||||
# Pixel mode samples the texture NEAREST (crisp texels on
|
||||
# the model), Smooth mode keeps the filtered default.
|
||||
mat.texture_filter = BaseMaterial3D.TEXTURE_FILTER_NEAREST \
|
||||
if pixel_filter \
|
||||
else BaseMaterial3D.TEXTURE_FILTER_LINEAR_WITH_MIPMAPS
|
||||
else:
|
||||
mat.vertex_color_use_as_albedo = true
|
||||
# "Render both sides": no backface culling, ON by default
|
||||
mat.cull_mode = BaseMaterial3D.CULL_DISABLED if both_sides \
|
||||
else BaseMaterial3D.CULL_BACK
|
||||
st.set_material(mat)
|
||||
st.index()
|
||||
return st.commit()
|
||||
|
||||
|
||||
static func build_document_mesh(doc: PdDocument,
|
||||
alpha_tex := false) -> ArrayMesh:
|
||||
var merged := ArrayMesh.new()
|
||||
var any := false
|
||||
for o in doc.objects:
|
||||
if not o.is_visible:
|
||||
continue
|
||||
var m := build_mesh(o, PdPolyObj.BASE, doc.both_sides,
|
||||
true, doc.tex_filter == 1, alpha_tex)
|
||||
if m == null:
|
||||
continue
|
||||
any = true
|
||||
for si in m.get_surface_count():
|
||||
merged.add_surface_from_arrays(
|
||||
Mesh.PRIMITIVE_TRIANGLES, m.surface_get_arrays(si))
|
||||
merged.surface_set_material(merged.get_surface_count() - 1,
|
||||
m.surface_get_material(si))
|
||||
return merged if any else null
|
||||
|
||||
|
||||
# ---------------------------------------------------------------- obj ---
|
||||
## Wavefront OBJ export with TEXTURE support:
|
||||
## - "s off" per object so importers (which default to SMOOTH shading when
|
||||
## no s-lines exist) render the flat, per-face look Polydoodle shows.
|
||||
## - Per-corner "vt" coordinates taken from each face's CURRENT sampling
|
||||
## texels (moved UVs export correctly), V flipped to OBJ's bottom-left
|
||||
## convention (Godot images are top-left).
|
||||
## - A companion .mtl with map_Kd plus the atlas saved as a PNG next to
|
||||
## the .obj (one PNG per textured object).
|
||||
## Returns OK, or the FileAccess error.
|
||||
static func write_obj(doc: PdDocument, path: String) -> Error:
|
||||
var f := FileAccess.open(path, FileAccess.WRITE)
|
||||
if f == null:
|
||||
return FileAccess.get_open_error()
|
||||
var mtl_name := path.get_file().get_basename() + ".mtl"
|
||||
f.store_line("# Exported by Polydoodle")
|
||||
f.store_line("# %d object(s)" % doc.objects.size())
|
||||
f.store_line("mtllib %s" % mtl_name)
|
||||
var base := 1
|
||||
var vt_base := 1
|
||||
var mats := "" # accumulated .mtl content
|
||||
var pngs := [] # [path, Image] pairs to save
|
||||
var mid := 0
|
||||
for o in doc.objects:
|
||||
if not o.is_visible:
|
||||
continue
|
||||
f.store_line("o %s" % o.obj_name.validate_node_name()
|
||||
if not o.obj_name.is_empty() else "o Shape")
|
||||
# s on = smooth shading (importers average normals),
|
||||
# s off = the flat per-face look Polydoodle shows by default
|
||||
f.store_line("s on" if o.shade_smooth else "s off")
|
||||
for i in o.nverts():
|
||||
var w: Vector3 = o.wvert(i)
|
||||
f.store_line("v %.5f %.5f %.5f" % [w.x, w.y, w.z])
|
||||
# vt: one per face loop corner, sampling position, V flipped
|
||||
var has_tex: bool = o.tex != null
|
||||
var mat_id := ""
|
||||
if has_tex:
|
||||
mid += 1
|
||||
mat_id = "polydoodle_mat%d" % mid
|
||||
f.store_line("usemtl %s" % mat_id)
|
||||
var tex: Image = o.tex
|
||||
var tw := float(tex.get_width())
|
||||
var th := float(tex.get_height())
|
||||
for fi in o.nfaces():
|
||||
var loop: PackedInt32Array = o.face_loop(fi)
|
||||
for k in loop.size():
|
||||
var t: Vector2 = o.corner_texel(fi, k)
|
||||
var u: float = (t.x + 0.5) / tw
|
||||
var vv: float = 1.0 - (t.y + 0.5) / th
|
||||
f.store_line("vt %.5f %.5f" % [u, vv])
|
||||
# texture PNG next to the obj (absolute path for
|
||||
# IO). Same bake rule as the mesh exports: the
|
||||
# checker rides along when it is shown in the
|
||||
# editor or "Bake Into Export" is on; otherwise the
|
||||
# raw page (alpha 0 where unpainted) exports.
|
||||
var png_name := "%s_%d.png" % [
|
||||
path.get_file().get_basename(), mid]
|
||||
mats += "newmtl %s\n" % mat_id
|
||||
mats += "Ka 1.000 1.000 1.000\n"
|
||||
mats += "Kd 1.000 1.000 1.000\n"
|
||||
mats += "d 1.000\n"
|
||||
mats += "illum 1\n"
|
||||
mats += "map_Kd %s\n\n" % png_name
|
||||
pngs.append([path.get_base_dir().path_join(png_name),
|
||||
o.export_image(doc.show_checker
|
||||
or doc.export_checker)])
|
||||
for face in o.faces:
|
||||
var parts := PackedStringArray(["f"])
|
||||
for vi in face:
|
||||
if has_tex:
|
||||
parts.append("%d/%d" % [base + vi, vt_base])
|
||||
vt_base += 1
|
||||
else:
|
||||
parts.append(str(base + vi))
|
||||
f.store_line(" ".join(parts))
|
||||
base += o.nverts()
|
||||
f.close()
|
||||
if mats != "":
|
||||
var mf := FileAccess.open(
|
||||
path.get_base_dir().path_join(mtl_name), FileAccess.WRITE)
|
||||
if mf != null:
|
||||
mf.store_string(mats)
|
||||
mf.close()
|
||||
for p in pngs:
|
||||
var gp := ProjectSettings.globalize_path(p[0])
|
||||
(p[1] as Image).save_png(gp)
|
||||
return OK
|
||||
|
||||
|
||||
## The export-texture rule shared by every path: the checkerboard bakes
|
||||
## into the exported texture when it is shown in the editor OR the
|
||||
## "Export Checkerboard" option is on; otherwise unpainted texels export
|
||||
## transparent (alpha 0) and the material alpha-tests the holes.
|
||||
static func export_alpha_tex(doc: PdDocument) -> bool:
|
||||
return not (doc.show_checker or doc.export_checker)
|
||||
|
||||
|
||||
# --------------------------------------------------------------- tres ---
|
||||
static func save_mesh_tres(doc: PdDocument, path: String) -> Error:
|
||||
var mesh := build_document_mesh(doc, export_alpha_tex(doc))
|
||||
if mesh == null:
|
||||
return ERR_CANT_CREATE
|
||||
return ResourceSaver.save(mesh, path)
|
||||
|
||||
|
||||
# --------------------------------------------------------------- tscn ---
|
||||
static func save_scene_tscn(doc: PdDocument, path: String) -> Error:
|
||||
var mesh_path := path.get_basename() + ".tres"
|
||||
var err := save_mesh_tres(doc, mesh_path)
|
||||
if err != OK:
|
||||
return err
|
||||
var uid := ResourceUID.create_id()
|
||||
var f := FileAccess.open(path, FileAccess.WRITE)
|
||||
if f == null:
|
||||
return FileAccess.get_open_error()
|
||||
f.store_line('[gd_scene load_steps=2 format=3 uid="%s"]' % ResourceUID.id_to_text(uid))
|
||||
f.store_line("")
|
||||
f.store_line('[ext_resource type="ArrayMesh" path="%s" id="1_mesh"]' % mesh_path)
|
||||
f.store_line("")
|
||||
f.store_line('[node name="PolydoodleModel" type="MeshInstance3D"]')
|
||||
f.store_line('mesh = ExtResource("1_mesh")')
|
||||
f.close()
|
||||
return OK
|
||||
|
||||
|
||||
# ------------------------------------------------------------ project ---
|
||||
## Native .pdoodle project files: plain var_to_str text of the full state
|
||||
## (avoids ResourceSaver's extension registry entirely).
|
||||
|
||||
static func save_project(doc: PdDocument, path: String) -> Error:
|
||||
var f := FileAccess.open(path, FileAccess.WRITE)
|
||||
if f == null:
|
||||
return FileAccess.get_open_error()
|
||||
var data := {
|
||||
"version": 1,
|
||||
"app": "polydoodle",
|
||||
"objects": doc.snapshot(),
|
||||
"bg_color": doc.bg_color,
|
||||
"grid_size": doc.grid_size,
|
||||
"grid_visible": doc.grid_visible,
|
||||
"snap_enabled": doc.snap_enabled,
|
||||
"gizmo_on": doc.gizmo_on,
|
||||
"draw_free": doc.draw_free,
|
||||
"draw_kind": doc.draw_kind,
|
||||
"paint_color": doc.paint_color,
|
||||
"paint_tool": doc.paint_tool,
|
||||
"brush_size": doc.brush_size,
|
||||
"pixel_size": doc.pixel_size,
|
||||
"recent_colors": doc.recent_colors,
|
||||
"both_sides": doc.both_sides,
|
||||
"view_shading": doc.view_shading,
|
||||
"uv_snap": doc.uv_snap,
|
||||
"tex_filter": doc.tex_filter,
|
||||
"pixel_px": doc.pixel_px,
|
||||
"gizmo_kind": doc.gizmo_kind,
|
||||
"brush_opacity": doc.brush_opacity,
|
||||
"brush_smooth": doc.brush_smooth,
|
||||
"face_lock": doc.face_lock,
|
||||
"inset_dist": doc.inset_dist,
|
||||
"hints_enabled": doc.hints_enabled,
|
||||
"show_checker": doc.show_checker,
|
||||
"export_checker": doc.export_checker,
|
||||
}
|
||||
f.store_string(var_to_str(data))
|
||||
f.close()
|
||||
return OK
|
||||
|
||||
|
||||
## Project files only ever hold plain data. An Object(...) literal outside
|
||||
## a quoted string would make str_to_var instantiate engine objects.
|
||||
static func _has_object_literal(text: String) -> bool:
|
||||
if not text.contains("Object("):
|
||||
return false
|
||||
var rx := RegEx.new()
|
||||
rx.compile("\"(?:[^\"\\\\]|\\\\.)*\"")
|
||||
return rx.sub(text, "", true).contains("Object(")
|
||||
|
||||
|
||||
static func load_project(path: String) -> PdDocument:
|
||||
var f := FileAccess.open(path, FileAccess.READ)
|
||||
if f == null:
|
||||
return null
|
||||
var text := f.get_as_text()
|
||||
f.close()
|
||||
if _has_object_literal(text):
|
||||
return null
|
||||
var parsed = str_to_var(text)
|
||||
if typeof(parsed) != TYPE_DICTIONARY:
|
||||
return null
|
||||
if typeof(parsed.get("objects", [])) != TYPE_ARRAY:
|
||||
return null
|
||||
for od in parsed.get("objects", []):
|
||||
if typeof(od) != TYPE_DICTIONARY:
|
||||
return null
|
||||
var doc := PdDocument.new()
|
||||
doc.restore_snapshot(parsed.get("objects", []))
|
||||
doc.bg_color = parsed.get("bg_color", doc.bg_color)
|
||||
doc.grid_size = parsed.get("grid_size", doc.grid_size)
|
||||
doc.grid_visible = parsed.get("grid_visible", doc.grid_visible)
|
||||
doc.snap_enabled = parsed.get("snap_enabled", doc.snap_enabled)
|
||||
doc.gizmo_on = parsed.get("gizmo_on", doc.gizmo_on)
|
||||
doc.draw_free = parsed.get("draw_free", doc.draw_free)
|
||||
doc.draw_kind = parsed.get("draw_kind",
|
||||
"Freehand" if doc.draw_free else "Rectangle")
|
||||
doc.paint_color = parsed.get("paint_color", doc.paint_color)
|
||||
doc.paint_tool = parsed.get("paint_tool", doc.paint_tool)
|
||||
doc.brush_size = parsed.get("brush_size", doc.brush_size)
|
||||
doc.pixel_size = parsed.get("pixel_size", doc.pixel_size)
|
||||
doc.recent_colors = parsed.get("recent_colors", doc.recent_colors)
|
||||
doc.both_sides = parsed.get("both_sides", doc.both_sides)
|
||||
doc.view_shading = int(parsed.get("view_shading", doc.view_shading))
|
||||
doc.uv_snap = bool(parsed.get("uv_snap", doc.uv_snap))
|
||||
doc.tex_filter = int(parsed.get("tex_filter", doc.tex_filter))
|
||||
doc.pixel_px = int(parsed.get("pixel_px", doc.pixel_px))
|
||||
doc.gizmo_kind = int(parsed.get("gizmo_kind", doc.gizmo_kind))
|
||||
doc.brush_opacity = parsed.get("brush_opacity", doc.brush_opacity)
|
||||
doc.brush_smooth = parsed.get("brush_smooth", doc.brush_smooth)
|
||||
doc.face_lock = bool(parsed.get("face_lock", doc.face_lock))
|
||||
doc.inset_dist = float(parsed.get("inset_dist", doc.inset_dist))
|
||||
doc.hints_enabled = bool(parsed.get("hints_enabled", doc.hints_enabled))
|
||||
doc.show_checker = bool(parsed.get("show_checker", doc.show_checker))
|
||||
doc.export_checker = bool(parsed.get("export_checker", doc.export_checker))
|
||||
return doc
|
||||
|
||||
|
||||
# ------------------------------------------------------------ session ---
|
||||
## AUTOMATIC SESSION SAVE: the same state a .pdoodle project
|
||||
## carries, written to user:// so the editor restores the user's models
|
||||
## exactly as they were left when Polydoodle reopens. Binary store_var
|
||||
## keeps the atlas bytes compact (the text .pdoodle format would inflate
|
||||
## them ~4x, which is fine for an explicit save but not for autosaving).
|
||||
|
||||
const SESSION_PATH := "user://polydoodle_session.pdoodle"
|
||||
|
||||
|
||||
static func session_data(doc: PdDocument) -> Dictionary:
|
||||
return {
|
||||
"version": 1,
|
||||
"app": "polydoodle_session",
|
||||
"objects": doc.snapshot(),
|
||||
"bg_color": doc.bg_color,
|
||||
"grid_size": doc.grid_size,
|
||||
"grid_visible": doc.grid_visible,
|
||||
"snap_enabled": doc.snap_enabled,
|
||||
"gizmo_on": doc.gizmo_on,
|
||||
"draw_free": doc.draw_free,
|
||||
"draw_kind": doc.draw_kind,
|
||||
"paint_color": doc.paint_color,
|
||||
"paint_tool": doc.paint_tool,
|
||||
"brush_size": doc.brush_size,
|
||||
"pixel_size": doc.pixel_size,
|
||||
"recent_colors": doc.recent_colors,
|
||||
"both_sides": doc.both_sides,
|
||||
"view_shading": doc.view_shading,
|
||||
"uv_snap": doc.uv_snap,
|
||||
"tex_filter": doc.tex_filter,
|
||||
"pixel_px": doc.pixel_px,
|
||||
"gizmo_kind": doc.gizmo_kind,
|
||||
"brush_opacity": doc.brush_opacity,
|
||||
"brush_smooth": doc.brush_smooth,
|
||||
"face_lock": doc.face_lock,
|
||||
"inset_dist": doc.inset_dist,
|
||||
"hints_enabled": doc.hints_enabled,
|
||||
"show_checker": doc.show_checker,
|
||||
"export_checker": doc.export_checker,
|
||||
"mode": doc.mode,
|
||||
"tex_edit": doc.tex_edit,
|
||||
}
|
||||
|
||||
|
||||
## The atlas bytes dominate the session file (a 1024 atlas is 4 MB raw),
|
||||
## and the autosave rewrites it often - store the texels zlib-compressed
|
||||
## (the checkerboard and flat paints shrink dramatically). Raw arrays
|
||||
## stay compatible with older sessions.
|
||||
static func _pack_textures(d: Dictionary) -> void:
|
||||
var objects: Array = d.get("objects", [])
|
||||
for o in objects:
|
||||
var od: Dictionary = o
|
||||
if od.has("tex"):
|
||||
od["tex_z"] = (od["tex"] as PackedByteArray).compress()
|
||||
od.erase("tex")
|
||||
|
||||
|
||||
static func _unpack_textures(d: Dictionary) -> void:
|
||||
var objects: Array = d.get("objects", [])
|
||||
for o in objects:
|
||||
var od: Dictionary = o
|
||||
if od.has("tex_z"):
|
||||
var raw := od["tex_z"] as PackedByteArray
|
||||
var w := int(od.get("texw", 0))
|
||||
if w > 0 and raw.size() > 0:
|
||||
od["tex"] = raw.decompress(w * w * 4)
|
||||
od.erase("tex_z")
|
||||
|
||||
|
||||
static func save_session(doc: PdDocument, path := SESSION_PATH) -> Error:
|
||||
var tmp := path + ".tmp"
|
||||
var f := FileAccess.open(tmp, FileAccess.WRITE)
|
||||
if f == null:
|
||||
return FileAccess.get_open_error()
|
||||
var d := session_data(doc)
|
||||
_pack_textures(d)
|
||||
f.store_var(d)
|
||||
var werr := f.get_error()
|
||||
f.close()
|
||||
if werr != OK:
|
||||
DirAccess.remove_absolute(ProjectSettings.globalize_path(tmp))
|
||||
return werr
|
||||
return DirAccess.rename_absolute(
|
||||
ProjectSettings.globalize_path(tmp),
|
||||
ProjectSettings.globalize_path(path))
|
||||
|
||||
|
||||
## Returns the raw session dictionary, or null when absent / corrupt.
|
||||
static func load_session(path := SESSION_PATH) -> Dictionary:
|
||||
if not FileAccess.file_exists(path):
|
||||
return {}
|
||||
var f := FileAccess.open(path, FileAccess.READ)
|
||||
if f == null:
|
||||
return {}
|
||||
var parsed: Variant = f.get_var()
|
||||
f.close()
|
||||
if typeof(parsed) != TYPE_DICTIONARY:
|
||||
return {}
|
||||
var d: Dictionary = parsed
|
||||
if d.get("app", "") != "polydoodle_session":
|
||||
return {}
|
||||
_unpack_textures(d)
|
||||
return d
|
||||
|
||||
|
||||
## Apply a session dictionary (from load_session) onto `doc`. Returns the
|
||||
## number of restored objects, or -1 when the session is invalid.
|
||||
static func apply_session(doc: PdDocument, d: Dictionary) -> int:
|
||||
if d.is_empty() or d.get("app", "") != "polydoodle_session":
|
||||
return -1
|
||||
doc.restore_snapshot(d.get("objects", []))
|
||||
doc.bg_color = d.get("bg_color", doc.bg_color)
|
||||
doc.grid_size = d.get("grid_size", doc.grid_size)
|
||||
doc.grid_visible = bool(d.get("grid_visible", doc.grid_visible))
|
||||
doc.snap_enabled = bool(d.get("snap_enabled", doc.snap_enabled))
|
||||
doc.gizmo_on = bool(d.get("gizmo_on", doc.gizmo_on))
|
||||
doc.draw_free = bool(d.get("draw_free", doc.draw_free))
|
||||
doc.draw_kind = d.get("draw_kind",
|
||||
"Freehand" if doc.draw_free else "Rectangle")
|
||||
doc.paint_color = d.get("paint_color", doc.paint_color)
|
||||
doc.paint_tool = d.get("paint_tool", doc.paint_tool)
|
||||
doc.brush_size = d.get("brush_size", doc.brush_size)
|
||||
doc.pixel_size = d.get("pixel_size", doc.pixel_size)
|
||||
doc.recent_colors = d.get("recent_colors", doc.recent_colors)
|
||||
doc.both_sides = bool(d.get("both_sides", doc.both_sides))
|
||||
doc.view_shading = int(d.get("view_shading", doc.view_shading))
|
||||
doc.uv_snap = bool(d.get("uv_snap", doc.uv_snap))
|
||||
doc.tex_filter = int(d.get("tex_filter", doc.tex_filter))
|
||||
doc.pixel_px = int(d.get("pixel_px", doc.pixel_px))
|
||||
doc.gizmo_kind = int(d.get("gizmo_kind", doc.gizmo_kind))
|
||||
doc.brush_opacity = d.get("brush_opacity", doc.brush_opacity)
|
||||
doc.brush_smooth = d.get("brush_smooth", doc.brush_smooth)
|
||||
doc.face_lock = bool(d.get("face_lock", doc.face_lock))
|
||||
doc.inset_dist = float(d.get("inset_dist", doc.inset_dist))
|
||||
doc.hints_enabled = bool(d.get("hints_enabled", doc.hints_enabled))
|
||||
doc.show_checker = bool(d.get("show_checker", doc.show_checker))
|
||||
doc.export_checker = bool(d.get("export_checker", doc.export_checker))
|
||||
return doc.objects.size()
|
||||
|
||||
|
||||
# --------------------------------------------------------- add to scene ---
|
||||
## A node that carries a Polydoodle model: tagged by meta from this version
|
||||
## on, or simply NAMED PolydoodleModel... by older plugin versions.
|
||||
static func _is_polydoodle_node(n: Node) -> bool:
|
||||
return n is MeshInstance3D \
|
||||
and (n.has_meta("polydoodle")
|
||||
or String(n.name).begins_with("PolydoodleModel"))
|
||||
|
||||
|
||||
## Collect every Polydoodle model node under `root` (inclusive).
|
||||
static func _collect_polydoodle_nodes(root: Node, out: Array) -> void:
|
||||
if _is_polydoodle_node(root):
|
||||
out.append(root)
|
||||
for c in root.get_children():
|
||||
_collect_polydoodle_nodes(c, out)
|
||||
|
||||
|
||||
## Export the document into the current scene. The FIRST time this adds a
|
||||
## new "PolydoodleModel" node; every LATER export UPDATES that node in
|
||||
## place - the mesh resource (geometry, UVs, material, texture) is swapped,
|
||||
## while the node keeps its name, its transform (position / rotation /
|
||||
## scale set in the Godot editor) and its children. With several Polydoodle
|
||||
## models in one scene the SELECTED one is updated; if the selection is
|
||||
## ambiguous a new numbered node is added instead.
|
||||
static func add_to_scene(doc: PdDocument) -> String:
|
||||
var scene_root := EditorInterface.get_edited_scene_root()
|
||||
if scene_root == null:
|
||||
return "Open or create a scene first (Scene > New Scene), then try again."
|
||||
var mesh := build_document_mesh(doc, export_alpha_tex(doc))
|
||||
if mesh == null:
|
||||
return "Nothing to add - the document is empty."
|
||||
var existing := []
|
||||
_collect_polydoodle_nodes(scene_root, existing)
|
||||
var target: MeshInstance3D = null
|
||||
if existing.size() == 1:
|
||||
target = existing[0]
|
||||
elif existing.size() > 1:
|
||||
# several candidates: prefer the single selected one
|
||||
var sel := EditorInterface.get_selection()
|
||||
var picked := []
|
||||
for n in sel.get_selected_nodes():
|
||||
if _is_polydoodle_node(n):
|
||||
picked.append(n)
|
||||
if picked.size() == 1:
|
||||
target = picked[0]
|
||||
if target != null:
|
||||
var old_name := String(target.name)
|
||||
target.mesh = mesh
|
||||
target.owner = scene_root # keep the node saved
|
||||
var sel := EditorInterface.get_selection()
|
||||
sel.clear()
|
||||
sel.add_node(target)
|
||||
EditorInterface.mark_scene_as_unsaved()
|
||||
return "Updated %s in the current scene (position and scale kept)." % old_name
|
||||
var mi := MeshInstance3D.new()
|
||||
var name := "PolydoodleModel"
|
||||
var i := 2
|
||||
while scene_root.has_node(name):
|
||||
name = "PolydoodleModel%d" % i
|
||||
i += 1
|
||||
mi.name = name
|
||||
mi.mesh = mesh
|
||||
mi.set_meta("polydoodle", true)
|
||||
scene_root.add_child(mi)
|
||||
mi.owner = scene_root
|
||||
var sel2 := EditorInterface.get_selection()
|
||||
sel2.clear()
|
||||
sel2.add_node(mi)
|
||||
EditorInterface.mark_scene_as_unsaved()
|
||||
if existing.size() > 1:
|
||||
return ("Added %s to the current scene. Several Polydoodle models "
|
||||
+ "already exist - select the stale one and export again "
|
||||
+ "to update it in place.") % name
|
||||
return "Added %s to the current scene." % name
|
||||
@@ -0,0 +1 @@
|
||||
uid://bjj1odyy86tq
|
||||
@@ -0,0 +1 @@
|
||||
uid://d1vuvpva42t25
|
||||
@@ -0,0 +1,665 @@
|
||||
@tool
|
||||
class_name PdDocs
|
||||
## In-plugin documentation: a resizable window with a section list on the
|
||||
## left and the full user guide on the right. Covers every button, tool,
|
||||
## menu, mode and workflow of the plugin, with how-tos and use cases.
|
||||
|
||||
const ACCENT := "4da3ff"
|
||||
|
||||
# ------------------------------------------------------------- links -----
|
||||
# Public pages opened in the OS browser: from the docs window's top line
|
||||
# and from the links row at the top of the Welcome page.
|
||||
const URL_PLUGIN := "https://choco-ted.itch.io/polydoodle"
|
||||
const URL_RATE := "https://choco-ted.itch.io/polydoodle/rate?source=game"
|
||||
const URL_OTHER := "https://choco-ted.itch.io/"
|
||||
|
||||
const SECTIONS := [
|
||||
["Welcome", "welcome"],
|
||||
["The Two Workspaces", "workspaces"],
|
||||
["Toolbar Reference", "toolbar"],
|
||||
["Object Mode", "mode_object"],
|
||||
["Vertex / Edge / Face Modes", "mode_elements"],
|
||||
["Draw Mode", "mode_draw"],
|
||||
["Gizmos: Move, Scale & Rotate", "gizmos"],
|
||||
["Grid, Snapping & Views", "views"],
|
||||
["Hierarchy Panel", "hierarchy"],
|
||||
["Texture Editor: Painting", "paint"],
|
||||
["Brush, Fill & Pixel Tools", "paint_tools"],
|
||||
["Smooth & Pixel Filter Modes", "filter"],
|
||||
["Texture Resolution", "resolution"],
|
||||
["Import Images (Stickers)", "stickers"],
|
||||
["Texture Editor: Edit UV", "uv"],
|
||||
["Rotate & Scale UVs", "rotate"],
|
||||
["Undo, Save & Open", "files"],
|
||||
["Import 3D Models", "import3d"],
|
||||
["Export for Godot", "export"],
|
||||
["Keyboard & Mouse Map", "keys"],
|
||||
["Use Cases & Workflows", "usecases"],
|
||||
["Troubleshooting", "trouble"],
|
||||
]
|
||||
|
||||
const BODY := """
|
||||
[h2]Welcome to Polydoodle[/h2]
|
||||
[b]Enjoying Polydoodle?[/b] [color=#4da3ff][url=[[RATE]]]★ Rate this plugin[/url][/color] · [color=#4da3ff][url=[[PLUGIN]]]Plugin page[/url][/color] · [color=#4da3ff][url=[[OTHER]]]My other works[/url][/color]
|
||||
Polydoodle is a cute little poly modeler that lives inside the Godot
|
||||
editor. It gives you two connected workspaces: a [b]3D modeler[/b] for
|
||||
building low-poly shapes from primitives, freehand doodles and per-element
|
||||
editing, and a [b]texture editor[/b] for painting textures and editing UVs
|
||||
on those shapes. Everything you make can be exported straight into Godot
|
||||
as a mesh, a scene, an OBJ (with its texture), or dropped into the current
|
||||
scene.
|
||||
[color=#4da3ff]Use case:[/color] model a low-poly dungeon prop, paint its
|
||||
texture in the same editor, and export it - without ever leaving Godot.
|
||||
|
||||
[h2]The Two Workspaces[/h2]
|
||||
The [b]first toolbar button[/b] is a joined pair: [b]3D Editor[/b] |
|
||||
[b]Texture Editor[/b] (or press [b]6[/b]). Exactly one half is active.
|
||||
[color=#4da3ff]3D Editor[/color] - the classic quad view (Top / Perspective /
|
||||
Side / Front) with all modeling tools: selection modes, drawing, gizmos,
|
||||
mesh context menus, the hierarchy and the properties panel.
|
||||
[color=#4da3ff]Texture Editor[/color] - the 3D viewport moves to the top and
|
||||
the [b]texture canvas[/b] takes the lower half. The top toolbar swaps the
|
||||
modeling buttons for the texture tools (Paint | Edit UV, brush, fill,
|
||||
pixel, import, snap, rotate, detach) - sliders and deeper settings live in
|
||||
the right panel. The modeling buttons come back when you return to the 3D
|
||||
editor.
|
||||
|
||||
[h2]Toolbar Reference[/h2]
|
||||
[color=#4da3ff]Workspace pair[/color] - switch between the 3D editor and the
|
||||
texture editor (key 6).
|
||||
[color=#4da3ff]Object / Vertex / Edge / Face[/color] - the four selection
|
||||
modes (keys 1-4). Their buttons are exclusive: exactly one is active.
|
||||
[color=#4da3ff]Draw[/color] - a split button: the main half enters Draw mode
|
||||
(key 5) with the current shape; the small arrow half opens the shape menu
|
||||
(Freehand, Rectangle, Circle, Triangle, Pentagon, Hexagon, Star, Torus).
|
||||
The main icon always shows the current shape.
|
||||
[color=#4da3ff]Move | Scale | Rotate Gizmo[/color] - the gizmo buttons show
|
||||
the move arrows, the scale handles or the rotation rings on the selection.
|
||||
The active one is pressed; click it again to hide the gizmo. In the 3D
|
||||
workspace the keys [b]G / S / R[/b] pick the Move / Scale / Rotate gizmo
|
||||
(pressing the active one's key hides it again).
|
||||
[color=#4da3ff]Snap / Grid / Both Sides[/color] - grid snapping on/off (T,
|
||||
off by default), grid visibility (V), and rendering both sides of every
|
||||
face without backface culling (B, on by default).
|
||||
[color=#4da3ff]Add[/color] - the FIRST button of the toolbar group, right after
|
||||
the workspace switch. Insert a primitive: Cube, Plane, Cylinder,
|
||||
Sphere, Prism or Torus.
|
||||
[color=#4da3ff]Duplicate / Delete[/color] - duplicate the selection
|
||||
(Ctrl+D) or delete it (Del).
|
||||
[color=#4da3ff]Undo / Redo[/color] - step history back or forward
|
||||
(Ctrl+Z / Ctrl+Shift+Z).
|
||||
[color=#4da3ff]Save / Open[/color] - write or load a .pdoodle project file.
|
||||
[color=#4da3ff]Import Model[/color] - bring in an existing 3D model (OBJ, glTF /
|
||||
GLB, FBX) together with its textures.
|
||||
[color=#4da3ff]Export[/color] - Mesh (.tres), Scene (.tscn), OBJ
|
||||
(+ .mtl + texture PNG), or add the model to the current scene.
|
||||
[color=#4da3ff]Background color[/color] - the color swatch on the right
|
||||
tints all viewports.
|
||||
[color=#4da3ff]Gear[/color] - editor settings: 3D shading mode (Shaded + Wire,
|
||||
Shaded, Wireframe), grid visibility, the [b]Contextual Hints[/b] toggle
|
||||
that shows or hides the in-viewport tip lines, and the [b]Checkerboard[/b]
|
||||
section: [b]Show Checkerboard[/b] (hide it and every unpainted texel is
|
||||
fully transparent in all views - and exports transparent) and
|
||||
[b]Bake Into Export[/b] (force the checkerboard into every exported texture
|
||||
so nothing is transparent). The popup opens on the
|
||||
right, right-aligned under the gear, and always stays inside the plugin
|
||||
area.
|
||||
[color=#4da3ff]Book[/color] - this documentation.
|
||||
|
||||
[h2]Object Mode (1)[/h2]
|
||||
Click a shape to select it. [b]Shift+Click[/b] adds to the selection,
|
||||
clicking an already-selected object keeps the whole multi-selection so a
|
||||
drag moves every part together. Drag empty space in a 2D view to
|
||||
box-select. Drag the selection (or use the gizmo) to move it. In the 3D
|
||||
view, dragging empty space orbits and a plain click on empty space
|
||||
deselects. [b]Ctrl+drag[/b] rectangle-selects several objects at once.
|
||||
Right-click opens the object menu (Duplicate, Delete, Select All,
|
||||
Deselect) in the 3D view AND in every 2D view. The right panel edits the
|
||||
selected object's name, position and scale numerically.
|
||||
[color=#4da3ff]Use case:[/color] lay out a whole scene of props, then
|
||||
multi-select and move them as one group.
|
||||
|
||||
[h2]Vertex / Edge / Face Modes (2-4)[/h2]
|
||||
These edit the active object's elements. Click a vertex, edge or face to
|
||||
select it (Shift adds, clicking a selected one removes it), then drag to
|
||||
move it. Drag empty space in 2D views to box-select; in the 3D view
|
||||
[b]Ctrl+drag[/b] rectangle-selects. Right-click in the 3D view OR any 2D
|
||||
view offers the mesh operations of the mode:
|
||||
[b]Vertex:[/b] Merge Vertices (weld to the centroid), Delete, Select All.
|
||||
[b]Edge:[/b] Extrude Edges (push fins out of the selected edges), Delete.
|
||||
[b]Face:[/b] with several faces selected the menu offers BOTH extrude
|
||||
modes - [b]Extrude Faces (Individual)[/b] pushes every face along its
|
||||
own normal, [b]Extrude Faces (Combined)[/b] moves the whole selection
|
||||
as ONE region: edges shared between selected faces get no wall and the
|
||||
sheet lifts along the average normal, exactly like a single face. The
|
||||
selected faces MOVE in both: side walls connect the old boundary to the
|
||||
moved copy which becomes the selection (drag it to keep extruding; no
|
||||
leftover face stays behind at the old spot), [b]Inset Face(s)[/b] /
|
||||
[b]Outset Face(s)[/b] - the face's vertex ring moves toward (or away
|
||||
from) the face center in its own plane: one coplanar quad strip per
|
||||
original edge plus the smaller / larger inner face, the surface stays
|
||||
closed and NOTHING overlaps (no duplicate faces; new faces inherit the
|
||||
face's color; the depth comes from the right panel's Inset slider),
|
||||
Fill Face(s) with the current paint color, Clear Face Paint, Delete.
|
||||
[color=#4da3ff]Use case:[/color] select the top face of a cube and extrude it
|
||||
twice for a tower; select its four side vertices and merge them into a
|
||||
pyramid tip.
|
||||
|
||||
[h2]Draw Mode (5)[/h2]
|
||||
Pick a shape from the Draw split button, then drag in ANY viewport:
|
||||
[list][*][b]Freehand[/b] - sketch a closed loop; it becomes a "Doodle"
|
||||
polygon face (self-crossing loops are triangulated robustly).
|
||||
[*][b]Rectangle[/b] - drags a true rectangle.
|
||||
[*][b]Circle[/b] - drags an ellipse (Shift = circle).
|
||||
[*][b]Triangle / Pentagon / Hexagon / Star[/b] - regular n-gons fitted to
|
||||
the drag rect (Shift = square rect).
|
||||
[*][b]Torus[/b] - drags a full 3D torus; the drag defines the outer
|
||||
radius and the ring sits on the surface or plane under the cursor.[/list]
|
||||
In the 3D viewport the shape is drawn on the face under the cursor (or a
|
||||
horizontal plane through the selection) - draw straight onto walls and
|
||||
floors. The preview outline follows the drag; release to create. Every
|
||||
shape lands as a normal editable object.
|
||||
[color=#4da3ff]Use case:[/color] draw a star flat on the ground, extrude its
|
||||
face, and you have a badge; draw a torus on the floor for a ring gate.
|
||||
|
||||
[h2]Gizmos: Move, Scale & Rotate[/h2]
|
||||
The gizmo buttons show handles on the current selection's center. The
|
||||
gizmo only appears when something is actually selected: a shape in Object
|
||||
mode, or vertices / edges / faces in the element modes. With nothing
|
||||
selected, turning a gizmo on shows a notice telling you what to select.
|
||||
[b]Move gizmo:[/b] drag an axis arrow to slide the selection along that
|
||||
world axis; drag near the center chip for direct element dragging.
|
||||
[b]Scale gizmo:[/b] the axis tips are little cubes - drag one to scale
|
||||
that single axis; the [b]center cube[/b] scales the selection uniformly.
|
||||
Scale factor 1.0 is the untouched size; snapping quantizes to 0.05 steps
|
||||
when enabled. The scale gizmo works on whole objects AND on selected
|
||||
vertices/edges/faces (it scales their positions around the selection
|
||||
center). Direct dragging without the gizmo always works too.
|
||||
[b]Rotate gizmo:[/b] drag a ring to spin the selection around that axis
|
||||
(15-degree steps while snapping is on). In the 3D view there is one ring
|
||||
per world axis; in the Top/Front/Side 2D views there is a single ring
|
||||
around the view's own axis, and the object always turns the same way
|
||||
your cursor does. Rotating always edits actual vertex positions around
|
||||
the selection center.
|
||||
[color=#4da3ff]Use case:[/color] select a wall, switch to the scale gizmo, and
|
||||
drag the Y cube to change its height without touching the plan size; or
|
||||
spin a prop 45 degrees on the ground plane with the rotate ring.
|
||||
|
||||
[h2]Shading: Flat or Smooth (per object)[/h2]
|
||||
Every object carries its own shading flag. The [b]Shading[/b] row
|
||||
([b]Flat | Smooth[/b]) lives in the right panel's Object group, and each
|
||||
hierarchy row shows a small toggle for it too. [b]Flat[/b] (default)
|
||||
keeps the hard faceted low-poly look - every face shades with its own
|
||||
normal. [b]Smooth[/b] averages the normals wherever faces share a
|
||||
vertex, so rounded shapes (spheres, cylinders, tori) shade continuously.
|
||||
The flag is undoable, saved in project files, and exported: .tres/.tscn
|
||||
meshes carry the smooth normals and OBJ exports write s on / s off per
|
||||
object.
|
||||
|
||||
[h2]Grid, Snapping & Views[/h2]
|
||||
[b]Snap (S)[/b] lands moves, shapes, gizmo drags and scale factors on the
|
||||
grid. The grid step is the plugin's world unit. [b]Grid (V)[/b] hides the
|
||||
grid lines but snapping keeps working. Every viewport has corner buttons:
|
||||
the 2D views (Top/Front/Side) have a [b]flip button[/b] showing the
|
||||
opposite view (Bottom/Back/Left) - picking and painting follow the flip
|
||||
automatically - and EVERY viewport (all four 3D-modeler views, the texture
|
||||
editor's 3D viewport and the texture canvas) has an [b]expand button[/b]
|
||||
(two outward arrows) right next to it: press it and that viewport alone
|
||||
fills the whole view area, press it again (or Space) to retract to the
|
||||
previous layout. Space still expands the focused view. Wheel zooms,
|
||||
right-drag pans, middle-drag (or Alt+drag) orbits the 3D view. The gear
|
||||
menu sets the 3D shading: Shaded + Wire, Shaded, or Wireframe.
|
||||
The three 2D views render the model with the SAME texture the 3D
|
||||
viewport samples: an unpainted model shows the checkerboard placeholder
|
||||
in every view, painted texels show through everywhere, so Top/Front/Side
|
||||
always match what the model actually looks like.
|
||||
[b]Contextual hints[/b] - every viewport shows a small muted hint line at
|
||||
its bottom edge that adapts to what you are doing: select a face and it
|
||||
says "Right-click: options (EXTRUDE faces, fill, delete and more)", start
|
||||
placing an image and the canvas says "Scroll: adjust scale · Right-click:
|
||||
rotate · Click: place · Esc: cancel". The editor teaches itself - no
|
||||
manual required. Prefer a clean viewport? Switch the hints off in the
|
||||
gear menu (Editor Settings > Viewport > Contextual Hints).
|
||||
|
||||
The three 2D views render by PHYSICAL depth, not by hierarchy order:
|
||||
whatever is genuinely in front in 3D space paints last in every ortho
|
||||
view (and two interpenetrating objects interleave per face). Selection
|
||||
outlines, vertex handles and the gizmo always draw above the scene.
|
||||
|
||||
[h2]Hierarchy Panel[/h2]
|
||||
The upper right panel lists every object with its vertex count. Click to
|
||||
select it - the 3D view selects the object and shows the gizmo.
|
||||
[b]Ctrl+click[/b] toggles rows on and off, [b]Shift+click[/b] selects a
|
||||
range - multi-selecting rows works exactly like the viewport, and every
|
||||
multi-selection made in a viewport shows as multiple highlighted rows
|
||||
here. Double-click (or click again) the name to rename. The [b]eye[/b]
|
||||
hides/shows an object (hiding auto-locks it so it can never be picked by
|
||||
accident; the auto-lock releases when you show it again). The
|
||||
[b]padlock[/b] manually locks/unlocks an object: locked objects render
|
||||
but ignore picking, editing and painting.
|
||||
The five [b]stars[/b] next to the Hierarchy title are the rating shortcut:
|
||||
if Polydoodle makes your days easier, click them - it opens the plugin's
|
||||
rating page, and it genuinely helps.
|
||||
|
||||
[h2]Texture Editor: Painting[/h2]
|
||||
Press the workspace pair's [b]Texture Editor[/b] half. The toolbar now
|
||||
shows the texture tools (Brush, Fill, Fill Object, Pixel, Eraser,
|
||||
Picker, Replace, Import Image); the right panel shows paint color, the
|
||||
palette, recent colors, resolution, filter mode and tool sizes.
|
||||
The lower canvas is the object's [b]texture atlas[/b]: every face owns
|
||||
one rectangular island outlined on it. The atlas starts EMPTY - the
|
||||
checkerboard you see is a generated placeholder shown UNDER the page,
|
||||
and the page itself is fully transparent until you paint: paint lands
|
||||
only where you put it and everything else stays see-through, with the
|
||||
checker and the texel grid visible underneath. What you paint on the
|
||||
canvas IS what renders on the 3D model (unpainted texels show the
|
||||
placeholder there too), and painting directly on the 3D model lands on
|
||||
the same texels. The brush ring (or the pixel square) follows
|
||||
the cursor in BOTH the 3D viewport and the canvas. Clicking a face on
|
||||
the 3D model or an island on the canvas also selects that face, so you
|
||||
always know which island you are on.
|
||||
[color=#4da3ff]Transparency workflow[/color] - the gear menu's [b]Show
|
||||
Checkerboard[/b] switch decides what unpainted texels look like: keep it
|
||||
ON for the classic checker placeholder, or switch it OFF and every
|
||||
unpainted texel becomes FULLY TRANSPARENT in the 3D view, the 2D views
|
||||
and the canvas (the see-through preview of a transparent export). The
|
||||
[b]Bake Into Export[/b] switch next to it forces the checkerboard into
|
||||
every exported texture (mesh, scene, OBJ PNGs) so the exported result is
|
||||
NEVER transparent where nothing was painted - handy for exports that
|
||||
should keep the playful placeholder look. With both switches off, an
|
||||
exported model keeps real alpha-0 holes where nothing was painted, and
|
||||
Render Both Sides keeps every surface two-sided.
|
||||
[color=#4da3ff]Use case:[/color] paint eyes onto a character's head island
|
||||
while watching the 3D model update live.
|
||||
|
||||
[h2]Brush, Fill & Pixel Tools[/h2]
|
||||
[color=#4da3ff]Brush[/color] - paints a round stamp whose size (world units)
|
||||
is set by the Brush size slider. Strokes are texel-precise: they follow
|
||||
the surface exactly, across face borders, on the model or the canvas.
|
||||
[color=#4da3ff]Fill[/color] - repaints EXACTLY the clicked face's island,
|
||||
edge to edge, at its CURRENT UV position (moved islands are repainted
|
||||
where they render now, not at their default spot). Never spreads to
|
||||
neighbors. Fills bleed a couple of texels past the island edge so no gap
|
||||
can appear between the paint and the face border.
|
||||
[color=#4da3ff]Fill Object[/color] - repaints every island of the object at
|
||||
once.
|
||||
[color=#4da3ff]Pixel[/color] - the [b]texel-perfect[/b] pixel-art brush: it
|
||||
paints exact N x N texel blocks aligned to the atlas grid (the Pixel
|
||||
size slider is in TEXELS - 1 paints single texels), with texel lines
|
||||
joining fast strokes so nothing gaps. Pair it with the PIXEL filter mode
|
||||
for crisp results. There is no anti-aliasing and no fake half-texels:
|
||||
what you see is exactly what is painted.
|
||||
[color=#4da3ff]Eraser[/color] - brush strokes that restore transparency
|
||||
(the unpainted look: the checker placeholder shows through again). Works on the model AND the canvas; the ring cursor
|
||||
shows the erase footprint. It uses the EXACT same size, opacity, edge
|
||||
smoothness and face-lock settings as the Brush. Right-click does not
|
||||
erase - erasing belongs to the dedicated Eraser tool.
|
||||
[color=#4da3ff]Opacity & Edge smoothness[/color] - the right panel's sliders
|
||||
(Brush or Eraser active). [b]Opacity[/b] is the stamp strength: 100%
|
||||
paints solid, lower values blend see-through strokes that build up along
|
||||
the path. [b]Edge smoothness[/b] is the airbrush falloff: 0 keeps a hard
|
||||
circle edge, 1 sprays a fully soft airbrush stamp - perfect for shading
|
||||
blush, gradients and smoke.
|
||||
[color=#4da3ff]Face lock[/color] - the padlock toggle in the right panel (Brush,
|
||||
Eraser or Pixel active). When ON, a stroke stays inside the face it
|
||||
STARTED on - in the 2D canvas AND on the 3D model. Like the fill system,
|
||||
the paint reaches slightly past the face's own edges (the same bleed
|
||||
margin the Fill tool uses) so its borders are fully covered, but it never
|
||||
paints any other face or any further into empty canvas. The status line
|
||||
confirms the lock when a locked stroke starts.
|
||||
[color=#4da3ff]Picker[/color] - the eyedropper: click any texel on the
|
||||
model or the canvas and its color becomes the paint color (added to the
|
||||
Recent row). Drag it around to sample continuously. Not an undo step.
|
||||
[color=#4da3ff]Replace[/color] - click a texel: every texel of THAT color
|
||||
inside the clicked island is swapped for the current paint color (a
|
||||
couple of bleed texels included, never crossing into other islands).
|
||||
Clicking an unpainted (transparent) texel recolors the island's whole
|
||||
unpainted area. Undoable - a drag across several islands undoes as one
|
||||
sweep.
|
||||
|
||||
[h[color=#4da3ff]Replace[/color] - click a texel and every texel of that
|
||||
color on the WHOLE canvas (all faces) becomes the paint color. The
|
||||
[color=#4da3ff]Tolerance[/color] slider (right panel, shown while the
|
||||
tool is active) widens the match: 0% replaces only the exact color,
|
||||
higher values also replace nearby shades - handy for swapping a hand-
|
||||
painted gradient. One undo step returns the whole swap.
|
||||
[h2]Smooth & Pixel Filter Modes[/h2]
|
||||
The right panel's Filter buttons switch how the texture is sampled:
|
||||
[b]Smooth[/b] - the texture is linearly filtered: soft, anti-aliased
|
||||
look on the model AND in the editor. Best with the normal Brush.
|
||||
[b]Pixel[/b] - filtering is OFF on the model AND the editor canvas:
|
||||
texels render razor sharp for pixel art. The pixel brush is the natural
|
||||
tool here (switching modes auto-swaps the default tool).
|
||||
[color=#4da3ff]Use case:[/color] paint a 32x32 pixel-art skin in Pixel mode,
|
||||
then flip to Smooth to preview how it reads with filtering.
|
||||
|
||||
[h2]Texture Resolution[/h2]
|
||||
The Resolution dropdown (right panel, Texture group) changes the active
|
||||
object's atlas to 64/128/256/512/1024 per side - or pick [b]Custom...[/b]
|
||||
and type any size between 16 and 1024 texels per side (slider or number
|
||||
entry) for non-standard targets like 300 x 300. The paint is resampled
|
||||
(nearest), islands, texel density and UV offsets all scale by the same
|
||||
factor, so every stroke stays exactly where it was - just sharper or
|
||||
softer. The change is undoable and is saved in project files. A warning:
|
||||
islands that no longer fit are re-packed automatically; when the model
|
||||
is very complex the editor may also grow the atlas on its own.
|
||||
|
||||
[h2]Import Images (Stickers)[/h2]
|
||||
The [b]Import Image[/b] button (Paint submode) opens a file dialog. The
|
||||
picture then floats on the canvas as a ghost:
|
||||
[list][*]Move the mouse - the ghost follows.
|
||||
[*][b]Wheel[/b] - scales it bigger/smaller.
|
||||
[*][b]Right-click[/b] - rotates it 90 degrees.
|
||||
[*][b]Click[/b] - places it (alpha-blended into the atlas, undoable).
|
||||
[*][b]Esc[/b] - cancels.[/list]
|
||||
Afterwards the placed image is just texels: paint over it, erase parts,
|
||||
fill it. Oversized imports are auto-fit into the atlas.
|
||||
[color=#4da3ff]Use case:[/color] import a logo, scale it with the wheel,
|
||||
rotate it upright with right-click, place it on a crate's side island,
|
||||
then rough it up with the eraser.
|
||||
|
||||
[h2]Texture Editor: Edit UV[/h2]
|
||||
The [b]Edit UV[/b] toolbar button switches the texture editor to UV
|
||||
editing - the right panel swaps its paint controls for the UV toolset
|
||||
(selection mode, snapping, island actions, the Rotate / Scale sliders).
|
||||
Clicking a face on the 3D model selects it and highlights its island on
|
||||
the canvas (and the other way around).
|
||||
[b]Select mode[/b] (right panel) decides what clicks and the rectangular
|
||||
selection grab: [b]Vertex[/b], [b]Edge[/b] or [b]Face[/b]. Selection
|
||||
rules in every mode:
|
||||
[list][*]A plain click selects ONE element (replacing the selection).
|
||||
[*][b]Ctrl or Shift + click[/b] adds an element to the selection.
|
||||
[*]Grabbing an element that is part of the selection moves the WHOLE
|
||||
selection - box-select corners, then drag any one of them.
|
||||
[*]A bare click on empty canvas deselects everything.
|
||||
[*]An empty-space DRAG box-selects the active element type.[/list]
|
||||
[b]Snap[/b] (toolbar) makes UV drags land PIXEL-PERFECT on the texel
|
||||
grid: with snapping on, the dragged corners land exactly on texel
|
||||
boundaries, so the island outline aligns edge to edge with the atlas
|
||||
pixels (even for islands whose corners sit at fractional texel positions
|
||||
after vertex edits). Hold Ctrl to drag sub-texel freely.
|
||||
[b]Right-click[/b] the canvas for the mesh menu: Rotate UV 90° CW / CCW,
|
||||
Detach Selected Face(s), Merge Vertices, Extrude Face / Edges, Fill /
|
||||
Clear, Delete Face(s)/Edge(s)/Vertex(es), Select All Islands, Deselect,
|
||||
Reset UVs. [b]Detach[/b] moves the selected islands to free atlas space
|
||||
so they can be laid out individually. The HUD line shows the mode, atlas
|
||||
size and zoom.
|
||||
|
||||
|
||||
[h2]Rotate & Scale UVs[/h2]
|
||||
Two toolbar toggles (Edit UV submode) transform the selected faces' UVs
|
||||
around the selection's center; exactly one is active at a time and
|
||||
clicking the active one again switches it off.
|
||||
[b]Rotate UVs:[/b] toggling it shows an [b]Angle[/b] row in the right
|
||||
panel - drag the slider or type a number from 0 to 360 degrees and the
|
||||
islands turn live. The angle is ABSOLUTE for the current selection:
|
||||
[b]0 is the position the face had when the rotation started[/b] and 360
|
||||
is one full turn - the slider always shows the face's real total angle
|
||||
and stays where you leave it (it does not snap back to 0). Rotations
|
||||
with the quick 90-degree actions feed the same value. Changing the
|
||||
selection or the tool starts a fresh chain at 0. The whole drag is ONE
|
||||
undo step (a typed run is one step too).
|
||||
[b]Scale UVs:[/b] toggling it shows a [b]Scale %[/b] row (10-400%), and
|
||||
on the canvas you can grab any corner of the selection and drag: away
|
||||
from the center grows, toward it shrinks - always UNIFORM, so the
|
||||
aspect ratio never changes. Both tools re-derive every corner from the
|
||||
frozen press-time positions, so long drags cannot drift.
|
||||
Quick actions stay: the canvas right-click menu offers [b]Rotate UV
|
||||
90° CW / CCW[/b], and on the canvas [b]R[/b] rotates clockwise,
|
||||
[b]Shift+R[/b] counter-clockwise. One face turns about its own center;
|
||||
several selected faces transform together as one rigid group, so the
|
||||
faces of an island stay glued to each other. With [b]Snap[/b] on the
|
||||
transformed corners land exactly on the texel grid - pixel-perfect,
|
||||
like drags. Rotating and scaling move the SAMPLING window over the
|
||||
atlas: the painted texels stay where they are and the face reads them
|
||||
from the new mapping.
|
||||
[color=#4da3ff]Use case:[/color] select a character face's island, press
|
||||
R until the eyes sit level, fine-tune with the Angle slider, then paint
|
||||
details with the island nicely aligned to the texel grid; use Scale to
|
||||
fit a logo island onto a slightly smaller panel without stretching it.
|
||||
|
||||
[h2]Undo, Save & Open[/h2]
|
||||
Everything meaningful is undoable (48 steps): modeling, UV edits,
|
||||
painting, resolution changes, renames, visibility/lock, deletes.
|
||||
Ctrl+Z undoes, Ctrl+Shift+Z (or Ctrl+Y) redoes. [b]Save[/b] writes a
|
||||
.pdoodle project (all objects, textures, UVs, paint colors and editor
|
||||
settings). [b]Open[/b] restores one. The files are plain text - they
|
||||
diff nicely in version control.
|
||||
[b]Session auto-save[/b] - Polydoodle also keeps your work safe on its
|
||||
own: a moment after every change the whole document (models, paint,
|
||||
textures, settings) is stored in the editor's user data, and when you
|
||||
close Godot it is flushed immediately. Reopen the editor and everything
|
||||
is exactly where you left it - no save dialog, nothing to do. Opening a
|
||||
.pdoodle project or deleting everything simply becomes the new session.
|
||||
|
||||
[h2]Import 3D Models[/h2]
|
||||
The [color=#4da3ff]Import Model[/color] button (arrow into a tray, next to
|
||||
Open) brings an existing model into the scene and keeps its textures.
|
||||
[b]Supported files[/b] - Wavefront OBJ (with its .mtl and texture maps),
|
||||
glTF / GLB, FBX, and Godot scenes or meshes that live inside the project
|
||||
(.tscn, .scn, .tres, .res, .mesh).
|
||||
[b]What happens to the model[/b] - duplicate vertices are welded, flat
|
||||
triangle pairs are merged into quads, and the model is scaled to fit a
|
||||
2-unit box and centered. Every mesh in the file becomes its own object, so
|
||||
you can edit, hide or export the parts separately. The whole import is a
|
||||
single undo step.
|
||||
[b]Textures[/b] - Polydoodle paints every face into its own island of one
|
||||
atlas, so the model's texture is [i]re-baked[/i] into those islands rather
|
||||
than copied. Materials without a texture import as flat colors, tiling UVs
|
||||
repeat as in the original, and several materials in one mesh are kept. The
|
||||
atlas resolution follows the source texture (256 / 512 / 1024); you can
|
||||
change it afterwards in the Texture Resolution setting.
|
||||
[b]Where from[/b] - the file picker browses your whole computer, not only
|
||||
the project, and offers an "All files" filter. Duplicate faces that some
|
||||
exporters write twice are removed so nothing z-fights.
|
||||
[b]Limits[/b] - up to 5000 faces after cleanup and 32 meshes per file.
|
||||
Above 1500 faces a note warns that painting and editing get slower; this
|
||||
is a low-poly tool, so lighter models always feel best.
|
||||
Large imports show their progress in the status bar and never freeze the
|
||||
editor. Anything that could not be imported (a missing texture file, a
|
||||
broken face) is listed in a notes dialog after the import.
|
||||
[b]Tips[/b] - for OBJ keep the .mtl and texture files next to the .obj (or at
|
||||
the paths the .mtl names). Skinned or animated models import in their rest
|
||||
pose; animation, rigs and normal / roughness maps are not imported.
|
||||
|
||||
[h2]Export for Godot[/h2]
|
||||
[color=#4da3ff]Mesh (.tres)[/color] - an ArrayMesh with the painted texture
|
||||
and correct UVs; assign it to any MeshInstance3D.
|
||||
[color=#4da3ff]Scene (.tscn)[/color] - a small scene wrapping the mesh.
|
||||
[color=#4da3ff]OBJ[/color] - a Wavefront OBJ with flat shading ("s off"), a
|
||||
companion .mtl and the atlas saved as PNG per textured object. Imports
|
||||
into Blender/Unity/Godot with the texture.
|
||||
[color=#4da3ff]Add to current scene[/color] - drops a PolydoodleModel
|
||||
MeshInstance3D into the edited scene, selected and ready. Exporting again
|
||||
LATER UPDATES that same node in place: the mesh, UVs and texture are
|
||||
swapped, while the position, rotation and scale you set in the Godot
|
||||
editor (and any children) stay untouched. With several Polydoodle models
|
||||
in one scene, select the one to update before exporting.
|
||||
|
||||
[h2]Keyboard & Mouse Map[/h2]
|
||||
[font_size=12][table=3]
|
||||
[cell]1 / 2 / 3 / 4[/cell][cell]Object / Vertex / Edge / Face mode[/cell][cell][/cell]
|
||||
[cell]5[/cell][cell]Draw mode[/cell][cell][/cell]
|
||||
[cell]6[/cell][cell]Toggle workspace (3D <-> Texture)[/cell][cell][/cell]
|
||||
[cell]G / S / R (3D)[/cell][cell]Move / Scale / Rotate gizmo (active key again = hide)[/cell][cell][/cell]
|
||||
[cell]T / V / B[/cell][cell]Snap / Grid visibility / Both sides[/cell][cell][/cell]
|
||||
[cell]Ctrl+Z, Ctrl+Shift+Z[/cell][cell]Undo / Redo[/cell][cell][/cell]
|
||||
[cell]Ctrl+D[/cell][cell]Duplicate selection[/cell][cell][/cell]
|
||||
[cell]Ctrl+A[/cell][cell]Select all[/cell][cell][/cell]
|
||||
[cell]Del / Backspace[/cell][cell]Delete selection[/cell][cell][/cell]
|
||||
[cell]F[/cell][cell]Frame selection[/cell][cell][/cell]
|
||||
[cell]Space[/cell][cell]Fullscreen the focused viewport[/cell][cell][/cell]
|
||||
[cell]Esc[/cell][cell]Deselect / cancel sticker[/cell][cell][/cell]
|
||||
[cell]Shift+Click[/cell][cell]Add to selection[/cell][cell][/cell]
|
||||
[cell]Ctrl+LMB drag (3D)[/cell][cell]Rectangle multi-select[/cell][cell][/cell]
|
||||
[cell]LMB / RMB / MMB[/cell][cell]Tool action / pan / orbit[/cell][cell][/cell]
|
||||
[cell]Alt+LMB[/cell][cell]Orbit while drawing or painting[/cell][cell][/cell]
|
||||
[cell]Wheel[/cell][cell]Zoom (scale stickers while importing)[/cell][cell][/cell]
|
||||
[cell]Right-click (sticker)[/cell][cell]Rotate the image 90 degrees[/cell][cell][/cell]
|
||||
[cell]R / Shift+R (UV canvas)[/cell][cell]Rotate UV selection 90 CW / CCW[/cell][cell][/cell]
|
||||
[cell]Rotate/Scale toolbar toggles[/cell][cell]Angle 0-360 / Scale 10-400% rows in the right panel; Scale also drag-to-scale any corner[/cell][cell][/cell]
|
||||
[cell]Right-click (canvas, Edit UV)[/cell][cell]Mesh ops menu[/cell][cell][/cell]
|
||||
[cell]Right-click (3D or 2D view, edit modes)[/cell][cell]Mesh ops menu[/cell][cell][/cell]
|
||||
[cell]Ctrl/Shift+click (hierarchy)[/cell][cell]Multi-select objects[/cell][cell][/cell]
|
||||
[/table][/font_size]
|
||||
|
||||
[h2]Use Cases & Workflows[/h2]
|
||||
[color=#4da3ff]A low-poly house:[/color] add a Cube, scale it with the Scale
|
||||
gizmo; add a Prism for the roof; select both and extrude nothing - just
|
||||
paint: switch to the Texture Editor, fill the walls island with cream,
|
||||
the roof island with red, draw windows with the Pixel brush in Pixel
|
||||
mode. Export as OBJ for a game jam or .tres to use directly.
|
||||
[color=#4da3ff]A character head:[/color] add a Sphere, merge the bottom
|
||||
vertices flat, extrude the top face twice for a hat. In Edit UV, detach
|
||||
the face island, place it on empty atlas space, rotate it upright with
|
||||
Rotate UV if needed, and paint the face with the brush (Smooth mode) -
|
||||
the islands stay exactly where you packed them.
|
||||
[color=#4da3ff]Pixel-art sprite on a plane:[/color] add a Plane, set
|
||||
resolution 64, filter PIXEL, and draw with the Pixel brush at size 1 -
|
||||
the plane IS your sprite sheet. Export .tres and use it in-game.
|
||||
[color=#4da3ff]Level grayboxing:[/color] draw rectangles on the ground in
|
||||
Draw mode, extrude the faces to wall height with the Face context menu,
|
||||
duplicate around, then add everything to the current scene.
|
||||
|
||||
[h2]Troubleshooting[/h2]
|
||||
[b]The canvas says "Select an object..."[/b] - the texture editor edits
|
||||
the ACTIVE object; add or select one first.
|
||||
[b]Painting does nothing on an object[/b] - it is locked or hidden
|
||||
(padlock/eye in the hierarchy). Unlock it.
|
||||
[b]UVs look scrambled after heavy vertex drags[/b] - the mapping
|
||||
re-derives from the new geometry on the next edit; use Reset UVs (Edit
|
||||
UV menu) or the toolbar button for a clean planar unwrap.
|
||||
[b]A fill landed on the "wrong" island[/b] - fills repaint the face's
|
||||
island at its CURRENT position; the island may simply overlap another
|
||||
one's area - detach it to free space.
|
||||
[b]Imported image invisible[/b] - the atlas may be much larger than the
|
||||
sticker at scale 1.0; wheel it up, or check that the active object is
|
||||
the one you imported onto.
|
||||
[b]A message appears at the top of the viewport[/b] - Polydoodle tells you
|
||||
why an action cannot run right now and what to do: no shape in the scene,
|
||||
nothing selected, the wrong mode (for example Extrude needs Face mode, key
|
||||
4), a locked or hidden shape, nothing to undo, or a doodle that was too
|
||||
small. The message fades by itself and never blocks the mouse.
|
||||
[b]Clicking a shape does nothing[/b] - it is probably locked (padlock icon
|
||||
in the hierarchy) or hidden (eye icon). A notice names the shape; unlock or
|
||||
show it to edit it.
|
||||
[b]The gizmo is not showing[/b] - nothing is selected, the selection is
|
||||
hidden, or the shape has no geometry. Select a shape (Object mode) or
|
||||
vertices / edges / faces, and the gizmo appears on the selection.
|
||||
[b]Export does nothing[/b] - the scene is empty or every shape is hidden;
|
||||
a notice says which.
|
||||
[b]Import says the model has too many faces[/b] - the limit is 5000 faces.
|
||||
Decimate or retopologize the model in your 3D software and import again.
|
||||
[b]An imported model is white or checkered[/b] - its texture file was not
|
||||
found (see the notes dialog after importing). For OBJ, keep the texture next
|
||||
to the .obj / .mtl; for glTF use a .glb or keep the image files beside the
|
||||
.gltf.
|
||||
[b]Import is not available for a file type[/b] - scenes and meshes (.tscn,
|
||||
.tres, ...) must be inside the project; OBJ, glTF / GLB and FBX can be
|
||||
anywhere on your computer.
|
||||
[b]Export OBJ looks smooth in another app[/b] - the OBJ is written with
|
||||
"s off" (flat); some importers override shading - re-import or disable
|
||||
smooth shading there.
|
||||
"""
|
||||
|
||||
|
||||
## Build (once) and show the documentation window. The caller parents the
|
||||
## window into the editor's base control and centers it on screen
|
||||
## (an unpositioned Window opens in the top-left corner).
|
||||
static func open(existing: Window) -> Window:
|
||||
if existing != null and is_instance_valid(existing):
|
||||
existing.show()
|
||||
existing.move_to_foreground()
|
||||
return existing
|
||||
var win := Window.new()
|
||||
win.title = "Polydoodle Documentation"
|
||||
win.min_size = Vector2i(760, 520)
|
||||
win.size = Vector2i(920, 640)
|
||||
var v := VBoxContainer.new()
|
||||
v.set_anchors_and_offsets_preset(Control.PRESET_FULL_RECT)
|
||||
v.offset_left = 8
|
||||
v.offset_top = 8
|
||||
v.offset_right = -8
|
||||
v.offset_bottom = -8
|
||||
win.add_child(v)
|
||||
var head := HBoxContainer.new()
|
||||
head.add_theme_constant_override("separation", 8)
|
||||
v.add_child(head)
|
||||
var icon := TextureRect.new()
|
||||
icon.texture = PdIcons.get_icon("docs")
|
||||
icon.custom_minimum_size = Vector2(24, 24)
|
||||
icon.stretch_mode = TextureRect.STRETCH_KEEP_ASPECT_CENTERED
|
||||
head.add_child(icon)
|
||||
var title := Label.new()
|
||||
title.text = "Polydoodle Documentation"
|
||||
title.add_theme_font_size_override("font_size", 16)
|
||||
head.add_child(title)
|
||||
# top-line links (see the URL_* constants above): the plugin page, a
|
||||
# rate link and the author's other works - replace the URLs anytime
|
||||
var spacer := Control.new()
|
||||
spacer.size_flags_horizontal = Control.SIZE_EXPAND_FILL
|
||||
spacer.size_flags_vertical = Control.SIZE_SHRINK_CENTER
|
||||
head.add_child(spacer)
|
||||
for pair in [["Godot Plugin", URL_PLUGIN],
|
||||
["Rate This Plugin", URL_RATE],
|
||||
["My Other Works", URL_OTHER]]:
|
||||
var lb := LinkButton.new()
|
||||
lb.text = pair[0]
|
||||
lb.uri = pair[1] # LinkButton opens the URI in the OS browser
|
||||
lb.add_theme_font_size_override("font_size", 13)
|
||||
lb.focus_mode = Control.FOCUS_NONE
|
||||
head.add_child(lb)
|
||||
var split := HSplitContainer.new()
|
||||
split.size_flags_vertical = Control.SIZE_EXPAND_FILL
|
||||
split.size_flags_horizontal = Control.SIZE_EXPAND_FILL
|
||||
split.split_offset = 190
|
||||
v.add_child(split)
|
||||
var list := ItemList.new()
|
||||
list.custom_minimum_size = Vector2(180, 0)
|
||||
list.size_flags_vertical = Control.SIZE_EXPAND_FILL
|
||||
list.add_theme_font_size_override("font_size", 12)
|
||||
list.auto_height = false
|
||||
split.add_child(list)
|
||||
var scroll := ScrollContainer.new()
|
||||
scroll.size_flags_horizontal = Control.SIZE_EXPAND_FILL
|
||||
scroll.size_flags_vertical = Control.SIZE_EXPAND_FILL
|
||||
split.add_child(scroll)
|
||||
var rt := RichTextLabel.new()
|
||||
rt.bbcode_enabled = true
|
||||
# fit_content would expand the label and hand scrolling to the outer
|
||||
# ScrollContainer - then scroll_to_line() (which drives the label's OWN
|
||||
# scrollbar) does nothing and clicking a section never moves the page.
|
||||
# The label must own the vertical scroll for section navigation to work.
|
||||
rt.fit_content = false
|
||||
rt.size_flags_horizontal = Control.SIZE_EXPAND_FILL
|
||||
rt.size_flags_vertical = Control.SIZE_EXPAND_FILL
|
||||
# [h2] is not a supported tag in Godot 4.7 - render section headers
|
||||
# manually (same line structure, so the section->line map stays valid)
|
||||
# runtime link injection: the Welcome page opens with the same links
|
||||
# the window's top line carries, so first-time readers see them first
|
||||
var body: String = BODY.replace("[[RATE]]", URL_RATE) \
|
||||
.replace("[[PLUGIN]]", URL_PLUGIN).replace("[[OTHER]]", URL_OTHER)
|
||||
rt.text = body.replace("[h2]",
|
||||
"[b][color=#4da3ff][font_size=17]").replace("[/h2]",
|
||||
"[/font_size][/color][/b]")
|
||||
rt.add_theme_font_size_override("normal_font_size", 13)
|
||||
rt.add_theme_font_size_override("bold_font_size", 13)
|
||||
scroll.add_child(rt)
|
||||
# section -> first line in the bbcode body
|
||||
var lines := body.split("\n")
|
||||
for s in SECTIONS:
|
||||
list.add_item(s[0])
|
||||
var marker: String = "[h2]" + str(s[0])
|
||||
var ln := 0
|
||||
for i in lines.size():
|
||||
if lines[i].begins_with(marker):
|
||||
ln = i
|
||||
break
|
||||
list.set_item_metadata(list.item_count - 1, ln)
|
||||
list.item_selected.connect(func(idx: int):
|
||||
rt.scroll_to_line(int(list.get_item_metadata(idx))))
|
||||
rt.meta_clicked.connect(func(meta: Variant):
|
||||
OS.shell_open(str(meta)))
|
||||
list.select(0)
|
||||
win.close_requested.connect(func(): win.hide())
|
||||
return win
|
||||
@@ -0,0 +1 @@
|
||||
uid://dqq74eridolmo
|
||||
@@ -0,0 +1,964 @@
|
||||
@tool
|
||||
class_name PdMain
|
||||
extends VBoxContainer
|
||||
## Polydoodle main screen: toolbar | quad views (Top/Persp/Side/Front) | panel.
|
||||
|
||||
const VIEW2D := preload("res://addons/polydoodle/editor/pd_view2d.gd")
|
||||
const VIEW3D := preload("res://addons/polydoodle/editor/pd_view3d.gd")
|
||||
const TOOLBAR := preload("res://addons/polydoodle/editor/pd_toolbar.gd")
|
||||
const PANEL := preload("res://addons/polydoodle/editor/pd_panel.gd")
|
||||
const UVCANVAS := preload("res://addons/polydoodle/editor/pd_uvcanvas.gd")
|
||||
|
||||
var doc: PdDocument
|
||||
var toolbar: PdToolbar
|
||||
var panel: PdPanel
|
||||
var view3d: PdView3D
|
||||
var views2d: Array = [] # [top, side, front]
|
||||
var status_label: Label
|
||||
var hint_label: Label
|
||||
|
||||
var view_holder: Control
|
||||
var _split: HSplitContainer # views | panel - width-clamped drags
|
||||
var _fullscreen_view: Control = null
|
||||
var _focused_view: Control = null
|
||||
var _dlg: EditorFileDialog
|
||||
var _file_dlg: EditorFileDialog # image import dialog
|
||||
var _expand_syncing := false # guard while pushing pressed states out
|
||||
|
||||
# Texture Paint mode: 3D viewport on top, UV canvas below. The tool
|
||||
# buttons live IN THE TOP TOOLBAR (the texture group replaces the
|
||||
# modeling buttons); sliders and deeper options live in the right panel.
|
||||
var uv_canvas: PdUVCanvas
|
||||
var _last_canvas_size := Vector2.ZERO
|
||||
var last_3d_mode: int = PdDocument.Mode.OBJECT # workspace memory
|
||||
|
||||
const PANEL_MIN_W := 240.0 # panel floor (also on the panel itself):
|
||||
# SplitContainer refuses to shrink it below
|
||||
const VIEW_MIN_W := 410.0 # hard floor for the quad views: must fit
|
||||
# TWO columns of view3d's own 200px minimum
|
||||
# width (+ gap) or view3d gets clamped wider
|
||||
# than its allotted half and visually spills
|
||||
# out of view_holder into the panel next to
|
||||
# it. Was 300 (only 150/column) - too small
|
||||
# for view3d's 200 floor, which is exactly
|
||||
# what caused the 3D viewport / panel
|
||||
# overlap when the panel was dragged wide.
|
||||
|
||||
|
||||
func _init() -> void:
|
||||
doc = PdDocument.new()
|
||||
set_anchors_and_offsets_preset(Control.PRESET_FULL_RECT)
|
||||
size_flags_horizontal = Control.SIZE_EXPAND_FILL
|
||||
size_flags_vertical = Control.SIZE_EXPAND_FILL
|
||||
add_theme_constant_override("separation", 4)
|
||||
_build_ui()
|
||||
doc.doc_changed.connect(_on_doc_changed)
|
||||
doc.sel_changed.connect(_on_doc_changed)
|
||||
doc.settings_changed.connect(_on_doc_changed)
|
||||
doc.undo.version_changed.connect(_on_doc_changed)
|
||||
doc.status_msg.connect(func(t: String): set_status(t))
|
||||
doc.warning_msg.connect(show_toast)
|
||||
_setup_autosave()
|
||||
set_status("Welcome to Polydoodle - add a shape or switch to Draw mode and doodle one!")
|
||||
hint_label.text = _hint_text()
|
||||
|
||||
|
||||
func _build_ui() -> void:
|
||||
toolbar = TOOLBAR.new()
|
||||
toolbar.setup(doc)
|
||||
toolbar.mode_requested.connect(_set_mode)
|
||||
# the two-half workspace switch: left = 3D editor (restore the last
|
||||
# 3D mode), right = texture editor
|
||||
toolbar.workspace_requested.connect(func(tex: bool):
|
||||
_set_mode(PdDocument.Mode.TEXTURE if tex else last_3d_mode))
|
||||
toolbar.toggle_gizmo.connect(func(v: bool):
|
||||
doc.set_gizmo(v)
|
||||
_sync()
|
||||
if v:
|
||||
_warn_gizmo_target())
|
||||
toolbar.toggle_snap.connect(func(v: bool): doc.set_snap(v))
|
||||
toolbar.toggle_grid.connect(func(v: bool): doc.set_grid_visible(v))
|
||||
toolbar.toggle_both_sides.connect(func(v: bool): doc.set_both_sides(v))
|
||||
toolbar.draw_kind.connect(func(k: String): doc.set_draw_kind(k))
|
||||
toolbar.add_shape.connect(func(kind: String):
|
||||
doc.add_primitive(kind)
|
||||
frame_selection())
|
||||
toolbar.duplicate_requested.connect(func(): doc.duplicate_selected())
|
||||
toolbar.delete_requested.connect(func(): doc.delete_selection())
|
||||
toolbar.undo_requested.connect(doc.do_undo)
|
||||
toolbar.redo_requested.connect(doc.do_redo)
|
||||
toolbar.save_requested.connect(_save_project)
|
||||
toolbar.load_requested.connect(_open_project)
|
||||
toolbar.import_model_requested.connect(_import_model)
|
||||
toolbar.export_requested.connect(_export)
|
||||
toolbar.bg_changed.connect(func(c: Color): doc.set_bg(c))
|
||||
# texture-editor toolbar group: submode + contextual tools
|
||||
toolbar.tex_submode.connect(func(edit: bool): doc.set_tex_edit(edit))
|
||||
toolbar.paint_tool_requested.connect(func(t: String): doc.set_paint_tool(t))
|
||||
toolbar.uv_snap_requested.connect(func(v: bool): doc.set_uv_snap(v))
|
||||
toolbar.rotate_uv_requested.connect(func(dir: int):
|
||||
doc.rotate_uv_selected(doc.active_obj, dir))
|
||||
toolbar.uv_tool_requested.connect(func(t: String):
|
||||
doc.set_uv_tool(t))
|
||||
toolbar.import_requested.connect(_import_image)
|
||||
toolbar.detach_requested.connect(func():
|
||||
doc.uv_detach_selected(doc.active_obj))
|
||||
toolbar.reset_uvs_requested.connect(func():
|
||||
doc.uv_reset_object(doc.active_obj))
|
||||
# Scroll wrap: the toolbar's own minimum width must never push
|
||||
# the layout wider than the main screen (that shoved the panel
|
||||
# off-screen and stretched the viewports on smaller windows).
|
||||
var tb_scroll := ScrollContainer.new()
|
||||
tb_scroll.horizontal_scroll_mode = ScrollContainer.SCROLL_MODE_AUTO
|
||||
tb_scroll.vertical_scroll_mode = ScrollContainer.SCROLL_MODE_DISABLED
|
||||
tb_scroll.size_flags_horizontal = Control.SIZE_EXPAND_FILL
|
||||
toolbar.size_flags_horizontal = Control.SIZE_EXPAND_FILL
|
||||
tb_scroll.add_child(toolbar)
|
||||
add_child(tb_scroll)
|
||||
|
||||
var split := HSplitContainer.new()
|
||||
split.size_flags_vertical = Control.SIZE_EXPAND_FILL
|
||||
split.size_flags_horizontal = Control.SIZE_EXPAND_FILL
|
||||
split.add_theme_constant_override("separation", 8)
|
||||
_split = split
|
||||
add_child(split)
|
||||
|
||||
# Classic quad view, same format as the earlier version:
|
||||
# TOP (top-left) | PERSPECTIVE (top-right)
|
||||
# SIDE (bottom-left) | FRONT (bottom-right)
|
||||
view_holder = Control.new()
|
||||
# engine-level floor: the splitter itself refuses to shrink the
|
||||
# views below this, so the panel can never be dragged over them
|
||||
view_holder.custom_minimum_size = Vector2(VIEW_MIN_W, 0)
|
||||
view_holder.size_flags_vertical = Control.SIZE_EXPAND_FILL
|
||||
view_holder.size_flags_horizontal = Control.SIZE_EXPAND_FILL
|
||||
# belt-and-braces: even if some child ever reports a minimum size
|
||||
# wider than its allotted quadrant, clip it here instead of letting
|
||||
# it bleed into the panel next door.
|
||||
view_holder.clip_contents = true
|
||||
split.add_child(view_holder)
|
||||
|
||||
var v_top: PdView2D = VIEW2D.new()
|
||||
v_top.setup(doc, self, 0)
|
||||
view_holder.add_child(v_top)
|
||||
views2d.append(v_top)
|
||||
|
||||
view3d = VIEW3D.new()
|
||||
view3d.setup(doc, self)
|
||||
view3d.custom_minimum_size = Vector2(200, 150)
|
||||
view_holder.add_child(view3d)
|
||||
|
||||
var v_side: PdView2D = VIEW2D.new()
|
||||
v_side.setup(doc, self, 2)
|
||||
view_holder.add_child(v_side)
|
||||
views2d.append(v_side)
|
||||
|
||||
var v_front: PdView2D = VIEW2D.new()
|
||||
v_front.setup(doc, self, 1)
|
||||
view_holder.add_child(v_front)
|
||||
views2d.append(v_front)
|
||||
|
||||
for v in all_views():
|
||||
v.focus_entered.connect(func(): _focused_view = v)
|
||||
view_holder.resized.connect(_relayout_views)
|
||||
|
||||
# Texture-mode canvas (hidden until Texture mode). Its tools live
|
||||
# in the toolbar; its settings live in the right panel.
|
||||
uv_canvas = UVCANVAS.new()
|
||||
uv_canvas.setup(doc, self)
|
||||
view_holder.add_child(uv_canvas)
|
||||
uv_canvas.visible = false
|
||||
uv_canvas.focus_entered.connect(func(): _focused_view = uv_canvas)
|
||||
|
||||
panel = PANEL.new()
|
||||
panel.setup(doc, self)
|
||||
panel.custom_minimum_size = Vector2(240, 0)
|
||||
split.add_child(panel)
|
||||
|
||||
var status := HBoxContainer.new()
|
||||
status.add_theme_constant_override("separation", 10)
|
||||
add_child(status)
|
||||
hint_label = Label.new()
|
||||
hint_label.text = ""
|
||||
hint_label.add_theme_font_size_override("font_size", 11)
|
||||
hint_label.add_theme_color_override("font_color", Color(1, 1, 1, 0.4))
|
||||
hint_label.size_flags_horizontal = Control.SIZE_EXPAND_FILL
|
||||
hint_label.clip_text = true
|
||||
status.add_child(hint_label)
|
||||
status_label = Label.new()
|
||||
status_label.text = ""
|
||||
status_label.add_theme_font_size_override("font_size", 11)
|
||||
status_label.add_theme_color_override("font_color", Color(1, 1, 1, 0.55))
|
||||
status_label.clip_text = true # long status text must not force width
|
||||
status.add_child(status_label)
|
||||
|
||||
split.split_offset = -250
|
||||
split.collapsed = false
|
||||
_relayout_views.call_deferred()
|
||||
_build_toast()
|
||||
|
||||
|
||||
# -------------------------------------------------------------- toast ---
|
||||
## A short notice that floats over the top of the main screen. It is a raised
|
||||
## card in the plugin's own style (flat dark fill, darker bottom edge) and is
|
||||
## sized from the real text metrics - no auto-wrapping label - so its height
|
||||
## can never drift away from its content.
|
||||
var _toast: PanelContainer
|
||||
var _toast_label: Label
|
||||
var _toast_tween: Tween
|
||||
const TOAST_SECONDS := 3.8
|
||||
const TOAST_FONT := 12
|
||||
const TOAST_MAX_WIDTH := 560.0
|
||||
const TOAST_MAX_LINES := 4
|
||||
const TOAST_PAD_X := 14.0
|
||||
|
||||
|
||||
func _build_toast() -> void:
|
||||
_toast = PanelContainer.new()
|
||||
_toast.top_level = true # floats over the layout
|
||||
_toast.mouse_filter = Control.MOUSE_FILTER_IGNORE
|
||||
_toast.clip_contents = true
|
||||
_toast.z_index = 100
|
||||
_toast.visible = false
|
||||
var sb := StyleBoxFlat.new()
|
||||
sb.bg_color = Color(0.215, 0.235, 0.285)
|
||||
sb.set_corner_radius_all(5)
|
||||
sb.border_width_bottom = 3 # darker lower edge: raised look
|
||||
sb.border_color = Color(0.105, 0.115, 0.145)
|
||||
sb.content_margin_left = TOAST_PAD_X
|
||||
sb.content_margin_right = TOAST_PAD_X
|
||||
sb.content_margin_top = 7
|
||||
sb.content_margin_bottom = 10 # 7 of padding + the 3 px lower edge
|
||||
_toast.add_theme_stylebox_override("panel", sb)
|
||||
_toast_label = Label.new()
|
||||
_toast_label.add_theme_font_size_override("font_size", TOAST_FONT)
|
||||
_toast_label.add_theme_color_override("font_color", Color(1, 1, 1, 0.92))
|
||||
_toast_label.mouse_filter = Control.MOUSE_FILTER_IGNORE
|
||||
# the editor theme pads labels; the card does its own padding
|
||||
_toast_label.add_theme_stylebox_override("normal", StyleBoxEmpty.new())
|
||||
_toast.add_child(_toast_label)
|
||||
add_child(_toast)
|
||||
resized.connect(_place_toast)
|
||||
visibility_changed.connect(func():
|
||||
if not is_visible_in_tree() and _toast != null:
|
||||
_toast.visible = false)
|
||||
|
||||
|
||||
## Greedy word wrap using the font's real metrics. A word that cannot fit on
|
||||
## a line by itself (a long file path, say) is broken across lines. At most
|
||||
## `max_lines` lines are returned; the last one ends in "..." when cut.
|
||||
func _wrap_text(text: String, font: Font, font_size: int, max_w: float,
|
||||
max_lines := 1000) -> PackedStringArray:
|
||||
var lines := PackedStringArray()
|
||||
var cur := ""
|
||||
for token in text.split(" ", false):
|
||||
var word: String = token
|
||||
while word.length() > 1 and font.get_string_size(word,
|
||||
HORIZONTAL_ALIGNMENT_LEFT, -1, font_size).x > max_w:
|
||||
var n := word.length()
|
||||
while n > 1 and font.get_string_size(word.substr(0, n),
|
||||
HORIZONTAL_ALIGNMENT_LEFT, -1, font_size).x > max_w:
|
||||
n -= 1
|
||||
if not cur.is_empty():
|
||||
lines.append(cur)
|
||||
cur = ""
|
||||
lines.append(word.substr(0, n))
|
||||
word = word.substr(n)
|
||||
var cand: String = word if cur.is_empty() else cur + " " + word
|
||||
if cur.is_empty() or font.get_string_size(cand,
|
||||
HORIZONTAL_ALIGNMENT_LEFT, -1, font_size).x <= max_w:
|
||||
cur = cand
|
||||
else:
|
||||
lines.append(cur)
|
||||
cur = word
|
||||
if not cur.is_empty():
|
||||
lines.append(cur)
|
||||
if lines.size() > max_lines:
|
||||
lines.resize(max_lines)
|
||||
var last := lines[max_lines - 1]
|
||||
while last.length() > 1 and font.get_string_size(last + "...",
|
||||
HORIZONTAL_ALIGNMENT_LEFT, -1, font_size).x > max_w:
|
||||
last = last.substr(0, last.length() - 1)
|
||||
lines[max_lines - 1] = last + "..."
|
||||
return lines
|
||||
|
||||
|
||||
func _place_toast() -> void:
|
||||
if _toast == null or not _toast.visible:
|
||||
return
|
||||
var top := (toolbar.size.y if toolbar != null else 40.0) + 10.0
|
||||
var x := clampf((size.x - _toast.size.x) * 0.5, 8.0,
|
||||
maxf(8.0, size.x - _toast.size.x - 8.0))
|
||||
_toast.global_position = global_position + Vector2(x, top)
|
||||
|
||||
|
||||
## Show a notice. Replaces the previous one; fades out by itself.
|
||||
func show_toast(text: String) -> void:
|
||||
if _toast == null or text.is_empty() or not is_visible_in_tree():
|
||||
return
|
||||
var font := _toast_label.get_theme_font("font")
|
||||
var card_w := clampf(size.x - 48.0, 200.0, TOAST_MAX_WIDTH)
|
||||
var lines := _wrap_text(text, font, TOAST_FONT,
|
||||
card_w - TOAST_PAD_X * 2.0, TOAST_MAX_LINES)
|
||||
_toast_label.text = "\n".join(lines)
|
||||
# explicit size from the text metrics: widest line + padding, one text
|
||||
# row per line - the label never wraps by itself
|
||||
var widest := 0.0
|
||||
for l in lines:
|
||||
widest = maxf(widest, font.get_string_size(l,
|
||||
HORIZONTAL_ALIGNMENT_LEFT, -1, TOAST_FONT).x)
|
||||
var sb := _toast.get_theme_stylebox("panel") as StyleBoxFlat
|
||||
var gap := float(_toast_label.get_theme_constant("line_spacing"))
|
||||
var card := Vector2(
|
||||
minf(widest + TOAST_PAD_X * 2.0 + 2.0, card_w),
|
||||
lines.size() * font.get_height(TOAST_FONT) + (lines.size() - 1) * gap
|
||||
+ sb.content_margin_top + sb.content_margin_bottom)
|
||||
_toast.custom_minimum_size = card
|
||||
_toast.size = card
|
||||
_toast.visible = true
|
||||
_place_toast()
|
||||
_toast.modulate.a = 1.0
|
||||
if _toast_tween != null and _toast_tween.is_valid():
|
||||
_toast_tween.kill()
|
||||
_toast_tween = create_tween()
|
||||
_toast_tween.tween_interval(TOAST_SECONDS)
|
||||
_toast_tween.tween_property(_toast, "modulate:a", 0.0, 0.45)
|
||||
_toast_tween.tween_callback(func(): _toast.visible = false)
|
||||
|
||||
|
||||
# ------------------------------------------------------------- status ---
|
||||
func set_status(text: String) -> void:
|
||||
if status_label:
|
||||
status_label.text = text
|
||||
|
||||
|
||||
func _on_doc_changed() -> void:
|
||||
_sync()
|
||||
|
||||
|
||||
func _sync() -> void:
|
||||
toolbar.sync_from_doc()
|
||||
hint_label.text = _hint_text()
|
||||
|
||||
|
||||
func _hint_text() -> String:
|
||||
if not doc.hints_enabled:
|
||||
return ""
|
||||
return MODE_HINTS.get(doc.mode, "") + HINT_TAIL
|
||||
|
||||
|
||||
func all_views() -> Array:
|
||||
return [views2d[0], view3d, views2d[1], views2d[2]]
|
||||
|
||||
|
||||
# ------------------------------------------------------ session ---
|
||||
## SAVE SYSTEM: the document autosaves to user:// (debounced) and is
|
||||
## restored when the editor reopens, so closing Godot and coming back
|
||||
## brings the models back exactly as they were left.
|
||||
var _autosave: Timer
|
||||
|
||||
|
||||
func _setup_autosave() -> void:
|
||||
_autosave = Timer.new()
|
||||
_autosave.one_shot = true
|
||||
_autosave.wait_time = 2.0
|
||||
_autosave.timeout.connect(_autosave_now)
|
||||
add_child(_autosave)
|
||||
doc.doc_changed.connect(_kick_autosave)
|
||||
doc.settings_changed.connect(_kick_autosave)
|
||||
|
||||
|
||||
func _kick_autosave() -> void:
|
||||
if _autosave != null:
|
||||
_autosave.start()
|
||||
|
||||
|
||||
func _autosave_now() -> void:
|
||||
# never serialize from inside a live gesture: the pause that lets
|
||||
# the timer fire would stall the drag mid-stroke. Retry when the
|
||||
# gesture ends; skip entirely when nothing changed since last time.
|
||||
if doc.gesture_depth > 0:
|
||||
_autosave.start()
|
||||
return
|
||||
if not doc.session_dirty:
|
||||
return
|
||||
var err := PdIo.save_session(doc)
|
||||
if err == OK:
|
||||
doc.session_dirty = false
|
||||
|
||||
|
||||
## Immediate flush (editor quit / plugin disable). Called by the plugin
|
||||
## BEFORE the screen is freed.
|
||||
func persist_session() -> void:
|
||||
if _autosave != null and not _autosave.is_stopped():
|
||||
_autosave.stop()
|
||||
if not doc.session_dirty:
|
||||
return
|
||||
var err := PdIo.save_session(doc)
|
||||
if err != OK:
|
||||
push_warning("Polydoodle: session save failed: %s"
|
||||
% error_string(err))
|
||||
else:
|
||||
doc.session_dirty = false
|
||||
|
||||
|
||||
## Load the saved session (if any) into the fresh document at startup.
|
||||
## Missing / corrupt file = silently start empty.
|
||||
func restore_session() -> void:
|
||||
var d := PdIo.load_session()
|
||||
if d.is_empty():
|
||||
return
|
||||
var n := PdIo.apply_session(doc, d)
|
||||
if n < 0:
|
||||
return
|
||||
var m := int(d.get("mode", PdDocument.Mode.OBJECT))
|
||||
if m < 0 or m > PdDocument.Mode.TEXTURE:
|
||||
m = PdDocument.Mode.OBJECT
|
||||
if m == PdDocument.Mode.TEXTURE:
|
||||
doc.set_tex_edit(bool(d.get("tex_edit", false)))
|
||||
_set_mode(m)
|
||||
doc.notify_doc()
|
||||
doc.settings_changed.emit()
|
||||
set_status("Session restored - %d object(s), right where you left them" % n)
|
||||
frame_selection()
|
||||
|
||||
|
||||
func _notification(what: int) -> void:
|
||||
if what == NOTIFICATION_EXIT_TREE:
|
||||
persist_session()
|
||||
elif what == NOTIFICATION_PREDELETE:
|
||||
if doc != null:
|
||||
doc.release()
|
||||
|
||||
|
||||
# ------------------------------------------------- in-viewport hints ---
|
||||
## One-line contextual hints drawn INSIDE each viewport (small muted text
|
||||
## at the bottom), so the editor teaches itself without reading the docs:
|
||||
## with a face or vertex selected the viewport says "Right-click: options
|
||||
## (extrude, delete...)", the texture canvas announces "wheel: scale ·
|
||||
## right-click: rotate" while an image is being placed, and so on.
|
||||
## kind: "3d" (perspective view), "2d" (orthographic views), "canvas"
|
||||
## (texture canvas). The sticker hint itself is drawn by PdUVCanvas.
|
||||
static func context_hint(doc: PdDocument, kind: String) -> String:
|
||||
if doc == null or not doc.hints_enabled:
|
||||
return ""
|
||||
var empty_3d := "Ctrl+drag: rectangle select" if kind == "3d" \
|
||||
else "drag empty space: box-select"
|
||||
match doc.mode:
|
||||
PdDocument.Mode.OBJECT:
|
||||
if doc.sel_objs.is_empty():
|
||||
return "Click a shape to select it · Shift+click: add · %s" % empty_3d
|
||||
return "Drag: move · Right-click: options (duplicate, delete and more) · Ctrl+drag: rectangle select · Del: delete"
|
||||
PdDocument.Mode.VERTEX:
|
||||
if doc.sel_verts.is_empty():
|
||||
return "Click a vertex to select it (Shift adds) · %s" % empty_3d
|
||||
return "Drag: move · Right-click: options (merge, delete and more) · Del: delete"
|
||||
PdDocument.Mode.EDGE:
|
||||
if doc.sel_edges.is_empty():
|
||||
return "Click an edge to select it (Shift adds) · %s" % empty_3d
|
||||
return "Drag: move · Right-click: options (EXTRUDE edges, delete and more) · Del: delete"
|
||||
PdDocument.Mode.FACE:
|
||||
if doc.sel_faces.is_empty():
|
||||
return "Click inside a face to select it (Shift adds) · %s" % empty_3d
|
||||
return "Drag: move · Right-click: options (EXTRUDE faces, fill, delete and more) · Del: delete"
|
||||
PdDocument.Mode.DRAW:
|
||||
return "Drag to sketch a shape · Shift: square/circle · Right-click: cancel · pick the shape on the Draw button"
|
||||
PdDocument.Mode.TEXTURE:
|
||||
if kind == "canvas":
|
||||
if doc.tex_edit:
|
||||
return "Drag islands/edges/corners to move · Right-click: options (extrude, merge, delete and more) · Wheel: zoom · MMB: pan"
|
||||
return "Drag: paint · Click an island to select it · Wheel: zoom · MMB: pan"
|
||||
if doc.tex_edit:
|
||||
return "Click a face to select it · Drag empty space: orbit"
|
||||
return "Drag on the model: paint · the Eraser tool removes paint · Wheel: zoom"
|
||||
return ""
|
||||
|
||||
|
||||
# ------------------------------------------------------ texture strip ---
|
||||
## Layout note: the texture tools live IN THE TOP TOOLBAR - the texture
|
||||
## group replaces the modeling buttons when the texture editor is active,
|
||||
## and the sliders/settings live in the right panel, so the canvas gets
|
||||
## the full lower area.
|
||||
|
||||
|
||||
func _relayout_views() -> void:
|
||||
if view_holder == null:
|
||||
return
|
||||
var r := Rect2(Vector2.ZERO, view_holder.size)
|
||||
var gap := 2.0
|
||||
# ---- Texture Paint layout: 3D on top, texture canvas below (the
|
||||
# canvas owns the full lower area - the tools live in the
|
||||
# top toolbar)
|
||||
if doc != null and doc.mode == PdDocument.Mode.TEXTURE \
|
||||
and _fullscreen_view == null:
|
||||
var gap2 := gap * 2.0
|
||||
var avail := maxf(160.0, r.size.y - gap2)
|
||||
var top_h := avail * 0.52
|
||||
top_h = clampf(top_h, 90.0, avail - 90.0)
|
||||
for v in views2d:
|
||||
v.visible = false
|
||||
view3d.visible = true
|
||||
view3d.position = r.position
|
||||
view3d.size = Vector2(r.size.x, top_h)
|
||||
uv_canvas.visible = true
|
||||
uv_canvas.position = Vector2(0, top_h + gap)
|
||||
uv_canvas.size = Vector2(r.size.x, avail - top_h)
|
||||
# refit the canvas when the layout resized it (a stale zoom
|
||||
# made the atlas appear cut off after workspace switches)
|
||||
_refit_canvas_if_resized()
|
||||
return
|
||||
if uv_canvas != null:
|
||||
uv_canvas.visible = false
|
||||
var half := (r.size - Vector2.ONE * gap) * 0.5
|
||||
var vs := all_views()
|
||||
if _fullscreen_view != null:
|
||||
# one view alone fills the area. In the texture editor the
|
||||
# expanded view can be the canvas itself.
|
||||
var fsvs := vs.duplicate()
|
||||
if doc != null and doc.mode == PdDocument.Mode.TEXTURE:
|
||||
fsvs.append(uv_canvas)
|
||||
for v in fsvs:
|
||||
v.visible = v == _fullscreen_view
|
||||
v.position = r.position
|
||||
v.size = r.size
|
||||
if _fullscreen_view == uv_canvas:
|
||||
_refit_canvas_if_resized()
|
||||
return
|
||||
var pos := [Vector2.ZERO,
|
||||
Vector2(r.size.x * 0.5 + gap * 0.5, 0.0),
|
||||
Vector2(0.0, r.size.y * 0.5 + gap * 0.5),
|
||||
Vector2(r.size.x * 0.5 + gap * 0.5, r.size.y * 0.5 + gap * 0.5)]
|
||||
for i in vs.size():
|
||||
vs[i].visible = true
|
||||
vs[i].position = pos[i]
|
||||
vs[i].size = half
|
||||
|
||||
|
||||
## Re-fit the canvas zoom when the layout changed its size (shared by the
|
||||
## normal texture layout and the expanded-canvas layout).
|
||||
func _refit_canvas_if_resized() -> void:
|
||||
if uv_canvas == null or not uv_canvas.visible:
|
||||
return
|
||||
if uv_canvas.size.distance_squared_to(_last_canvas_size) > 1.0:
|
||||
_last_canvas_size = uv_canvas.size
|
||||
uv_canvas.fit_view.call_deferred()
|
||||
|
||||
|
||||
func _toggle_view_fullscreen() -> void:
|
||||
if view_holder == null or views2d.size() < 3:
|
||||
return
|
||||
_toggle_expand(_focused_view if _focused_view != null else view3d)
|
||||
|
||||
|
||||
## Expand/retract ONE viewport (corner button or Space): the
|
||||
## expanded view alone fills the whole view area, pressing again retracts
|
||||
## to the previous layout. Works for all six views: Top/Side/Front, the
|
||||
## perspective 3D view and the texture canvas.
|
||||
func _toggle_expand(v: Control) -> void:
|
||||
if view_holder == null or v == null:
|
||||
return
|
||||
_fullscreen_view = null if _fullscreen_view == v else v
|
||||
if _fullscreen_view == null:
|
||||
set_status("View restored")
|
||||
else:
|
||||
set_status("View expanded - press the button again (or Space) to show all views")
|
||||
_relayout_views()
|
||||
_sync_expand_btns()
|
||||
|
||||
|
||||
## Mirror the expanded state on every view's corner toggle button.
|
||||
func _sync_expand_btns() -> void:
|
||||
if _expand_syncing:
|
||||
return
|
||||
_expand_syncing = true
|
||||
var all: Array = all_views()
|
||||
if uv_canvas != null:
|
||||
all.append(uv_canvas)
|
||||
for v in all:
|
||||
if v != null and "expand_btn" in v \
|
||||
and v.expand_btn != null \
|
||||
and is_instance_valid(v.expand_btn):
|
||||
v.expand_btn.set_pressed_no_signal(
|
||||
_fullscreen_view == v)
|
||||
_expand_syncing = false
|
||||
|
||||
|
||||
const HINT_TAIL := " · Space: expand focused view"
|
||||
|
||||
const MODE_HINTS := {
|
||||
PdDocument.Mode.OBJECT: "Click: select · Drag: move · Shift+Click: multi-select · 2D: drag empty = box-select · 3D: drag empty = orbit · Ctrl+drag: rectangle multi-select · right-click: object menu · Ctrl+D: duplicate",
|
||||
PdDocument.Mode.VERTEX: "Drag a vertex to move it · Shift+Click: add · 2D: drag empty = box-select · 3D: Ctrl+drag: rectangle select · right-click: merge / delete menu · Del: delete",
|
||||
PdDocument.Mode.EDGE: "Click an edge, drag to move · Shift+Click: add · 3D: right-click: EXTRUDE edges / delete · Del: delete",
|
||||
PdDocument.Mode.FACE: "Click inside a face, drag to move · Shift+Click: add · 3D: right-click: EXTRUDE face(s) / fill / delete · Del: delete",
|
||||
PdDocument.Mode.DRAW: "Drag in ANY viewport to sketch - pick the shape from the dropdown on the Draw button · Shift: square/circle · Right-drag: pan · MMB or Alt+drag: orbit · Right-click: cancel",
|
||||
PdDocument.Mode.TEXTURE: "Texture editor · tools: TOP TOOLBAR · sizes, color, resolution: RIGHT PANEL · full guide: the book button",
|
||||
}
|
||||
|
||||
|
||||
func _set_mode(m: int) -> void:
|
||||
# workspace memory: remember the last 3D mode so the Texture
|
||||
# Editor button and KEY_6 can toggle back to where the user was
|
||||
if m != PdDocument.Mode.TEXTURE:
|
||||
last_3d_mode = m
|
||||
else:
|
||||
_fullscreen_view = null
|
||||
_sync_expand_btns()
|
||||
doc.set_mode(m)
|
||||
hint_label.text = _hint_text()
|
||||
_relayout_views()
|
||||
_sync()
|
||||
|
||||
|
||||
## Toggle between the two workspaces (the toolbar split button, KEY_6).
|
||||
func toggle_workspace() -> void:
|
||||
if doc.mode == PdDocument.Mode.TEXTURE:
|
||||
_set_mode(last_3d_mode)
|
||||
else:
|
||||
_set_mode(PdDocument.Mode.TEXTURE)
|
||||
|
||||
|
||||
func frame_selection() -> void:
|
||||
if doc.objects.is_empty():
|
||||
doc.warn("Nothing to frame. The scene is empty - add a shape first.")
|
||||
return
|
||||
view3d.frame_selection()
|
||||
|
||||
|
||||
# ---------------------------------------------------------- shortcuts ---
|
||||
## G / S / R pick the Move / Scale / Rotate gizmo, Blender-style. The key
|
||||
## for the kind that is ALREADY active hides the gizmo again - the exact
|
||||
## semantics of the toolbar's [Move] [Scale] [Rotate] toggles.
|
||||
func _gizmo_shortcut(kind: int) -> void:
|
||||
if doc.gizmo_on and doc.gizmo_kind == kind:
|
||||
doc.set_gizmo(false)
|
||||
else:
|
||||
doc.set_gizmo_kind(kind)
|
||||
doc.set_gizmo(true)
|
||||
_warn_gizmo_target()
|
||||
|
||||
|
||||
func _warn_gizmo_target() -> void:
|
||||
var hint := doc.gizmo_hint()
|
||||
if hint != "":
|
||||
doc.warn(hint)
|
||||
|
||||
|
||||
func _shortcut_input(event: InputEvent) -> void:
|
||||
if not visible:
|
||||
return
|
||||
var k := event as InputEventKey
|
||||
if k == null or not k.pressed or k.echo:
|
||||
return
|
||||
var fo := get_viewport().gui_get_focus_owner()
|
||||
if fo is LineEdit or fo is TextEdit or fo is SpinBox:
|
||||
return
|
||||
var ctrl := k.ctrl_pressed or k.meta_pressed
|
||||
match k.keycode:
|
||||
KEY_1: _set_mode(PdDocument.Mode.OBJECT); get_viewport().set_input_as_handled()
|
||||
KEY_2: _set_mode(PdDocument.Mode.VERTEX); get_viewport().set_input_as_handled()
|
||||
KEY_3: _set_mode(PdDocument.Mode.EDGE); get_viewport().set_input_as_handled()
|
||||
KEY_4: _set_mode(PdDocument.Mode.FACE); get_viewport().set_input_as_handled()
|
||||
KEY_5: _set_mode(PdDocument.Mode.DRAW); get_viewport().set_input_as_handled()
|
||||
KEY_6: toggle_workspace(); get_viewport().set_input_as_handled()
|
||||
KEY_G:
|
||||
# 3D workspace: G/S/R pick the Move/Scale/Rotate
|
||||
# gizmo (pressing the active kind's key hides the
|
||||
# gizmo, same as the toolbar toggles). Texture
|
||||
# workspace keeps G = gizmo visibility toggle.
|
||||
if doc.mode == PdDocument.Mode.TEXTURE:
|
||||
doc.set_gizmo(not doc.gizmo_on)
|
||||
else:
|
||||
_gizmo_shortcut(0)
|
||||
get_viewport().set_input_as_handled()
|
||||
KEY_S:
|
||||
# 3D workspace: S = Scale gizmo; texture workspace
|
||||
# keeps the snap toggle (T toggles snap everywhere).
|
||||
if doc.mode == PdDocument.Mode.TEXTURE:
|
||||
doc.set_snap(not doc.snap_enabled)
|
||||
else:
|
||||
_gizmo_shortcut(1)
|
||||
get_viewport().set_input_as_handled()
|
||||
KEY_T:
|
||||
doc.set_snap(not doc.snap_enabled)
|
||||
get_viewport().set_input_as_handled()
|
||||
KEY_V:
|
||||
doc.set_grid_visible(not doc.grid_visible)
|
||||
get_viewport().set_input_as_handled()
|
||||
KEY_B:
|
||||
doc.set_both_sides(not doc.both_sides)
|
||||
get_viewport().set_input_as_handled()
|
||||
KEY_Z:
|
||||
if ctrl:
|
||||
if event.shift_pressed:
|
||||
doc.do_redo()
|
||||
else:
|
||||
doc.do_undo()
|
||||
get_viewport().set_input_as_handled()
|
||||
KEY_Y:
|
||||
if ctrl:
|
||||
doc.do_redo()
|
||||
get_viewport().set_input_as_handled()
|
||||
KEY_D:
|
||||
if ctrl:
|
||||
doc.duplicate_selected()
|
||||
get_viewport().set_input_as_handled()
|
||||
KEY_A:
|
||||
if ctrl:
|
||||
doc.select_all()
|
||||
get_viewport().set_input_as_handled()
|
||||
KEY_DELETE, KEY_BACKSPACE:
|
||||
doc.delete_selection()
|
||||
get_viewport().set_input_as_handled()
|
||||
KEY_F:
|
||||
frame_selection()
|
||||
get_viewport().set_input_as_handled()
|
||||
KEY_R:
|
||||
if doc.mode == PdDocument.Mode.TEXTURE and doc.tex_edit:
|
||||
# UV editor: rotate the selected faces' UVs 90
|
||||
# degrees (Shift = counter-clockwise)
|
||||
doc.rotate_uv_selected(doc.active_obj,
|
||||
-1 if k.shift_pressed else 1)
|
||||
else:
|
||||
# 3D workspace: R = Rotate gizmo
|
||||
_gizmo_shortcut(2)
|
||||
get_viewport().set_input_as_handled()
|
||||
KEY_SPACE:
|
||||
_toggle_view_fullscreen()
|
||||
get_viewport().set_input_as_handled()
|
||||
KEY_ESCAPE:
|
||||
doc.clear_all_sel()
|
||||
get_viewport().set_input_as_handled()
|
||||
|
||||
|
||||
func _make_input_handled() -> void:
|
||||
get_viewport().set_input_as_handled()
|
||||
|
||||
|
||||
# ------------------------------------------------------------- export ---
|
||||
func _file_dialog(save: bool, filters: PackedStringArray, cb: Callable, title: String,
|
||||
access := EditorFileDialog.ACCESS_RESOURCES, start_dir := "res://") -> void:
|
||||
if _dlg and is_instance_valid(_dlg):
|
||||
_dlg.queue_free()
|
||||
_dlg = EditorFileDialog.new()
|
||||
_dlg.access = access
|
||||
_dlg.file_mode = EditorFileDialog.FILE_MODE_SAVE_FILE if save \
|
||||
else EditorFileDialog.FILE_MODE_OPEN_FILE
|
||||
_dlg.filters = filters
|
||||
_dlg.current_dir = start_dir
|
||||
_dlg.title = title
|
||||
_dlg.ok_button_text = "Save" if save else "Open"
|
||||
EditorInterface.get_base_control().add_child(_dlg)
|
||||
_dlg.file_selected.connect(cb)
|
||||
_dlg.canceled.connect(func():
|
||||
_dlg.queue_free()
|
||||
_dlg = null)
|
||||
_dlg.popup_centered(Vector2i(760, 460))
|
||||
|
||||
|
||||
func _refresh_filesystem() -> void:
|
||||
EditorInterface.get_resource_filesystem().scan()
|
||||
|
||||
|
||||
func _save_project() -> void:
|
||||
_file_dialog(true,
|
||||
PackedStringArray(["*.pdoodle ; Polydoodle Project"]),
|
||||
func(path: String):
|
||||
var err := PdIo.save_project(doc, path)
|
||||
if err == OK:
|
||||
_refresh_filesystem()
|
||||
set_status("Saved project to %s" % path if err == OK
|
||||
else "Save failed: %s" % error_string(err)),
|
||||
"Save Polydoodle Project")
|
||||
|
||||
|
||||
var _importing := false
|
||||
var _last_import_dir := ""
|
||||
var _import_dlg: AcceptDialog = null
|
||||
|
||||
|
||||
func _import_model() -> void:
|
||||
if _importing:
|
||||
set_status("A model import is already running")
|
||||
return
|
||||
var start := _last_import_dir
|
||||
if start.is_empty() or not DirAccess.dir_exists_absolute(start):
|
||||
start = ProjectSettings.globalize_path("res://")
|
||||
_file_dialog(false, PdImport.dialog_filters(),
|
||||
func(path: String):
|
||||
_last_import_dir = path.get_base_dir()
|
||||
_run_import(path),
|
||||
"Import 3D Model", EditorFileDialog.ACCESS_FILESYSTEM, start)
|
||||
|
||||
|
||||
func _run_import(path: String) -> void:
|
||||
if _importing:
|
||||
set_status("A model import is already running")
|
||||
return
|
||||
_importing = true
|
||||
path = ProjectSettings.localize_path(path)
|
||||
var opts := {"textures": true, "merge": true, "fit": true}
|
||||
var progress := func(f: float, text: String):
|
||||
set_status("%s... %d%%" % [text, int(f * 100.0)])
|
||||
var model: Dictionary = await PdImport.load_model(path, opts, self,
|
||||
progress)
|
||||
if not is_instance_valid(self) or not is_inside_tree():
|
||||
return
|
||||
if not model["ok"]:
|
||||
_importing = false
|
||||
_import_report("Import failed", String(model["error"]), [])
|
||||
return
|
||||
var res: Dictionary = await PdImport.build(model, opts, self, progress)
|
||||
if not is_instance_valid(self) or not is_inside_tree():
|
||||
return
|
||||
_importing = false
|
||||
if not res["ok"]:
|
||||
_import_report("Import failed", String(res["error"]), [])
|
||||
return
|
||||
var objs: Array = res["objects"]
|
||||
doc.add_imported_objects(objs, path.get_file().get_basename())
|
||||
frame_selection()
|
||||
set_status("Imported %s: %d objects, %d faces" % [
|
||||
path.get_file(), objs.size(), int(res["faces"])])
|
||||
var notes: Array = res["warnings"]
|
||||
if not notes.is_empty():
|
||||
_import_report("Import notes",
|
||||
"%s was imported with notes:" % path.get_file(), notes)
|
||||
|
||||
|
||||
func _import_report(title: String, text: String, notes: Array) -> void:
|
||||
set_status(text)
|
||||
var font := get_theme_font("font", "Label")
|
||||
var fsize := get_theme_font_size("font_size", "Label")
|
||||
var win := get_window().size
|
||||
# the dialog never takes more than ~70% of the editor window; the text
|
||||
# is trimmed to the lines that fit so nothing is ever clipped
|
||||
var max_w := clampf(win.x * 0.6, 300.0, 520.0)
|
||||
var max_h := int(win.y * 0.7)
|
||||
var line_h := font.get_height(fsize) + 3.0
|
||||
var capacity := maxi(4, int((max_h - 110.0) / line_h))
|
||||
var out := PackedStringArray()
|
||||
out.append_array(_wrap_text(text, font, fsize, max_w, mini(4, capacity)))
|
||||
var shown := 0
|
||||
for n in notes:
|
||||
var item := _wrap_text(String(n), font, fsize, max_w - 14.0, 2)
|
||||
if out.size() + item.size() >= capacity:
|
||||
out.append("- ... and %d more" % (notes.size() - shown))
|
||||
break
|
||||
for k in item.size():
|
||||
out.append(("- " if k == 0 else " ") + item[k])
|
||||
shown += 1
|
||||
if is_instance_valid(_import_dlg):
|
||||
_import_dlg.queue_free()
|
||||
var dlg := AcceptDialog.new()
|
||||
dlg.title = title
|
||||
dlg.dialog_text = "\n".join(out)
|
||||
dlg.dialog_autowrap = false # wrapped above, so the size is exact
|
||||
dlg.exclusive = false
|
||||
dlg.min_size = Vector2i(320, 0)
|
||||
dlg.max_size = Vector2i(int(max_w) + 90, max_h)
|
||||
dlg.confirmed.connect(dlg.queue_free)
|
||||
dlg.canceled.connect(dlg.queue_free)
|
||||
_import_dlg = dlg
|
||||
add_child(dlg)
|
||||
dlg.popup_centered()
|
||||
|
||||
|
||||
## Image import for the texture editor: the picked image floats on the
|
||||
## canvas as a sticker (move / wheel-scale / click places). Placement is
|
||||
## alpha-blended into the atlas and undoable; afterwards the texels can
|
||||
## be painted over or erased like any other paint.
|
||||
func _import_image() -> void:
|
||||
if doc.active() == null:
|
||||
doc.warn("Select a shape first, then import an image onto its texture.")
|
||||
return
|
||||
_file_dialog(false,
|
||||
PackedStringArray(["*.png,*.jpg,*.jpeg,*.webp,*.bmp,*.tga ; Images"]),
|
||||
func(path: String):
|
||||
var img := Image.load_from_file(path)
|
||||
if img == null or img.is_empty():
|
||||
doc.warn("Could not load image: %s" % path)
|
||||
return
|
||||
uv_canvas.begin_sticker(img),
|
||||
"Import Image to Texture")
|
||||
|
||||
|
||||
func _open_project() -> void:
|
||||
_file_dialog(false,
|
||||
PackedStringArray(["*.pdoodle ; Polydoodle Project"]),
|
||||
func(path: String):
|
||||
var d := PdIo.load_project(path)
|
||||
if d == null:
|
||||
set_status("Could not open %s" % path)
|
||||
return
|
||||
# copy loaded doc contents into our live doc
|
||||
doc.restore_snapshot(d.snapshot())
|
||||
doc.bg_color = d.bg_color
|
||||
doc.grid_size = d.grid_size
|
||||
doc.grid_visible = d.grid_visible
|
||||
doc.snap_enabled = d.snap_enabled
|
||||
doc.gizmo_on = d.gizmo_on
|
||||
doc.draw_free = d.draw_free
|
||||
doc.draw_kind = d.draw_kind
|
||||
doc.paint_color = d.paint_color
|
||||
doc.paint_tool = d.paint_tool
|
||||
doc.brush_size = d.brush_size
|
||||
doc.pixel_size = d.pixel_size
|
||||
doc.recent_colors = d.recent_colors
|
||||
doc.both_sides = d.both_sides
|
||||
doc.view_shading = d.view_shading
|
||||
doc.uv_snap = d.uv_snap
|
||||
doc.tex_filter = d.tex_filter
|
||||
doc.pixel_px = d.pixel_px
|
||||
doc.gizmo_kind = d.gizmo_kind
|
||||
doc.brush_opacity = d.brush_opacity
|
||||
doc.brush_smooth = d.brush_smooth
|
||||
doc.face_lock = d.face_lock
|
||||
doc.inset_dist = d.inset_dist
|
||||
doc.hints_enabled = d.hints_enabled
|
||||
doc.show_checker = d.show_checker
|
||||
doc.export_checker = d.export_checker
|
||||
d.release()
|
||||
doc.notify_doc()
|
||||
doc.settings_changed.emit()
|
||||
set_status("Opened %s" % path)
|
||||
frame_selection(),
|
||||
"Open Polydoodle Project")
|
||||
|
||||
|
||||
func _export_result(err: Error, ok_text: String) -> void:
|
||||
if err == OK:
|
||||
_refresh_filesystem()
|
||||
set_status(ok_text)
|
||||
else:
|
||||
doc.warn("Export failed: %s. Check that the folder is writable." % error_string(err))
|
||||
|
||||
|
||||
func _export(kind: String) -> void:
|
||||
if doc.exportable_count() == 0:
|
||||
if doc.objects.is_empty():
|
||||
doc.warn("Nothing to export. The scene is empty - add a shape first.")
|
||||
else:
|
||||
doc.warn("Nothing to export. Every shape is hidden - show one (eye icon in the hierarchy).")
|
||||
return
|
||||
match kind:
|
||||
"tres":
|
||||
_file_dialog(true, PackedStringArray(["*.tres ; Godot Mesh"]),
|
||||
func(path: String):
|
||||
_export_result(PdIo.save_mesh_tres(doc, path), "Exported mesh to %s" % path),
|
||||
"Export Mesh (.tres)")
|
||||
"tscn":
|
||||
_file_dialog(true, PackedStringArray(["*.tscn ; Godot Scene"]),
|
||||
func(path: String):
|
||||
_export_result(PdIo.save_scene_tscn(doc, path), "Exported scene to %s" % path),
|
||||
"Export Scene (.tscn)")
|
||||
"obj":
|
||||
_file_dialog(true, PackedStringArray(["*.obj ; Wavefront OBJ"]),
|
||||
func(path: String):
|
||||
_export_result(PdIo.write_obj(doc, path), "Exported OBJ to %s" % path),
|
||||
"Export OBJ")
|
||||
"scene":
|
||||
var msg := PdIo.add_to_scene(doc)
|
||||
if msg.begins_with("Open or") or msg.begins_with("Nothing"):
|
||||
doc.warn(msg)
|
||||
else:
|
||||
set_status(msg)
|
||||
@@ -0,0 +1 @@
|
||||
uid://cisosn6furd2b
|
||||
@@ -0,0 +1 @@
|
||||
uid://dsvliouk8p40v
|
||||
@@ -0,0 +1,849 @@
|
||||
@tool
|
||||
class_name PdToolbar
|
||||
extends HBoxContainer
|
||||
## Top toolbar: icon-only buttons grouped by category, with tooltips.
|
||||
## The FIRST button is the two-half WORKSPACE switch
|
||||
## [ 3D Editor | Texture Editor ] - exactly one half is always active.
|
||||
## The toolbar then shows the CONTEXTUAL group of the active workspace:
|
||||
## - MODEL group: selection modes, Draw split, view toggles, mesh edits
|
||||
## - TEXTURE group: [Paint | Edit UV] submode + that submode's tools
|
||||
## Exactly one group is visible - texture tools REPLACE the modeling
|
||||
## buttons when the texture editor is active. Sliders and deeper settings
|
||||
## live in the right panel.
|
||||
## Draw stays a SPLIT BUTTON: the main half shows the current shape icon
|
||||
## and activates that mode, the attached arrow half opens the shape menu.
|
||||
## The gizmo button is a split too: main toggles the gizmo, the arrow menu
|
||||
## picks Move or Scale.
|
||||
|
||||
signal mode_requested(m: int)
|
||||
signal workspace_requested(tex: bool)
|
||||
signal toggle_gizmo(v: bool)
|
||||
signal gizmo_kind_requested(k: int)
|
||||
signal toggle_snap(v: bool)
|
||||
signal toggle_grid(v: bool)
|
||||
signal toggle_both_sides(v: bool)
|
||||
signal draw_kind(k: String)
|
||||
signal add_shape(kind: String)
|
||||
signal duplicate_requested
|
||||
signal delete_requested
|
||||
signal undo_requested
|
||||
signal redo_requested
|
||||
signal save_requested
|
||||
signal load_requested
|
||||
signal import_model_requested
|
||||
signal export_requested(kind: String)
|
||||
signal bg_changed(c: Color)
|
||||
signal tex_submode(edit: bool)
|
||||
signal paint_tool_requested(t: String)
|
||||
signal uv_snap_requested(v: bool)
|
||||
signal rotate_uv_requested(dir: int)
|
||||
signal uv_tool_requested(t: String)
|
||||
signal import_requested
|
||||
signal detach_requested
|
||||
signal reset_uvs_requested
|
||||
|
||||
var doc: PdDocument
|
||||
|
||||
var _ws_3d: Button
|
||||
var _ws_tex: Button
|
||||
var _mode_buttons := {}
|
||||
var _mode_group := ButtonGroup.new()
|
||||
# Side-by-side gizmo pair: [Move] [Scale] - the active kind is pressed
|
||||
# while the gizmo is ON; clicking the pressed one again turns it off.
|
||||
var _btn_gizmo_move: Button
|
||||
var _btn_gizmo_scale: Button
|
||||
var _btn_gizmo_rotate: Button
|
||||
var _btn_snap: Button
|
||||
var _btn_grid: Button
|
||||
var _btn_sides: Button
|
||||
var _draw_main: Button
|
||||
var _draw_arrow: Button
|
||||
var _draw_popup: PopupMenu
|
||||
var _btn_undo: Button
|
||||
var _btn_redo: Button
|
||||
var _bg_pick: ColorPickerButton
|
||||
var _btn_settings: Button
|
||||
var _btn_docs: Button
|
||||
var _settings_popup: PopupPanel
|
||||
var _shade_btns: Array = []
|
||||
var _grid_btn: Button
|
||||
var _hints_btn: Button
|
||||
var _checker_btn: Button
|
||||
var _bake_btn: Button
|
||||
var _docs_win: Window
|
||||
|
||||
# contextual groups: exactly one is visible at a time
|
||||
var _model_box: HBoxContainer
|
||||
var _tex_box: HBoxContainer
|
||||
var _tex_paint_box: HBoxContainer
|
||||
var _tex_uv_box: HBoxContainer
|
||||
var _tex_paint: Button
|
||||
var _tex_edituv: Button
|
||||
var _tex_tool_btns := {}
|
||||
var _tex_uv_snap: Button
|
||||
var _tex_uv_rotate: Button
|
||||
var _tex_uv_scale: Button
|
||||
var _uv_tool_group: ButtonGroup
|
||||
|
||||
const ICONS := preload("res://addons/polydoodle/core/pd_icons.gd")
|
||||
const ACCENT := PdDocument.ACCENT
|
||||
const ACCENT_DARK := PdDocument.ACCENT_DARK # bottom bevel of active buttons
|
||||
|
||||
const DRAW_ICONS := {
|
||||
"Freehand": "tool_freehand",
|
||||
"Rectangle": "tool_rect",
|
||||
"Circle": "tool_circle",
|
||||
"Triangle": "tool_triangle",
|
||||
"Pentagon": "tool_pentagon",
|
||||
"Hexagon": "tool_hexagon",
|
||||
"Star": "tool_star",
|
||||
"Torus": "tool_torus",
|
||||
}
|
||||
|
||||
|
||||
func _icon(n: String) -> Texture2D:
|
||||
return ICONS.get_icon(n.trim_suffix(".svg"))
|
||||
|
||||
|
||||
# ------------------------------------------------------------ styling ---
|
||||
## TACTILE button states - reserved for the workspace split button, the
|
||||
## right panel and the settings popup. Idle is flat dark, hover lifts
|
||||
## slightly, and the ACTIVE (pressed) state is a SOLID accent fill - no
|
||||
## transparency - with a darker bottom edge (2px bevel) that gives the
|
||||
## button a physical 3D look, like a key sitting lower on its base. A
|
||||
## lighter top border adds a subtle rim light from above.
|
||||
func _box(corners := Vector4(4, 4, 4, 4)) -> StyleBoxFlat:
|
||||
var sb := StyleBoxFlat.new()
|
||||
sb.bg_color = Color(1, 1, 1, 0.04)
|
||||
sb.set_corner_radius_all(0)
|
||||
sb.corner_radius_top_left = int(corners.x)
|
||||
sb.corner_radius_bottom_left = int(corners.y)
|
||||
sb.corner_radius_top_right = int(corners.z)
|
||||
sb.corner_radius_bottom_right = int(corners.w)
|
||||
sb.content_margin_left = 5
|
||||
sb.content_margin_right = 5
|
||||
sb.content_margin_top = 3
|
||||
sb.content_margin_bottom = 3
|
||||
return sb
|
||||
|
||||
|
||||
func _bevel(sb: StyleBoxFlat, bottom_px: int) -> StyleBoxFlat:
|
||||
sb.border_width_bottom = bottom_px
|
||||
sb.border_color = ACCENT_DARK
|
||||
return sb
|
||||
|
||||
|
||||
func _paint_states(b: Button, base: StyleBoxFlat) -> void:
|
||||
var hover := base.duplicate()
|
||||
hover.bg_color = Color(1, 1, 1, 0.10)
|
||||
# ACTIVE: solid accent (opaque), darker bottom bevel = 3D look
|
||||
var pressed := base.duplicate()
|
||||
pressed.bg_color = ACCENT
|
||||
_bevel(pressed, 3)
|
||||
pressed.content_margin_top = 4
|
||||
pressed.content_margin_bottom = 2
|
||||
# active + hovered: same solid fill, slightly lifted top rim
|
||||
var hover_pressed := base.duplicate()
|
||||
hover_pressed.bg_color = ACCENT.lightened(0.08)
|
||||
_bevel(hover_pressed, 3)
|
||||
hover_pressed.content_margin_top = 4
|
||||
hover_pressed.content_margin_bottom = 2
|
||||
var disabled := base.duplicate()
|
||||
disabled.bg_color = Color(1, 1, 1, 0.015)
|
||||
b.add_theme_stylebox_override("normal", base)
|
||||
b.add_theme_stylebox_override("hover", hover)
|
||||
b.add_theme_stylebox_override("pressed", pressed)
|
||||
b.add_theme_stylebox_override("hover_pressed", hover_pressed)
|
||||
b.add_theme_stylebox_override("disabled", disabled)
|
||||
b.add_theme_stylebox_override("focus", StyleBoxEmpty.new())
|
||||
# Pin EVERY icon state to white. Without icon_hover_pressed_color the
|
||||
# editor theme's fallback tints the icon blue while the active half of
|
||||
# the workspace split is hovered - blue on blue.
|
||||
b.add_theme_color_override("icon_pressed_color", Color(1, 1, 1, 1))
|
||||
b.add_theme_color_override("icon_normal_color", Color(1, 1, 1, 0.82))
|
||||
b.add_theme_color_override("icon_hover_color", Color(1, 1, 1, 1))
|
||||
b.add_theme_color_override("icon_hover_pressed_color", Color(1, 1, 1, 1))
|
||||
b.add_theme_color_override("icon_focus_color", Color(1, 1, 1, 1))
|
||||
b.add_theme_color_override("icon_disabled_color", Color(1, 1, 1, 0.3))
|
||||
|
||||
|
||||
func _style_tactile(b: Button) -> void:
|
||||
_paint_states(b, _box())
|
||||
|
||||
|
||||
## FLAT toolbar states - the Godot-default look for every top-toolbar
|
||||
## button EXCEPT the workspace split. At rest the button is invisible:
|
||||
## only the icon shows. Hovering washes the background slightly lighter.
|
||||
## The ACTIVE (toggled) state colors the ICON with the theme accent - no
|
||||
## solid fill, no bevel.
|
||||
## Geometry: every button is a SQUARE chip with rounded
|
||||
## corners like Godot's own toolbar - symmetric margins, a fixed 28x28
|
||||
## minimum size and shrink-center so the highlight can never stretch
|
||||
## into a portrait rectangle.
|
||||
const TB_CHIP := 28.0 # square side of a toolbar button
|
||||
const TB_RADIUS := 5 # corner radius of the highlight
|
||||
|
||||
func _style_flat(b: Button) -> void:
|
||||
var normal := StyleBoxFlat.new()
|
||||
normal.bg_color = Color(1, 1, 1, 0)
|
||||
normal.set_corner_radius_all(TB_RADIUS)
|
||||
normal.content_margin_left = 6
|
||||
normal.content_margin_right = 6
|
||||
normal.content_margin_top = 6
|
||||
normal.content_margin_bottom = 6
|
||||
var hover := normal.duplicate()
|
||||
hover.bg_color = Color(1, 1, 1, 0.07)
|
||||
var pressed := normal.duplicate()
|
||||
pressed.bg_color = Color(1, 1, 1, 0.045)
|
||||
var hover_pressed := normal.duplicate()
|
||||
hover_pressed.bg_color = Color(1, 1, 1, 0.09)
|
||||
var disabled := normal.duplicate()
|
||||
b.add_theme_stylebox_override("normal", normal)
|
||||
b.add_theme_stylebox_override("hover", hover)
|
||||
b.add_theme_stylebox_override("pressed", pressed)
|
||||
b.add_theme_stylebox_override("hover_pressed", hover_pressed)
|
||||
b.add_theme_stylebox_override("disabled", disabled)
|
||||
b.add_theme_stylebox_override("focus", StyleBoxEmpty.new())
|
||||
b.add_theme_color_override("icon_normal_color", Color(1, 1, 1, 0.78))
|
||||
b.add_theme_color_override("icon_hover_color", Color(1, 1, 1, 1))
|
||||
b.add_theme_color_override("icon_pressed_color", ACCENT)
|
||||
b.add_theme_color_override("icon_disabled_color", Color(1, 1, 1, 0.28))
|
||||
b.custom_minimum_size = Vector2(TB_CHIP, TB_CHIP)
|
||||
b.size_flags_vertical = Control.SIZE_SHRINK_CENTER
|
||||
|
||||
|
||||
func _style(b: Button) -> void:
|
||||
# default for toolbar buttons: flat Godot-like states. The workspace
|
||||
# split and the settings popup explicitly ask for _style_tactile.
|
||||
_style_flat(b)
|
||||
|
||||
|
||||
func _button(icon: String, tip: String) -> Button:
|
||||
var b := Button.new()
|
||||
b.icon = _icon(icon)
|
||||
b.text = ""
|
||||
b.focus_mode = Control.FOCUS_NONE
|
||||
b.tooltip_text = tip
|
||||
b.add_theme_constant_override("icon_max_width", 16)
|
||||
_style(b)
|
||||
return b
|
||||
|
||||
|
||||
func _toggle(icon: String, tip: String, group: ButtonGroup = null) -> Button:
|
||||
var b := _button(icon, tip)
|
||||
b.toggle_mode = true
|
||||
b.button_group = group
|
||||
return b
|
||||
|
||||
|
||||
func _sep() -> VSeparator:
|
||||
return VSeparator.new()
|
||||
|
||||
|
||||
func _gap(px: float) -> Control:
|
||||
var c := Control.new()
|
||||
c.custom_minimum_size = Vector2(px, 0)
|
||||
return c
|
||||
|
||||
|
||||
## A joined pair [main | arrow]: the main half activates the mode and
|
||||
## shows the current tool icon; the arrow half opens the tool menu. The
|
||||
## arrow carries a visible chevron icon so the dropdown affordance reads
|
||||
## at a glance. `tactile` keeps the 3D key look - used by the workspace
|
||||
## switch only; every other split is flat.
|
||||
func _split(main_tip: String, arrow_tip: String, tactile := false) -> Array:
|
||||
var box := HBoxContainer.new()
|
||||
box.add_theme_constant_override("separation", 0)
|
||||
var main := Button.new()
|
||||
main.toggle_mode = true
|
||||
main.focus_mode = Control.FOCUS_NONE
|
||||
main.tooltip_text = main_tip
|
||||
main.add_theme_constant_override("icon_max_width", 16)
|
||||
if tactile:
|
||||
_paint_states(main, _box(Vector4(4, 4, 0, 0)))
|
||||
else:
|
||||
_style_flat(main)
|
||||
# joined pill: outer corners rounded, inner corners square so the
|
||||
# two square chips read as one control
|
||||
_join_split_corners(main, true)
|
||||
var arrow := Button.new()
|
||||
arrow.focus_mode = Control.FOCUS_NONE
|
||||
arrow.tooltip_text = arrow_tip
|
||||
arrow.icon = _icon("arrow_down") # the dropdown indicator
|
||||
arrow.custom_minimum_size = Vector2(20, TB_CHIP)
|
||||
arrow.add_theme_constant_override("icon_max_width", 12)
|
||||
if tactile:
|
||||
_paint_states(arrow, _box(Vector4(0, 0, 4, 4)))
|
||||
else:
|
||||
_style_flat(arrow)
|
||||
_join_split_corners(arrow, false)
|
||||
if not tactile:
|
||||
arrow.add_theme_color_override("icon_normal_color", Color(1, 1, 1, 0.5))
|
||||
arrow.add_theme_color_override("icon_hover_color", Color(1, 1, 1, 0.95))
|
||||
arrow.add_theme_color_override("icon_pressed_color", ACCENT)
|
||||
else:
|
||||
arrow.add_theme_color_override("icon_normal_color", Color(1, 1, 1, 0.55))
|
||||
arrow.add_theme_color_override("icon_hover_color", Color(1, 1, 1, 0.95))
|
||||
box.add_child(main)
|
||||
box.add_child(arrow)
|
||||
return [box, main, arrow]
|
||||
|
||||
|
||||
## Reroute the corner radii of a flat split half: the OUTER corners stay
|
||||
## rounded (the chip look), the INNER corners (where the two halves meet)
|
||||
## square. `is_main` picks which side is outer.
|
||||
func _join_split_corners(b: Button, is_main: bool) -> void:
|
||||
for state in ["normal", "hover", "pressed", "hover_pressed", "disabled"]:
|
||||
var sb := b.get_theme_stylebox(state) as StyleBoxFlat
|
||||
if sb == null:
|
||||
continue
|
||||
var s := sb.duplicate()
|
||||
s.corner_radius_top_left = TB_RADIUS if is_main else 0
|
||||
s.corner_radius_bottom_left = TB_RADIUS if is_main else 0
|
||||
s.corner_radius_top_right = 0 if is_main else TB_RADIUS
|
||||
s.corner_radius_bottom_right = 0 if is_main else TB_RADIUS
|
||||
b.add_theme_stylebox_override(state, s)
|
||||
|
||||
|
||||
func _open_popup(pm: PopupMenu, at: Control) -> void:
|
||||
var gp := at.get_global_rect()
|
||||
pm.position = Vector2i(int(gp.position.x), int(gp.end.y) + 2)
|
||||
pm.popup()
|
||||
|
||||
|
||||
func setup(d: PdDocument) -> void:
|
||||
doc = d
|
||||
add_theme_constant_override("separation", 3)
|
||||
|
||||
# --- WORKSPACE switch (first buttons): 3D Editor | Texture Editor
|
||||
# A joined pair where EXACTLY ONE half is always pressed: the left
|
||||
# half is the 3D modeler (quad view + mesh tools), the right half
|
||||
# the texture editor (3D viewport + texture canvas + tool strip).
|
||||
# The ONLY tactile control on the toolbar: the 3D key look marks
|
||||
# it as the master switch of the whole editor.
|
||||
var wsp := _split("3D Editor\nQuad view: Top / Perspective / Side / Front with all modeling tools (1-5)",
|
||||
"Texture Editor\n3D viewport over the texture canvas: paint and edit UVs (6)", true)
|
||||
_ws_3d = wsp[1]
|
||||
_ws_tex = wsp[2]
|
||||
# the right half is a mode, not a dropdown arrow: a dedicated
|
||||
# checkered-cube icon (distinct from the Edit-UV submode button's)
|
||||
# inside a shared button group, so exactly one half reads as
|
||||
# active at a time.
|
||||
_ws_3d.icon = _icon("ws_3d")
|
||||
_ws_tex.icon = _icon("ws_uv")
|
||||
_ws_tex.toggle_mode = true # the arrow half is not a toggle by default
|
||||
_ws_tex.add_theme_constant_override("icon_max_width", 16)
|
||||
var wsgrp := ButtonGroup.new()
|
||||
_ws_3d.button_group = wsgrp
|
||||
_ws_tex.button_group = wsgrp
|
||||
_ws_3d.pressed.connect(func(): workspace_requested.emit(false))
|
||||
_ws_tex.pressed.connect(func(): workspace_requested.emit(true))
|
||||
add_child(wsp[0])
|
||||
|
||||
add_child(_gap(8))
|
||||
|
||||
# ================================================== MODEL group ==
|
||||
# All 3D-modeling buttons. Hidden while the texture editor is
|
||||
# active - the TEXTURE group replaces it in place.
|
||||
_model_box = HBoxContainer.new()
|
||||
_model_box.add_theme_constant_override("separation", 3)
|
||||
add_child(_model_box)
|
||||
|
||||
# --- ADD MODELS: front of the toolbar group, directly after the
|
||||
# workspace switch - the quickest way to start a scene
|
||||
var add := _menu("add", "Add a primitive shape")
|
||||
var am := add.get_popup()
|
||||
am.add_theme_font_size_override("font_size", 12)
|
||||
am.add_item("Cube", 0)
|
||||
am.add_item("Plane", 1)
|
||||
am.add_item("Cylinder", 2)
|
||||
am.add_item("Sphere", 3)
|
||||
am.add_item("Prism", 4)
|
||||
am.add_item("Torus", 5)
|
||||
am.id_pressed.connect(func(id: int):
|
||||
add_shape.emit(["Cube", "Plane", "Cylinder", "Sphere", "Prism", "Torus"][id]))
|
||||
_model_box.add_child(add)
|
||||
_model_box.add_child(_gap(6))
|
||||
|
||||
# --- selection modes (category 1) ---
|
||||
var modes := [
|
||||
[PdDocument.Mode.OBJECT, "mode_object", "Object mode (1)\nSelect and move whole shapes"],
|
||||
[PdDocument.Mode.VERTEX, "mode_vertex", "Vertex mode (2)\nSelect and drag vertices"],
|
||||
[PdDocument.Mode.EDGE, "mode_edge", "Edge mode (3)\nSelect and drag edges"],
|
||||
[PdDocument.Mode.FACE, "mode_face", "Face mode (4)\nSelect and move faces"],
|
||||
]
|
||||
for m in modes:
|
||||
var b := _toggle(m[1], m[2], _mode_group)
|
||||
b.pressed.connect(func(): mode_requested.emit(m[0]))
|
||||
_mode_buttons[m[0]] = b
|
||||
_model_box.add_child(b)
|
||||
|
||||
# --- draw (category 2, set slightly apart) ---
|
||||
_model_box.add_child(_gap(10))
|
||||
|
||||
# Draw: split button - main shows the current shape, arrow opens
|
||||
# the shapes menu; picking a shape enters Draw mode with it.
|
||||
var dsp := _split("Draw mode (5)\nSketch shapes in any viewport - current shape: Rectangle",
|
||||
"Choose a shape to draw")
|
||||
_draw_main = dsp[1]
|
||||
_draw_arrow = dsp[2]
|
||||
_draw_main.pressed.connect(func(): mode_requested.emit(PdDocument.Mode.DRAW))
|
||||
_mode_buttons[PdDocument.Mode.DRAW] = _draw_main
|
||||
_draw_popup = PopupMenu.new()
|
||||
_draw_popup.add_theme_font_size_override("font_size", 12)
|
||||
# match every other icon in the UI (16px) - PopupMenu draws item
|
||||
# icons at native texture size unless capped, and our source PNGs
|
||||
# are 32px, so without this the shape list looked twice as big as
|
||||
# the toolbar buttons that open it.
|
||||
_draw_popup.add_theme_constant_override("icon_max_width", 16)
|
||||
for i in PdDocument.DRAW_KINDS.size():
|
||||
_draw_popup.add_radio_check_item(PdDocument.DRAW_KINDS[i], i)
|
||||
_draw_popup.set_item_icon(i, _icon(DRAW_ICONS.get(
|
||||
PdDocument.DRAW_KINDS[i], "tool_rect")))
|
||||
_draw_popup.id_pressed.connect(func(id: int):
|
||||
draw_kind.emit(PdDocument.DRAW_KINDS[id])
|
||||
mode_requested.emit(PdDocument.Mode.DRAW))
|
||||
_draw_arrow.pressed.connect(func(): _open_popup(_draw_popup, _draw_arrow))
|
||||
_model_box.add_child(dsp[0])
|
||||
_model_box.add_child(_draw_popup)
|
||||
|
||||
_model_box.add_child(_gap(4))
|
||||
_model_box.add_child(_sep())
|
||||
|
||||
# --- view toggles. The gizmo controls are a SIDE-BY-SIDE pair:
|
||||
# [Move] [Scale]. The active kind is pressed while the gizmo is
|
||||
# on; clicking the pressed half again hides the gizmo.
|
||||
_btn_gizmo_move = _toggle("gizmo_move", "Move Gizmo (G)\nShow the 3-axis move arrows on the selection.\nClick again to hide the gizmo. G/S/R pick Move/Scale/Rotate.\nDirect dragging always works too.")
|
||||
_btn_gizmo_move.pressed.connect(func(): _gizmo_pair(0))
|
||||
_model_box.add_child(_btn_gizmo_move)
|
||||
_btn_gizmo_scale = _toggle("gizmo_scale", "Scale Gizmo (S)\nShow the scale handles on the selection: axis cubes scale one axis,\nthe center cube scales uniformly.\nClick again to hide the gizmo.")
|
||||
_btn_gizmo_scale.pressed.connect(func(): _gizmo_pair(1))
|
||||
_model_box.add_child(_btn_gizmo_scale)
|
||||
_btn_gizmo_rotate = _toggle("gizmo_rotate", "Rotate Gizmo (R)\nShow the rotation rings on the selection: drag a ring to rotate\naround that axis. In the 2D views this is a single ring around the\nview's own axis.\nClick again to hide the gizmo.")
|
||||
_btn_gizmo_rotate.pressed.connect(func(): _gizmo_pair(2))
|
||||
_model_box.add_child(_btn_gizmo_rotate)
|
||||
_btn_snap = _toggle("snap", "Grid snapping (T)\nMoves and shapes land on the grid.\nWorks even when the grid is hidden.")
|
||||
_btn_snap.pressed.connect(func(): toggle_snap.emit(_btn_snap.button_pressed))
|
||||
_model_box.add_child(_btn_snap)
|
||||
_btn_grid = _toggle("grid", "Grid visibility (V)\nHide the grid but keep snapping.")
|
||||
_btn_grid.pressed.connect(func(): toggle_grid.emit(_btn_grid.button_pressed))
|
||||
_model_box.add_child(_btn_grid)
|
||||
_btn_sides = _toggle("doubleside", "Render both sides (B)\nShow backfaces - no culling. On by default.")
|
||||
_btn_sides.pressed.connect(func(): toggle_both_sides.emit(_btn_sides.button_pressed))
|
||||
_model_box.add_child(_btn_sides)
|
||||
_model_box.add_child(_sep())
|
||||
|
||||
# --- edit ---
|
||||
var dup := _button("duplicate", "Duplicate selected object (Ctrl+D)")
|
||||
dup.pressed.connect(func(): duplicate_requested.emit())
|
||||
_model_box.add_child(dup)
|
||||
var del := _button("delete", "Delete selection (Del)")
|
||||
# destructive action = red icon
|
||||
del.add_theme_color_override("icon_normal_color",
|
||||
Color(0.94, 0.44, 0.44, 0.9))
|
||||
del.add_theme_color_override("icon_hover_color", Color(1, 0.52, 0.52))
|
||||
del.pressed.connect(func(): delete_requested.emit())
|
||||
_model_box.add_child(del)
|
||||
|
||||
# ================================================ TEXTURE group ==
|
||||
# Replaces the modeling buttons while the texture editor is
|
||||
# active: the [Paint | Edit UV] submode buttons followed by the
|
||||
# contextual toolset of the active submode. Sizes and colors live
|
||||
# in the right panel.
|
||||
_tex_box = HBoxContainer.new()
|
||||
_tex_box.add_theme_constant_override("separation", 3)
|
||||
_tex_box.visible = false
|
||||
add_child(_tex_box)
|
||||
|
||||
var tgrp := ButtonGroup.new()
|
||||
# own icon (mode_paint), distinct from tool_brush - the submode
|
||||
# button and the individual Brush TOOL button below must not read
|
||||
# as the same control
|
||||
_tex_paint = _toggle("mode_paint",
|
||||
"Paint\nBrush, fill and pixel tools paint the texture directly", tgrp)
|
||||
_tex_paint.pressed.connect(func(): tex_submode.emit(false))
|
||||
_tex_edituv = _toggle("tool_uv",
|
||||
"Edit UV\nDrag island corners, edges or whole islands to re-map UVs.\nClick a face in the 3D view to select it - its island highlights here.\nRight-click: detach / merge / extrude / fill / delete menu", tgrp)
|
||||
_tex_edituv.pressed.connect(func(): tex_submode.emit(true))
|
||||
_tex_box.add_child(_tex_paint)
|
||||
_tex_box.add_child(_tex_edituv)
|
||||
_tex_box.add_child(_sep())
|
||||
|
||||
# ---- PAINT submode tools (visible only in Paint submode)
|
||||
var pgrp := ButtonGroup.new()
|
||||
var tools := [["Brush", "tool_brush", "Brush - paint smooth round strokes"],
|
||||
["Fill", "tool_fill", "Fill - repaint exactly one face's texture island"],
|
||||
["Fill Object", "tool_fillobject", "Fill Object - repaint the whole object's texture"],
|
||||
["Pixel", "tool_pixel", "Pixel - texel-perfect pixel-art brush"],
|
||||
["Eraser", "tool_eraser", "Eraser - restore blank with brush strokes (works on the model and the canvas)"],
|
||||
["Picker", "tool_picker", "Color Picker - click the model or the canvas to make that texel's color the paint color"],
|
||||
["Replace", "tool_replace", "Replace Color - click a texel: its color is swapped for the paint color across the WHOLE canvas (all faces); the Tolerance slider in the right panel widens the color match"]]
|
||||
_tex_paint_box = HBoxContainer.new()
|
||||
_tex_paint_box.add_theme_constant_override("separation", 3)
|
||||
_tex_box.add_child(_tex_paint_box)
|
||||
for t in tools:
|
||||
var b := _toggle(t[1], t[2], pgrp)
|
||||
b.pressed.connect(func(): paint_tool_requested.emit(t[0]))
|
||||
_tex_tool_btns[t[0]] = b
|
||||
_tex_paint_box.add_child(b)
|
||||
var imp := _button("image",
|
||||
"Import Image\nPlace a picture onto the texture: move it, wheel-scales,\nclick places it - then paint over it or erase it")
|
||||
imp.pressed.connect(func(): import_requested.emit())
|
||||
_tex_paint_box.add_child(imp)
|
||||
|
||||
# ---- EDIT UV submode tools (visible only in Edit UV submode)
|
||||
_tex_uv_box = HBoxContainer.new()
|
||||
_tex_uv_box.add_theme_constant_override("separation", 3)
|
||||
_tex_uv_box.visible = false
|
||||
_tex_box.add_child(_tex_uv_box)
|
||||
_tex_uv_snap = _toggle("snap", "UV snapping (texel grid)\nUV drags land on whole texels. Hold Ctrl to drag freely.")
|
||||
_tex_uv_snap.pressed.connect(func(): uv_snap_requested.emit(_tex_uv_snap.button_pressed))
|
||||
var det := _button("detach",
|
||||
"Detach selected face(s)\nMove the selected islands to free texture space so they can\nbe moved individually. Select faces, then press.")
|
||||
det.pressed.connect(func(): detach_requested.emit())
|
||||
var ruv := _button("uv_reset", "Reset UVs\nRe-unwrap every face of the object to its planar projection")
|
||||
ruv.pressed.connect(func(): reset_uvs_requested.emit())
|
||||
# Rotate / Scale: a mutually exclusive toggle pair (the active one
|
||||
# can be clicked again to switch off). The rotate tool shows the
|
||||
# 0..360 angle slider in the right panel; the scale tool turns
|
||||
# every corner drag of the selection into a uniform scale and shows
|
||||
# the percent slider. Quick 90-degree actions stay available via
|
||||
# R / Shift+R and the canvas right-click menu.
|
||||
_uv_tool_group = ButtonGroup.new()
|
||||
_uv_tool_group.allow_unpress = true
|
||||
_tex_uv_rotate = _toggle("rotate",
|
||||
"Rotate UVs\nToggle the rotate tool: an Angle slider (0-360\ndegrees, or type a number) appears in the right panel and\nrotates the selected faces' texture islands around their center.\nR / Shift+R rotate 90 degrees quickly.",
|
||||
_uv_tool_group)
|
||||
_tex_uv_rotate.pressed.connect(func():
|
||||
uv_tool_requested.emit(
|
||||
"rotate" if _tex_uv_rotate.button_pressed else "none"))
|
||||
_tex_uv_scale = _toggle("gizmo_scale",
|
||||
"Scale UVs\nToggle the scale tool: drag any corner of the selected\nisland(s) to scale them uniformly (aspect ratio preserved).\nA Scale slider (10-400%) also appears in the right panel.",
|
||||
_uv_tool_group)
|
||||
_tex_uv_scale.pressed.connect(func():
|
||||
uv_tool_requested.emit(
|
||||
"scale" if _tex_uv_scale.button_pressed else "none"))
|
||||
_tex_uv_box.add_child(_tex_uv_snap)
|
||||
_tex_uv_box.add_child(_tex_uv_rotate)
|
||||
_tex_uv_box.add_child(_tex_uv_scale)
|
||||
_tex_uv_box.add_child(det)
|
||||
_tex_uv_box.add_child(ruv)
|
||||
|
||||
add_child(_sep())
|
||||
|
||||
# --- history ---
|
||||
_btn_undo = _button("undo", "Undo (Ctrl+Z)")
|
||||
_btn_undo.pressed.connect(func(): undo_requested.emit())
|
||||
add_child(_btn_undo)
|
||||
_btn_redo = _button("redo", "Redo (Ctrl+Shift+Z)")
|
||||
_btn_redo.pressed.connect(func(): redo_requested.emit())
|
||||
add_child(_btn_redo)
|
||||
add_child(_sep())
|
||||
|
||||
# --- file ---
|
||||
var save := _button("save", "Save project as .pdoodle")
|
||||
save.pressed.connect(func(): save_requested.emit())
|
||||
add_child(save)
|
||||
var open := _button("open", "Open a .pdoodle project")
|
||||
open.pressed.connect(func(): load_requested.emit())
|
||||
add_child(open)
|
||||
var import_model := _button("import_model",
|
||||
"Import a 3D model (OBJ, glTF, FBX) with its textures")
|
||||
import_model.pressed.connect(func(): import_model_requested.emit())
|
||||
add_child(import_model)
|
||||
|
||||
var export := _menu("export", "Export for use directly in Godot")
|
||||
var em := export.get_popup()
|
||||
em.add_theme_font_size_override("font_size", 12)
|
||||
em.add_item("Mesh (.tres)", 0)
|
||||
em.add_item("Scene (.tscn)", 1)
|
||||
em.add_item("OBJ (.obj + texture)", 2)
|
||||
em.add_item("Add to current scene", 3)
|
||||
em.id_pressed.connect(func(id: int):
|
||||
export_requested.emit(["tres", "tscn", "obj", "scene"][id]))
|
||||
add_child(export)
|
||||
|
||||
var spacer := Control.new()
|
||||
spacer.size_flags_horizontal = Control.SIZE_EXPAND_FILL
|
||||
add_child(spacer)
|
||||
|
||||
_bg_pick = ColorPickerButton.new()
|
||||
_bg_pick.custom_minimum_size = Vector2(34, 24)
|
||||
_bg_pick.focus_mode = Control.FOCUS_NONE
|
||||
_bg_pick.color = doc.bg_color
|
||||
_bg_pick.tooltip_text = "Background color"
|
||||
_bg_pick.color_changed.connect(func(c: Color): bg_changed.emit(c))
|
||||
add_child(_bg_pick)
|
||||
|
||||
# --- editor settings (gear): shading mode buttons, grid toggle ---
|
||||
_btn_settings = _button("gear", "Editor settings\n3D shading mode, grid and contextual hints")
|
||||
_btn_settings.pressed.connect(_open_settings)
|
||||
add_child(_btn_settings)
|
||||
_build_settings_popup()
|
||||
|
||||
# --- documentation (book): every button, tool and feature explained
|
||||
_btn_docs = _button("docs", "Documentation\nEvery button, tool and feature of the plugin, with how-tos\nand use cases")
|
||||
_btn_docs.pressed.connect(_open_docs)
|
||||
add_child(_btn_docs)
|
||||
|
||||
sync_from_doc()
|
||||
|
||||
|
||||
func _menu(icon: String, tip: String) -> MenuButton:
|
||||
var m := MenuButton.new()
|
||||
m.icon = _icon(icon)
|
||||
m.text = ""
|
||||
m.focus_mode = Control.FOCUS_NONE
|
||||
m.tooltip_text = tip
|
||||
m.add_theme_constant_override("icon_max_width", 16)
|
||||
m.flat = false
|
||||
_style(m)
|
||||
return m
|
||||
|
||||
|
||||
# -------------------------------------------------------- settings UI ---
|
||||
## Editor settings: tactile BUTTONS (pressed = active, one button in a
|
||||
## group is always pressed) instead of on/off switches - a shading mode
|
||||
## is a choice, not a switch, and a pressed button clearly shows state.
|
||||
func _build_settings_popup() -> void:
|
||||
_settings_popup = PopupPanel.new()
|
||||
var v := VBoxContainer.new()
|
||||
v.add_theme_constant_override("separation", 8)
|
||||
v.custom_minimum_size = Vector2(252, 0)
|
||||
_settings_popup.add_child(v)
|
||||
|
||||
var head := Label.new()
|
||||
head.text = "Editor Settings"
|
||||
head.add_theme_font_size_override("font_size", 14)
|
||||
v.add_child(head)
|
||||
|
||||
var sh := Label.new()
|
||||
sh.text = "3D shading"
|
||||
sh.add_theme_font_size_override("font_size", 11)
|
||||
sh.modulate = Color(1, 1, 1, 0.6)
|
||||
v.add_child(sh)
|
||||
var row := HBoxContainer.new()
|
||||
row.add_theme_constant_override("separation", 4)
|
||||
v.add_child(row)
|
||||
var grp := ButtonGroup.new()
|
||||
var modes := [[0, "Shaded + Wire", "Solid model with an x-ray wireframe overlay"],
|
||||
[1, "Shaded", "Solid model only - no wireframe"],
|
||||
[2, "Wireframe", "Wireframe only - no solid surfaces"]]
|
||||
for md in modes:
|
||||
var b := Button.new()
|
||||
b.text = md[1]
|
||||
b.toggle_mode = true
|
||||
b.button_group = grp
|
||||
b.focus_mode = Control.FOCUS_NONE
|
||||
b.tooltip_text = md[2]
|
||||
b.add_theme_font_size_override("font_size", 12)
|
||||
b.custom_minimum_size = Vector2(0, 26)
|
||||
_style_tactile(b)
|
||||
var want: int = md[0]
|
||||
b.pressed.connect(func():
|
||||
doc.set_view_shading(want)
|
||||
_sync_settings())
|
||||
_shade_btns.append([b, want])
|
||||
row.add_child(b)
|
||||
|
||||
var gh := Label.new()
|
||||
gh.text = "Viewport"
|
||||
gh.add_theme_font_size_override("font_size", 11)
|
||||
gh.modulate = Color(1, 1, 1, 0.6)
|
||||
v.add_child(gh)
|
||||
_grid_btn = Button.new()
|
||||
_grid_btn.text = "Show Grid"
|
||||
_grid_btn.toggle_mode = true
|
||||
_grid_btn.focus_mode = Control.FOCUS_NONE
|
||||
_grid_btn.tooltip_text = "Show or hide the grid (V)\nSnapping keeps working while the grid is hidden"
|
||||
_grid_btn.add_theme_font_size_override("font_size", 12)
|
||||
_grid_btn.custom_minimum_size = Vector2(0, 26)
|
||||
_style_tactile(_grid_btn)
|
||||
_grid_btn.pressed.connect(func():
|
||||
doc.set_grid_visible(_grid_btn.button_pressed)
|
||||
_sync_settings())
|
||||
v.add_child(_grid_btn)
|
||||
_hints_btn = Button.new()
|
||||
_hints_btn.text = "Contextual Hints"
|
||||
_hints_btn.toggle_mode = true
|
||||
_hints_btn.focus_mode = Control.FOCUS_NONE
|
||||
_hints_btn.tooltip_text = "Show or hide the in-viewport tip lines\n(the small help text at the bottom of each view)"
|
||||
_hints_btn.add_theme_font_size_override("font_size", 12)
|
||||
_hints_btn.custom_minimum_size = Vector2(0, 26)
|
||||
_style_tactile(_hints_btn)
|
||||
_hints_btn.pressed.connect(func():
|
||||
doc.set_hints(_hints_btn.button_pressed)
|
||||
_sync_settings())
|
||||
v.add_child(_hints_btn)
|
||||
|
||||
var ch := Label.new()
|
||||
ch.text = "Checkerboard"
|
||||
ch.add_theme_font_size_override("font_size", 11)
|
||||
ch.modulate = Color(1, 1, 1, 0.6)
|
||||
v.add_child(ch)
|
||||
_checker_btn = Button.new()
|
||||
_checker_btn.text = "Show Checkerboard"
|
||||
_checker_btn.toggle_mode = true
|
||||
_checker_btn.focus_mode = Control.FOCUS_NONE
|
||||
_checker_btn.tooltip_text = "Show or hide the checkerboard under unpainted texels\n\nON: unpainted areas show the checker placeholder (the classic look).\nOFF: unpainted areas are FULLY TRANSPARENT in every view - and they\nexport transparent (alpha 0), so the model gets real holes there."
|
||||
_checker_btn.add_theme_font_size_override("font_size", 12)
|
||||
_checker_btn.custom_minimum_size = Vector2(0, 26)
|
||||
_style_tactile(_checker_btn)
|
||||
_checker_btn.pressed.connect(func():
|
||||
doc.set_show_checker(_checker_btn.button_pressed)
|
||||
_sync_settings())
|
||||
v.add_child(_checker_btn)
|
||||
_bake_btn = Button.new()
|
||||
_bake_btn.text = "Bake Into Export"
|
||||
_bake_btn.toggle_mode = true
|
||||
_bake_btn.focus_mode = Control.FOCUS_NONE
|
||||
_bake_btn.tooltip_text = "Bake the checkerboard into every exported texture\n\nON: exported textures (mesh, scene, OBJ PNGs) carry the checker -\nnothing is transparent where nothing was painted.\nOFF: the export follows the Show Checkerboard switch - hidden checker\nexports transparent, visible checker exports baked.\nRender Both Sides always applies to the exported material."
|
||||
_bake_btn.add_theme_font_size_override("font_size", 12)
|
||||
_bake_btn.custom_minimum_size = Vector2(0, 26)
|
||||
_style_tactile(_bake_btn)
|
||||
_bake_btn.pressed.connect(func():
|
||||
doc.set_export_checker(_bake_btn.button_pressed)
|
||||
_sync_settings())
|
||||
v.add_child(_bake_btn)
|
||||
|
||||
add_child(_settings_popup)
|
||||
|
||||
|
||||
func _open_settings() -> void:
|
||||
_sync_settings()
|
||||
_settings_popup.reset_size()
|
||||
_place_settings_popup()
|
||||
_settings_popup.popup()
|
||||
# embedded popups can be re-fitted by the windowing system on
|
||||
# show: re-place once the REAL size is known
|
||||
_place_settings_popup.call_deferred()
|
||||
|
||||
|
||||
## Position the settings popup on the RIGHT side, right-aligned under the
|
||||
## gear, clamped INSIDE the plugin tab area so it can never spill over
|
||||
## the editor docks. Falls back to the editor base-control rect when the
|
||||
## main screen reports a degenerate (headless / not-yet-laid-out) rect.
|
||||
func _place_settings_popup() -> void:
|
||||
if _settings_popup == null or not is_instance_valid(_settings_popup):
|
||||
return
|
||||
var gear := _btn_settings.get_global_rect()
|
||||
var ps := Vector2(_settings_popup.size)
|
||||
if ps.x <= 1.0 or ps.y <= 1.0:
|
||||
ps = _settings_popup.get_contents_minimum_size() \
|
||||
+ Vector2(8, 8)
|
||||
var main := EditorInterface.get_editor_main_screen().get_global_rect()
|
||||
if main.size.x < 50.0 or main.size.y < 50.0:
|
||||
main = EditorInterface.get_base_control().get_global_rect()
|
||||
var margin := 4.0
|
||||
var pos := Vector2(gear.end.x - ps.x, gear.end.y + 2.0)
|
||||
pos.x = clampf(pos.x, main.position.x + margin,
|
||||
maxf(main.position.x + margin, main.end.x - ps.x - margin))
|
||||
pos.y = clampf(pos.y, main.position.y + margin,
|
||||
maxf(main.position.y + margin, main.end.y - ps.y - margin))
|
||||
_settings_popup.position = Vector2i(int(pos.x), int(pos.y))
|
||||
|
||||
|
||||
func _sync_settings() -> void:
|
||||
if _settings_popup == null:
|
||||
return
|
||||
for pair in _shade_btns:
|
||||
var b: Button = pair[0]
|
||||
b.set_pressed_no_signal(doc.view_shading == int(pair[1]))
|
||||
_grid_btn.set_pressed_no_signal(doc.grid_visible)
|
||||
if _hints_btn != null:
|
||||
_hints_btn.set_pressed_no_signal(doc.hints_enabled)
|
||||
if _checker_btn != null:
|
||||
_checker_btn.set_pressed_no_signal(doc.show_checker)
|
||||
if _bake_btn != null:
|
||||
_bake_btn.set_pressed_no_signal(doc.export_checker)
|
||||
|
||||
|
||||
# --------------------------------------------------------- gizmo pair ---
|
||||
## One of the three gizmo buttons was pressed: select that kind and show
|
||||
## the gizmo, or hide the gizmo when the active kind is clicked again.
|
||||
func _gizmo_pair(kind: int) -> void:
|
||||
if doc.gizmo_on and doc.gizmo_kind == kind:
|
||||
doc.set_gizmo(false)
|
||||
toggle_gizmo.emit(false)
|
||||
else:
|
||||
doc.set_gizmo(true)
|
||||
toggle_gizmo.emit(true)
|
||||
if doc.gizmo_kind != kind:
|
||||
gizmo_kind_requested.emit(kind)
|
||||
doc.set_gizmo_kind(kind)
|
||||
sync_from_doc()
|
||||
|
||||
|
||||
# -------------------------------------------------------------- docs ---
|
||||
## Open (or raise) the documentation window next to the settings gear.
|
||||
## The Window must be parented into the editor's base control or it will
|
||||
## never be shown.
|
||||
func _open_docs() -> void:
|
||||
if _docs_win != null and is_instance_valid(_docs_win):
|
||||
_docs_win.show()
|
||||
_docs_win.move_to_foreground()
|
||||
else:
|
||||
_docs_win = PdDocs.open(null)
|
||||
EditorInterface.get_base_control().add_child(_docs_win)
|
||||
# CENTER the window on the editor: an unpositioned editor
|
||||
# Window opens in the top-left corner. Computed from the
|
||||
# base control's rect (popup_centered mis-centers when the
|
||||
# host screen reports a degenerate size) and clamped so a
|
||||
# degenerate rect can never push it off-screen.
|
||||
var bc := EditorInterface.get_base_control()
|
||||
var br := bc.get_global_rect()
|
||||
var cp := br.position + ((br.size - Vector2(_docs_win.size))
|
||||
* 0.5).floor()
|
||||
_docs_win.position = Vector2i(
|
||||
maxi(0, int(cp.x)), maxi(0, int(cp.y)))
|
||||
|
||||
|
||||
func sync_from_doc() -> void:
|
||||
if doc == null:
|
||||
return
|
||||
# workspace switch: exactly one half active, and the contextual
|
||||
# group swaps in place - texture tools REPLACE the modeling tools
|
||||
var tex := doc.mode == PdDocument.Mode.TEXTURE
|
||||
_ws_3d.button_pressed = not tex
|
||||
_ws_tex.button_pressed = tex
|
||||
if _model_box != null:
|
||||
_model_box.visible = not tex
|
||||
if _tex_box != null:
|
||||
_tex_box.visible = tex
|
||||
for m in _mode_buttons:
|
||||
_mode_buttons[m].button_pressed = m == doc.mode
|
||||
# side-by-side gizmo pair mirrors on/off AND the active kind
|
||||
_btn_gizmo_move.set_pressed_no_signal(doc.gizmo_on and doc.gizmo_kind == 0)
|
||||
_btn_gizmo_scale.set_pressed_no_signal(doc.gizmo_on and doc.gizmo_kind == 1)
|
||||
_btn_gizmo_rotate.set_pressed_no_signal(doc.gizmo_on and doc.gizmo_kind == 2)
|
||||
_btn_snap.button_pressed = doc.snap_enabled
|
||||
_btn_grid.button_pressed = doc.grid_visible
|
||||
_btn_sides.button_pressed = doc.both_sides
|
||||
# draw split button: main icon always mirrors the active shape
|
||||
_draw_main.icon = _icon(DRAW_ICONS.get(doc.draw_kind, "tool_rect"))
|
||||
_draw_main.tooltip_text = "Draw mode (5)\nSketch shapes in any viewport - current shape: %s" % doc.draw_kind
|
||||
for i in PdDocument.DRAW_KINDS.size():
|
||||
_draw_popup.set_item_checked(i, PdDocument.DRAW_KINDS[i] == doc.draw_kind)
|
||||
# texture group state (contextual: paint tools OR uv tools)
|
||||
_tex_paint.set_pressed_no_signal(not doc.tex_edit)
|
||||
_tex_edituv.set_pressed_no_signal(doc.tex_edit)
|
||||
if _tex_paint_box != null:
|
||||
_tex_paint_box.visible = not doc.tex_edit
|
||||
if _tex_uv_box != null:
|
||||
_tex_uv_box.visible = doc.tex_edit
|
||||
for t in _tex_tool_btns:
|
||||
_tex_tool_btns[t].set_pressed_no_signal(t == doc.paint_tool)
|
||||
_tex_uv_snap.set_pressed_no_signal(doc.uv_snap)
|
||||
if _tex_uv_rotate != null:
|
||||
_tex_uv_rotate.set_pressed_no_signal(doc.uv_tool == "rotate")
|
||||
if _tex_uv_scale != null:
|
||||
_tex_uv_scale.set_pressed_no_signal(doc.uv_tool == "scale")
|
||||
_btn_undo.disabled = not doc.undo.has_undo()
|
||||
_btn_redo.disabled = not doc.undo.has_redo()
|
||||
if _bg_pick:
|
||||
_bg_pick.set_deferred("color", doc.bg_color)
|
||||
|
||||
|
||||
func set_bg_silent(c: Color) -> void:
|
||||
if _bg_pick:
|
||||
_bg_pick.set_deferred("color", c)
|
||||
@@ -0,0 +1 @@
|
||||
uid://umnlo32jihmq
|
||||
@@ -0,0 +1 @@
|
||||
uid://c2uvcanvas7r4d1
|
||||
@@ -0,0 +1 @@
|
||||
uid://buqp3y4nf5nc2
|
||||
@@ -0,0 +1 @@
|
||||
uid://cex0nabkdfiek
|
||||
|
After Width: | Height: | Size: 1.2 KiB |
@@ -0,0 +1,40 @@
|
||||
[remap]
|
||||
|
||||
importer="texture"
|
||||
type="CompressedTexture2D"
|
||||
uid="uid://b5rauv0tu8ra0"
|
||||
path="res://.godot/imported/add.png-43123bc20404f33e3e67ee1b070813d5.ctex"
|
||||
metadata={
|
||||
"vram_texture": false
|
||||
}
|
||||
|
||||
[deps]
|
||||
|
||||
source_file="res://addons/polydoodle/icons/add.png"
|
||||
dest_files=["res://.godot/imported/add.png-43123bc20404f33e3e67ee1b070813d5.ctex"]
|
||||
|
||||
[params]
|
||||
|
||||
compress/mode=0
|
||||
compress/high_quality=false
|
||||
compress/lossy_quality=0.7
|
||||
compress/uastc_level=0
|
||||
compress/rdo_quality_loss=0.0
|
||||
compress/hdr_compression=1
|
||||
compress/normal_map=0
|
||||
compress/channel_pack=0
|
||||
mipmaps/generate=false
|
||||
mipmaps/limit=-1
|
||||
roughness/mode=0
|
||||
roughness/src_normal=""
|
||||
process/channel_remap/red=0
|
||||
process/channel_remap/green=1
|
||||
process/channel_remap/blue=2
|
||||
process/channel_remap/alpha=3
|
||||
process/fix_alpha_border=true
|
||||
process/premult_alpha=false
|
||||
process/normal_map_invert_y=false
|
||||
process/hdr_as_srgb=false
|
||||
process/hdr_clamp_exposure=false
|
||||
process/size_limit=0
|
||||
detect_3d/compress_to=1
|
||||
|
After Width: | Height: | Size: 318 B |
@@ -0,0 +1,40 @@
|
||||
[remap]
|
||||
|
||||
importer="texture"
|
||||
type="CompressedTexture2D"
|
||||
uid="uid://bct5tbq72yyfc"
|
||||
path="res://.godot/imported/arrow_down.png-fd47fcd6bee8167824d55f3d2c21addf.ctex"
|
||||
metadata={
|
||||
"vram_texture": false
|
||||
}
|
||||
|
||||
[deps]
|
||||
|
||||
source_file="res://addons/polydoodle/icons/arrow_down.png"
|
||||
dest_files=["res://.godot/imported/arrow_down.png-fd47fcd6bee8167824d55f3d2c21addf.ctex"]
|
||||
|
||||
[params]
|
||||
|
||||
compress/mode=0
|
||||
compress/high_quality=false
|
||||
compress/lossy_quality=0.7
|
||||
compress/uastc_level=0
|
||||
compress/rdo_quality_loss=0.0
|
||||
compress/hdr_compression=1
|
||||
compress/normal_map=0
|
||||
compress/channel_pack=0
|
||||
mipmaps/generate=false
|
||||
mipmaps/limit=-1
|
||||
roughness/mode=0
|
||||
roughness/src_normal=""
|
||||
process/channel_remap/red=0
|
||||
process/channel_remap/green=1
|
||||
process/channel_remap/blue=2
|
||||
process/channel_remap/alpha=3
|
||||
process/fix_alpha_border=true
|
||||
process/premult_alpha=false
|
||||
process/normal_map_invert_y=false
|
||||
process/hdr_as_srgb=false
|
||||
process/hdr_clamp_exposure=false
|
||||
process/size_limit=0
|
||||
detect_3d/compress_to=1
|
||||
|
After Width: | Height: | Size: 591 B |
@@ -0,0 +1,40 @@
|
||||
[remap]
|
||||
|
||||
importer="texture"
|
||||
type="CompressedTexture2D"
|
||||
uid="uid://bh5bref2cpnjy"
|
||||
path="res://.godot/imported/delete.png-962b2debcc25cbcea469aad5f4dc9fc4.ctex"
|
||||
metadata={
|
||||
"vram_texture": false
|
||||
}
|
||||
|
||||
[deps]
|
||||
|
||||
source_file="res://addons/polydoodle/icons/delete.png"
|
||||
dest_files=["res://.godot/imported/delete.png-962b2debcc25cbcea469aad5f4dc9fc4.ctex"]
|
||||
|
||||
[params]
|
||||
|
||||
compress/mode=0
|
||||
compress/high_quality=false
|
||||
compress/lossy_quality=0.7
|
||||
compress/uastc_level=0
|
||||
compress/rdo_quality_loss=0.0
|
||||
compress/hdr_compression=1
|
||||
compress/normal_map=0
|
||||
compress/channel_pack=0
|
||||
mipmaps/generate=false
|
||||
mipmaps/limit=-1
|
||||
roughness/mode=0
|
||||
roughness/src_normal=""
|
||||
process/channel_remap/red=0
|
||||
process/channel_remap/green=1
|
||||
process/channel_remap/blue=2
|
||||
process/channel_remap/alpha=3
|
||||
process/fix_alpha_border=true
|
||||
process/premult_alpha=false
|
||||
process/normal_map_invert_y=false
|
||||
process/hdr_as_srgb=false
|
||||
process/hdr_clamp_exposure=false
|
||||
process/size_limit=0
|
||||
detect_3d/compress_to=1
|
||||
|
After Width: | Height: | Size: 1.0 KiB |
@@ -0,0 +1,40 @@
|
||||
[remap]
|
||||
|
||||
importer="texture"
|
||||
type="CompressedTexture2D"
|
||||
uid="uid://bwpryixnuhtps"
|
||||
path="res://.godot/imported/detach.png-4941cf7e55d201cdf8b45112b4427b7b.ctex"
|
||||
metadata={
|
||||
"vram_texture": false
|
||||
}
|
||||
|
||||
[deps]
|
||||
|
||||
source_file="res://addons/polydoodle/icons/detach.png"
|
||||
dest_files=["res://.godot/imported/detach.png-4941cf7e55d201cdf8b45112b4427b7b.ctex"]
|
||||
|
||||
[params]
|
||||
|
||||
compress/mode=0
|
||||
compress/high_quality=false
|
||||
compress/lossy_quality=0.7
|
||||
compress/uastc_level=0
|
||||
compress/rdo_quality_loss=0.0
|
||||
compress/hdr_compression=1
|
||||
compress/normal_map=0
|
||||
compress/channel_pack=0
|
||||
mipmaps/generate=false
|
||||
mipmaps/limit=-1
|
||||
roughness/mode=0
|
||||
roughness/src_normal=""
|
||||
process/channel_remap/red=0
|
||||
process/channel_remap/green=1
|
||||
process/channel_remap/blue=2
|
||||
process/channel_remap/alpha=3
|
||||
process/fix_alpha_border=true
|
||||
process/premult_alpha=false
|
||||
process/normal_map_invert_y=false
|
||||
process/hdr_as_srgb=false
|
||||
process/hdr_clamp_exposure=false
|
||||
process/size_limit=0
|
||||
detect_3d/compress_to=1
|
||||
|
After Width: | Height: | Size: 840 B |
@@ -0,0 +1,40 @@
|
||||
[remap]
|
||||
|
||||
importer="texture"
|
||||
type="CompressedTexture2D"
|
||||
uid="uid://j07wwus6t60n"
|
||||
path="res://.godot/imported/docs.png-55d63756331bd04b535b8947a366b16a.ctex"
|
||||
metadata={
|
||||
"vram_texture": false
|
||||
}
|
||||
|
||||
[deps]
|
||||
|
||||
source_file="res://addons/polydoodle/icons/docs.png"
|
||||
dest_files=["res://.godot/imported/docs.png-55d63756331bd04b535b8947a366b16a.ctex"]
|
||||
|
||||
[params]
|
||||
|
||||
compress/mode=0
|
||||
compress/high_quality=false
|
||||
compress/lossy_quality=0.7
|
||||
compress/uastc_level=0
|
||||
compress/rdo_quality_loss=0.0
|
||||
compress/hdr_compression=1
|
||||
compress/normal_map=0
|
||||
compress/channel_pack=0
|
||||
mipmaps/generate=false
|
||||
mipmaps/limit=-1
|
||||
roughness/mode=0
|
||||
roughness/src_normal=""
|
||||
process/channel_remap/red=0
|
||||
process/channel_remap/green=1
|
||||
process/channel_remap/blue=2
|
||||
process/channel_remap/alpha=3
|
||||
process/fix_alpha_border=true
|
||||
process/premult_alpha=false
|
||||
process/normal_map_invert_y=false
|
||||
process/hdr_as_srgb=false
|
||||
process/hdr_clamp_exposure=false
|
||||
process/size_limit=0
|
||||
detect_3d/compress_to=1
|
||||
|
After Width: | Height: | Size: 547 B |
@@ -0,0 +1,40 @@
|
||||
[remap]
|
||||
|
||||
importer="texture"
|
||||
type="CompressedTexture2D"
|
||||
uid="uid://lfsob0x8pwuw"
|
||||
path="res://.godot/imported/doubleside.png-e1810d683972c6d9e235df798aca32e9.ctex"
|
||||
metadata={
|
||||
"vram_texture": false
|
||||
}
|
||||
|
||||
[deps]
|
||||
|
||||
source_file="res://addons/polydoodle/icons/doubleside.png"
|
||||
dest_files=["res://.godot/imported/doubleside.png-e1810d683972c6d9e235df798aca32e9.ctex"]
|
||||
|
||||
[params]
|
||||
|
||||
compress/mode=0
|
||||
compress/high_quality=false
|
||||
compress/lossy_quality=0.7
|
||||
compress/uastc_level=0
|
||||
compress/rdo_quality_loss=0.0
|
||||
compress/hdr_compression=1
|
||||
compress/normal_map=0
|
||||
compress/channel_pack=0
|
||||
mipmaps/generate=false
|
||||
mipmaps/limit=-1
|
||||
roughness/mode=0
|
||||
roughness/src_normal=""
|
||||
process/channel_remap/red=0
|
||||
process/channel_remap/green=1
|
||||
process/channel_remap/blue=2
|
||||
process/channel_remap/alpha=3
|
||||
process/fix_alpha_border=true
|
||||
process/premult_alpha=false
|
||||
process/normal_map_invert_y=false
|
||||
process/hdr_as_srgb=false
|
||||
process/hdr_clamp_exposure=false
|
||||
process/size_limit=0
|
||||
detect_3d/compress_to=1
|
||||
|
After Width: | Height: | Size: 863 B |
@@ -0,0 +1,40 @@
|
||||
[remap]
|
||||
|
||||
importer="texture"
|
||||
type="CompressedTexture2D"
|
||||
uid="uid://7shx06muwrg"
|
||||
path="res://.godot/imported/draw_tools.png-0322141f10c9f6772e987a56e393419f.ctex"
|
||||
metadata={
|
||||
"vram_texture": false
|
||||
}
|
||||
|
||||
[deps]
|
||||
|
||||
source_file="res://addons/polydoodle/icons/draw_tools.png"
|
||||
dest_files=["res://.godot/imported/draw_tools.png-0322141f10c9f6772e987a56e393419f.ctex"]
|
||||
|
||||
[params]
|
||||
|
||||
compress/mode=0
|
||||
compress/high_quality=false
|
||||
compress/lossy_quality=0.7
|
||||
compress/uastc_level=0
|
||||
compress/rdo_quality_loss=0.0
|
||||
compress/hdr_compression=1
|
||||
compress/normal_map=0
|
||||
compress/channel_pack=0
|
||||
mipmaps/generate=false
|
||||
mipmaps/limit=-1
|
||||
roughness/mode=0
|
||||
roughness/src_normal=""
|
||||
process/channel_remap/red=0
|
||||
process/channel_remap/green=1
|
||||
process/channel_remap/blue=2
|
||||
process/channel_remap/alpha=3
|
||||
process/fix_alpha_border=true
|
||||
process/premult_alpha=false
|
||||
process/normal_map_invert_y=false
|
||||
process/hdr_as_srgb=false
|
||||
process/hdr_clamp_exposure=false
|
||||
process/size_limit=0
|
||||
detect_3d/compress_to=1
|
||||
|
After Width: | Height: | Size: 537 B |
@@ -0,0 +1,40 @@
|
||||
[remap]
|
||||
|
||||
importer="texture"
|
||||
type="CompressedTexture2D"
|
||||
uid="uid://dm2l3vadevvft"
|
||||
path="res://.godot/imported/duplicate.png-41267b2788df90ff183ce47f3f4aa1ba.ctex"
|
||||
metadata={
|
||||
"vram_texture": false
|
||||
}
|
||||
|
||||
[deps]
|
||||
|
||||
source_file="res://addons/polydoodle/icons/duplicate.png"
|
||||
dest_files=["res://.godot/imported/duplicate.png-41267b2788df90ff183ce47f3f4aa1ba.ctex"]
|
||||
|
||||
[params]
|
||||
|
||||
compress/mode=0
|
||||
compress/high_quality=false
|
||||
compress/lossy_quality=0.7
|
||||
compress/uastc_level=0
|
||||
compress/rdo_quality_loss=0.0
|
||||
compress/hdr_compression=1
|
||||
compress/normal_map=0
|
||||
compress/channel_pack=0
|
||||
mipmaps/generate=false
|
||||
mipmaps/limit=-1
|
||||
roughness/mode=0
|
||||
roughness/src_normal=""
|
||||
process/channel_remap/red=0
|
||||
process/channel_remap/green=1
|
||||
process/channel_remap/blue=2
|
||||
process/channel_remap/alpha=3
|
||||
process/fix_alpha_border=true
|
||||
process/premult_alpha=false
|
||||
process/normal_map_invert_y=false
|
||||
process/hdr_as_srgb=false
|
||||
process/hdr_clamp_exposure=false
|
||||
process/size_limit=0
|
||||
detect_3d/compress_to=1
|
||||
|
After Width: | Height: | Size: 663 B |
@@ -0,0 +1,40 @@
|
||||
[remap]
|
||||
|
||||
importer="texture"
|
||||
type="CompressedTexture2D"
|
||||
uid="uid://ddiqseefgdcyf"
|
||||
path="res://.godot/imported/expand.png-bd2124a14aee7fb2083ea5cb49549125.ctex"
|
||||
metadata={
|
||||
"vram_texture": false
|
||||
}
|
||||
|
||||
[deps]
|
||||
|
||||
source_file="res://addons/polydoodle/icons/expand.png"
|
||||
dest_files=["res://.godot/imported/expand.png-bd2124a14aee7fb2083ea5cb49549125.ctex"]
|
||||
|
||||
[params]
|
||||
|
||||
compress/mode=0
|
||||
compress/high_quality=false
|
||||
compress/lossy_quality=0.7
|
||||
compress/uastc_level=0
|
||||
compress/rdo_quality_loss=0.0
|
||||
compress/hdr_compression=1
|
||||
compress/normal_map=0
|
||||
compress/channel_pack=0
|
||||
mipmaps/generate=false
|
||||
mipmaps/limit=-1
|
||||
roughness/mode=0
|
||||
roughness/src_normal=""
|
||||
process/channel_remap/red=0
|
||||
process/channel_remap/green=1
|
||||
process/channel_remap/blue=2
|
||||
process/channel_remap/alpha=3
|
||||
process/fix_alpha_border=true
|
||||
process/premult_alpha=false
|
||||
process/normal_map_invert_y=false
|
||||
process/hdr_as_srgb=false
|
||||
process/hdr_clamp_exposure=false
|
||||
process/size_limit=0
|
||||
detect_3d/compress_to=1
|
||||
|
After Width: | Height: | Size: 667 B |
@@ -0,0 +1,40 @@
|
||||
[remap]
|
||||
|
||||
importer="texture"
|
||||
type="CompressedTexture2D"
|
||||
uid="uid://b6156sjxjsue2"
|
||||
path="res://.godot/imported/export.png-24582d84d4bfe838e60fc84d624db505.ctex"
|
||||
metadata={
|
||||
"vram_texture": false
|
||||
}
|
||||
|
||||
[deps]
|
||||
|
||||
source_file="res://addons/polydoodle/icons/export.png"
|
||||
dest_files=["res://.godot/imported/export.png-24582d84d4bfe838e60fc84d624db505.ctex"]
|
||||
|
||||
[params]
|
||||
|
||||
compress/mode=0
|
||||
compress/high_quality=false
|
||||
compress/lossy_quality=0.7
|
||||
compress/uastc_level=0
|
||||
compress/rdo_quality_loss=0.0
|
||||
compress/hdr_compression=1
|
||||
compress/normal_map=0
|
||||
compress/channel_pack=0
|
||||
mipmaps/generate=false
|
||||
mipmaps/limit=-1
|
||||
roughness/mode=0
|
||||
roughness/src_normal=""
|
||||
process/channel_remap/red=0
|
||||
process/channel_remap/green=1
|
||||
process/channel_remap/blue=2
|
||||
process/channel_remap/alpha=3
|
||||
process/fix_alpha_border=true
|
||||
process/premult_alpha=false
|
||||
process/normal_map_invert_y=false
|
||||
process/hdr_as_srgb=false
|
||||
process/hdr_clamp_exposure=false
|
||||
process/size_limit=0
|
||||
detect_3d/compress_to=1
|
||||
|
After Width: | Height: | Size: 809 B |
@@ -0,0 +1,40 @@
|
||||
[remap]
|
||||
|
||||
importer="texture"
|
||||
type="CompressedTexture2D"
|
||||
uid="uid://cuau12los22u4"
|
||||
path="res://.godot/imported/eye.png-cbf7aa3049298811d7b886fcab0321a5.ctex"
|
||||
metadata={
|
||||
"vram_texture": false
|
||||
}
|
||||
|
||||
[deps]
|
||||
|
||||
source_file="res://addons/polydoodle/icons/eye.png"
|
||||
dest_files=["res://.godot/imported/eye.png-cbf7aa3049298811d7b886fcab0321a5.ctex"]
|
||||
|
||||
[params]
|
||||
|
||||
compress/mode=0
|
||||
compress/high_quality=false
|
||||
compress/lossy_quality=0.7
|
||||
compress/uastc_level=0
|
||||
compress/rdo_quality_loss=0.0
|
||||
compress/hdr_compression=1
|
||||
compress/normal_map=0
|
||||
compress/channel_pack=0
|
||||
mipmaps/generate=false
|
||||
mipmaps/limit=-1
|
||||
roughness/mode=0
|
||||
roughness/src_normal=""
|
||||
process/channel_remap/red=0
|
||||
process/channel_remap/green=1
|
||||
process/channel_remap/blue=2
|
||||
process/channel_remap/alpha=3
|
||||
process/fix_alpha_border=true
|
||||
process/premult_alpha=false
|
||||
process/normal_map_invert_y=false
|
||||
process/hdr_as_srgb=false
|
||||
process/hdr_clamp_exposure=false
|
||||
process/size_limit=0
|
||||
detect_3d/compress_to=1
|
||||
|
After Width: | Height: | Size: 587 B |
@@ -0,0 +1,40 @@
|
||||
[remap]
|
||||
|
||||
importer="texture"
|
||||
type="CompressedTexture2D"
|
||||
uid="uid://gbtvjawoxpd1"
|
||||
path="res://.godot/imported/eye_off.png-582f7e5f6d985c4ddfdf42759747371a.ctex"
|
||||
metadata={
|
||||
"vram_texture": false
|
||||
}
|
||||
|
||||
[deps]
|
||||
|
||||
source_file="res://addons/polydoodle/icons/eye_off.png"
|
||||
dest_files=["res://.godot/imported/eye_off.png-582f7e5f6d985c4ddfdf42759747371a.ctex"]
|
||||
|
||||
[params]
|
||||
|
||||
compress/mode=0
|
||||
compress/high_quality=false
|
||||
compress/lossy_quality=0.7
|
||||
compress/uastc_level=0
|
||||
compress/rdo_quality_loss=0.0
|
||||
compress/hdr_compression=1
|
||||
compress/normal_map=0
|
||||
compress/channel_pack=0
|
||||
mipmaps/generate=false
|
||||
mipmaps/limit=-1
|
||||
roughness/mode=0
|
||||
roughness/src_normal=""
|
||||
process/channel_remap/red=0
|
||||
process/channel_remap/green=1
|
||||
process/channel_remap/blue=2
|
||||
process/channel_remap/alpha=3
|
||||
process/fix_alpha_border=true
|
||||
process/premult_alpha=false
|
||||
process/normal_map_invert_y=false
|
||||
process/hdr_as_srgb=false
|
||||
process/hdr_clamp_exposure=false
|
||||
process/size_limit=0
|
||||
detect_3d/compress_to=1
|
||||
|
After Width: | Height: | Size: 422 B |
@@ -0,0 +1,40 @@
|
||||
[remap]
|
||||
|
||||
importer="texture"
|
||||
type="CompressedTexture2D"
|
||||
uid="uid://b8tnwacipj1hr"
|
||||
path="res://.godot/imported/flip.png-825c5e6cc4f00c9e81568d1748532e9b.ctex"
|
||||
metadata={
|
||||
"vram_texture": false
|
||||
}
|
||||
|
||||
[deps]
|
||||
|
||||
source_file="res://addons/polydoodle/icons/flip.png"
|
||||
dest_files=["res://.godot/imported/flip.png-825c5e6cc4f00c9e81568d1748532e9b.ctex"]
|
||||
|
||||
[params]
|
||||
|
||||
compress/mode=0
|
||||
compress/high_quality=false
|
||||
compress/lossy_quality=0.7
|
||||
compress/uastc_level=0
|
||||
compress/rdo_quality_loss=0.0
|
||||
compress/hdr_compression=1
|
||||
compress/normal_map=0
|
||||
compress/channel_pack=0
|
||||
mipmaps/generate=false
|
||||
mipmaps/limit=-1
|
||||
roughness/mode=0
|
||||
roughness/src_normal=""
|
||||
process/channel_remap/red=0
|
||||
process/channel_remap/green=1
|
||||
process/channel_remap/blue=2
|
||||
process/channel_remap/alpha=3
|
||||
process/fix_alpha_border=true
|
||||
process/premult_alpha=false
|
||||
process/normal_map_invert_y=false
|
||||
process/hdr_as_srgb=false
|
||||
process/hdr_clamp_exposure=false
|
||||
process/size_limit=0
|
||||
detect_3d/compress_to=1
|
||||
|
After Width: | Height: | Size: 763 B |
@@ -0,0 +1,40 @@
|
||||
[remap]
|
||||
|
||||
importer="texture"
|
||||
type="CompressedTexture2D"
|
||||
uid="uid://buktdb6t52uf3"
|
||||
path="res://.godot/imported/gear.png-972ec0d1b916350ff707119b985597d2.ctex"
|
||||
metadata={
|
||||
"vram_texture": false
|
||||
}
|
||||
|
||||
[deps]
|
||||
|
||||
source_file="res://addons/polydoodle/icons/gear.png"
|
||||
dest_files=["res://.godot/imported/gear.png-972ec0d1b916350ff707119b985597d2.ctex"]
|
||||
|
||||
[params]
|
||||
|
||||
compress/mode=0
|
||||
compress/high_quality=false
|
||||
compress/lossy_quality=0.7
|
||||
compress/uastc_level=0
|
||||
compress/rdo_quality_loss=0.0
|
||||
compress/hdr_compression=1
|
||||
compress/normal_map=0
|
||||
compress/channel_pack=0
|
||||
mipmaps/generate=false
|
||||
mipmaps/limit=-1
|
||||
roughness/mode=0
|
||||
roughness/src_normal=""
|
||||
process/channel_remap/red=0
|
||||
process/channel_remap/green=1
|
||||
process/channel_remap/blue=2
|
||||
process/channel_remap/alpha=3
|
||||
process/fix_alpha_border=true
|
||||
process/premult_alpha=false
|
||||
process/normal_map_invert_y=false
|
||||
process/hdr_as_srgb=false
|
||||
process/hdr_clamp_exposure=false
|
||||
process/size_limit=0
|
||||
detect_3d/compress_to=1
|
||||
|
After Width: | Height: | Size: 709 B |
@@ -0,0 +1,40 @@
|
||||
[remap]
|
||||
|
||||
importer="texture"
|
||||
type="CompressedTexture2D"
|
||||
uid="uid://bktf5l54rl76j"
|
||||
path="res://.godot/imported/gizmo.png-f78ad6cec548106698d14f2456d719b2.ctex"
|
||||
metadata={
|
||||
"vram_texture": false
|
||||
}
|
||||
|
||||
[deps]
|
||||
|
||||
source_file="res://addons/polydoodle/icons/gizmo.png"
|
||||
dest_files=["res://.godot/imported/gizmo.png-f78ad6cec548106698d14f2456d719b2.ctex"]
|
||||
|
||||
[params]
|
||||
|
||||
compress/mode=0
|
||||
compress/high_quality=false
|
||||
compress/lossy_quality=0.7
|
||||
compress/uastc_level=0
|
||||
compress/rdo_quality_loss=0.0
|
||||
compress/hdr_compression=1
|
||||
compress/normal_map=0
|
||||
compress/channel_pack=0
|
||||
mipmaps/generate=false
|
||||
mipmaps/limit=-1
|
||||
roughness/mode=0
|
||||
roughness/src_normal=""
|
||||
process/channel_remap/red=0
|
||||
process/channel_remap/green=1
|
||||
process/channel_remap/blue=2
|
||||
process/channel_remap/alpha=3
|
||||
process/fix_alpha_border=true
|
||||
process/premult_alpha=false
|
||||
process/normal_map_invert_y=false
|
||||
process/hdr_as_srgb=false
|
||||
process/hdr_clamp_exposure=false
|
||||
process/size_limit=0
|
||||
detect_3d/compress_to=1
|
||||
|
After Width: | Height: | Size: 628 B |
@@ -0,0 +1,40 @@
|
||||
[remap]
|
||||
|
||||
importer="texture"
|
||||
type="CompressedTexture2D"
|
||||
uid="uid://bigwuoqacudjj"
|
||||
path="res://.godot/imported/gizmo_move.png-c9442e43308cce828371b3d2e95643c7.ctex"
|
||||
metadata={
|
||||
"vram_texture": false
|
||||
}
|
||||
|
||||
[deps]
|
||||
|
||||
source_file="res://addons/polydoodle/icons/gizmo_move.png"
|
||||
dest_files=["res://.godot/imported/gizmo_move.png-c9442e43308cce828371b3d2e95643c7.ctex"]
|
||||
|
||||
[params]
|
||||
|
||||
compress/mode=0
|
||||
compress/high_quality=false
|
||||
compress/lossy_quality=0.7
|
||||
compress/uastc_level=0
|
||||
compress/rdo_quality_loss=0.0
|
||||
compress/hdr_compression=1
|
||||
compress/normal_map=0
|
||||
compress/channel_pack=0
|
||||
mipmaps/generate=false
|
||||
mipmaps/limit=-1
|
||||
roughness/mode=0
|
||||
roughness/src_normal=""
|
||||
process/channel_remap/red=0
|
||||
process/channel_remap/green=1
|
||||
process/channel_remap/blue=2
|
||||
process/channel_remap/alpha=3
|
||||
process/fix_alpha_border=true
|
||||
process/premult_alpha=false
|
||||
process/normal_map_invert_y=false
|
||||
process/hdr_as_srgb=false
|
||||
process/hdr_clamp_exposure=false
|
||||
process/size_limit=0
|
||||
detect_3d/compress_to=1
|
||||
|
After Width: | Height: | Size: 1015 B |
@@ -0,0 +1,40 @@
|
||||
[remap]
|
||||
|
||||
importer="texture"
|
||||
type="CompressedTexture2D"
|
||||
uid="uid://d1dcoefl2nuyq"
|
||||
path="res://.godot/imported/gizmo_rotate.png-49d9114314921b4f91456fdb2e236a45.ctex"
|
||||
metadata={
|
||||
"vram_texture": false
|
||||
}
|
||||
|
||||
[deps]
|
||||
|
||||
source_file="res://addons/polydoodle/icons/gizmo_rotate.png"
|
||||
dest_files=["res://.godot/imported/gizmo_rotate.png-49d9114314921b4f91456fdb2e236a45.ctex"]
|
||||
|
||||
[params]
|
||||
|
||||
compress/mode=0
|
||||
compress/high_quality=false
|
||||
compress/lossy_quality=0.7
|
||||
compress/uastc_level=0
|
||||
compress/rdo_quality_loss=0.0
|
||||
compress/hdr_compression=1
|
||||
compress/normal_map=0
|
||||
compress/channel_pack=0
|
||||
mipmaps/generate=false
|
||||
mipmaps/limit=-1
|
||||
roughness/mode=0
|
||||
roughness/src_normal=""
|
||||
process/channel_remap/red=0
|
||||
process/channel_remap/green=1
|
||||
process/channel_remap/blue=2
|
||||
process/channel_remap/alpha=3
|
||||
process/fix_alpha_border=true
|
||||
process/premult_alpha=false
|
||||
process/normal_map_invert_y=false
|
||||
process/hdr_as_srgb=false
|
||||
process/hdr_clamp_exposure=false
|
||||
process/size_limit=0
|
||||
detect_3d/compress_to=1
|
||||
|
After Width: | Height: | Size: 748 B |
@@ -0,0 +1,40 @@
|
||||
[remap]
|
||||
|
||||
importer="texture"
|
||||
type="CompressedTexture2D"
|
||||
uid="uid://7x2aqb4cxmqs"
|
||||
path="res://.godot/imported/gizmo_scale.png-2b63a3f888414656d87e05b50ef62f60.ctex"
|
||||
metadata={
|
||||
"vram_texture": false
|
||||
}
|
||||
|
||||
[deps]
|
||||
|
||||
source_file="res://addons/polydoodle/icons/gizmo_scale.png"
|
||||
dest_files=["res://.godot/imported/gizmo_scale.png-2b63a3f888414656d87e05b50ef62f60.ctex"]
|
||||
|
||||
[params]
|
||||
|
||||
compress/mode=0
|
||||
compress/high_quality=false
|
||||
compress/lossy_quality=0.7
|
||||
compress/uastc_level=0
|
||||
compress/rdo_quality_loss=0.0
|
||||
compress/hdr_compression=1
|
||||
compress/normal_map=0
|
||||
compress/channel_pack=0
|
||||
mipmaps/generate=false
|
||||
mipmaps/limit=-1
|
||||
roughness/mode=0
|
||||
roughness/src_normal=""
|
||||
process/channel_remap/red=0
|
||||
process/channel_remap/green=1
|
||||
process/channel_remap/blue=2
|
||||
process/channel_remap/alpha=3
|
||||
process/fix_alpha_border=true
|
||||
process/premult_alpha=false
|
||||
process/normal_map_invert_y=false
|
||||
process/hdr_as_srgb=false
|
||||
process/hdr_clamp_exposure=false
|
||||
process/size_limit=0
|
||||
detect_3d/compress_to=1
|
||||
|
After Width: | Height: | Size: 342 B |
@@ -0,0 +1,40 @@
|
||||
[remap]
|
||||
|
||||
importer="texture"
|
||||
type="CompressedTexture2D"
|
||||
uid="uid://cubaitdso2pu5"
|
||||
path="res://.godot/imported/grid.png-30ec88308aee9fa19b757bfc32a25d02.ctex"
|
||||
metadata={
|
||||
"vram_texture": false
|
||||
}
|
||||
|
||||
[deps]
|
||||
|
||||
source_file="res://addons/polydoodle/icons/grid.png"
|
||||
dest_files=["res://.godot/imported/grid.png-30ec88308aee9fa19b757bfc32a25d02.ctex"]
|
||||
|
||||
[params]
|
||||
|
||||
compress/mode=0
|
||||
compress/high_quality=false
|
||||
compress/lossy_quality=0.7
|
||||
compress/uastc_level=0
|
||||
compress/rdo_quality_loss=0.0
|
||||
compress/hdr_compression=1
|
||||
compress/normal_map=0
|
||||
compress/channel_pack=0
|
||||
mipmaps/generate=false
|
||||
mipmaps/limit=-1
|
||||
roughness/mode=0
|
||||
roughness/src_normal=""
|
||||
process/channel_remap/red=0
|
||||
process/channel_remap/green=1
|
||||
process/channel_remap/blue=2
|
||||
process/channel_remap/alpha=3
|
||||
process/fix_alpha_border=true
|
||||
process/premult_alpha=false
|
||||
process/normal_map_invert_y=false
|
||||
process/hdr_as_srgb=false
|
||||
process/hdr_clamp_exposure=false
|
||||
process/size_limit=0
|
||||
detect_3d/compress_to=1
|
||||
|
After Width: | Height: | Size: 1.2 KiB |
@@ -0,0 +1,40 @@
|
||||
[remap]
|
||||
|
||||
importer="texture"
|
||||
type="CompressedTexture2D"
|
||||
uid="uid://b6eneawbswr5f"
|
||||
path="res://.godot/imported/icon.png-563bf8c735d9a72a4614c6933f4185b4.ctex"
|
||||
metadata={
|
||||
"vram_texture": false
|
||||
}
|
||||
|
||||
[deps]
|
||||
|
||||
source_file="res://addons/polydoodle/icons/icon.png"
|
||||
dest_files=["res://.godot/imported/icon.png-563bf8c735d9a72a4614c6933f4185b4.ctex"]
|
||||
|
||||
[params]
|
||||
|
||||
compress/mode=0
|
||||
compress/high_quality=false
|
||||
compress/lossy_quality=0.7
|
||||
compress/uastc_level=0
|
||||
compress/rdo_quality_loss=0.0
|
||||
compress/hdr_compression=1
|
||||
compress/normal_map=0
|
||||
compress/channel_pack=0
|
||||
mipmaps/generate=false
|
||||
mipmaps/limit=-1
|
||||
roughness/mode=0
|
||||
roughness/src_normal=""
|
||||
process/channel_remap/red=0
|
||||
process/channel_remap/green=1
|
||||
process/channel_remap/blue=2
|
||||
process/channel_remap/alpha=3
|
||||
process/fix_alpha_border=true
|
||||
process/premult_alpha=false
|
||||
process/normal_map_invert_y=false
|
||||
process/hdr_as_srgb=false
|
||||
process/hdr_clamp_exposure=false
|
||||
process/size_limit=0
|
||||
detect_3d/compress_to=1
|
||||
|
After Width: | Height: | Size: 690 B |
@@ -0,0 +1,40 @@
|
||||
[remap]
|
||||
|
||||
importer="texture"
|
||||
type="CompressedTexture2D"
|
||||
uid="uid://07spb4bvb75r"
|
||||
path="res://.godot/imported/image.png-e56c197883ee8d02f81a7f9d321b3570.ctex"
|
||||
metadata={
|
||||
"vram_texture": false
|
||||
}
|
||||
|
||||
[deps]
|
||||
|
||||
source_file="res://addons/polydoodle/icons/image.png"
|
||||
dest_files=["res://.godot/imported/image.png-e56c197883ee8d02f81a7f9d321b3570.ctex"]
|
||||
|
||||
[params]
|
||||
|
||||
compress/mode=0
|
||||
compress/high_quality=false
|
||||
compress/lossy_quality=0.7
|
||||
compress/uastc_level=0
|
||||
compress/rdo_quality_loss=0.0
|
||||
compress/hdr_compression=1
|
||||
compress/normal_map=0
|
||||
compress/channel_pack=0
|
||||
mipmaps/generate=false
|
||||
mipmaps/limit=-1
|
||||
roughness/mode=0
|
||||
roughness/src_normal=""
|
||||
process/channel_remap/red=0
|
||||
process/channel_remap/green=1
|
||||
process/channel_remap/blue=2
|
||||
process/channel_remap/alpha=3
|
||||
process/fix_alpha_border=true
|
||||
process/premult_alpha=false
|
||||
process/normal_map_invert_y=false
|
||||
process/hdr_as_srgb=false
|
||||
process/hdr_clamp_exposure=false
|
||||
process/size_limit=0
|
||||
detect_3d/compress_to=1
|
||||
|
After Width: | Height: | Size: 615 B |
@@ -0,0 +1,40 @@
|
||||
[remap]
|
||||
|
||||
importer="texture"
|
||||
type="CompressedTexture2D"
|
||||
uid="uid://d3us75lpe46rq"
|
||||
path="res://.godot/imported/import_model.png-6d320825add8b1e9074b14e01c1b6efc.ctex"
|
||||
metadata={
|
||||
"vram_texture": false
|
||||
}
|
||||
|
||||
[deps]
|
||||
|
||||
source_file="res://addons/polydoodle/icons/import_model.png"
|
||||
dest_files=["res://.godot/imported/import_model.png-6d320825add8b1e9074b14e01c1b6efc.ctex"]
|
||||
|
||||
[params]
|
||||
|
||||
compress/mode=0
|
||||
compress/high_quality=false
|
||||
compress/lossy_quality=0.7
|
||||
compress/uastc_level=0
|
||||
compress/rdo_quality_loss=0.0
|
||||
compress/hdr_compression=1
|
||||
compress/normal_map=0
|
||||
compress/channel_pack=0
|
||||
mipmaps/generate=false
|
||||
mipmaps/limit=-1
|
||||
roughness/mode=0
|
||||
roughness/src_normal=""
|
||||
process/channel_remap/red=0
|
||||
process/channel_remap/green=1
|
||||
process/channel_remap/blue=2
|
||||
process/channel_remap/alpha=3
|
||||
process/fix_alpha_border=true
|
||||
process/premult_alpha=false
|
||||
process/normal_map_invert_y=false
|
||||
process/hdr_as_srgb=false
|
||||
process/hdr_clamp_exposure=false
|
||||
process/size_limit=0
|
||||
detect_3d/compress_to=1
|
||||
|
After Width: | Height: | Size: 704 B |
@@ -0,0 +1,40 @@
|
||||
[remap]
|
||||
|
||||
importer="texture"
|
||||
type="CompressedTexture2D"
|
||||
uid="uid://b46jmm2h3tc40"
|
||||
path="res://.godot/imported/lock.png-6d2857bafd1cdf92743274ec0890307f.ctex"
|
||||
metadata={
|
||||
"vram_texture": false
|
||||
}
|
||||
|
||||
[deps]
|
||||
|
||||
source_file="res://addons/polydoodle/icons/lock.png"
|
||||
dest_files=["res://.godot/imported/lock.png-6d2857bafd1cdf92743274ec0890307f.ctex"]
|
||||
|
||||
[params]
|
||||
|
||||
compress/mode=0
|
||||
compress/high_quality=false
|
||||
compress/lossy_quality=0.7
|
||||
compress/uastc_level=0
|
||||
compress/rdo_quality_loss=0.0
|
||||
compress/hdr_compression=1
|
||||
compress/normal_map=0
|
||||
compress/channel_pack=0
|
||||
mipmaps/generate=false
|
||||
mipmaps/limit=-1
|
||||
roughness/mode=0
|
||||
roughness/src_normal=""
|
||||
process/channel_remap/red=0
|
||||
process/channel_remap/green=1
|
||||
process/channel_remap/blue=2
|
||||
process/channel_remap/alpha=3
|
||||
process/fix_alpha_border=true
|
||||
process/premult_alpha=false
|
||||
process/normal_map_invert_y=false
|
||||
process/hdr_as_srgb=false
|
||||
process/hdr_clamp_exposure=false
|
||||
process/size_limit=0
|
||||
detect_3d/compress_to=1
|
||||
|
After Width: | Height: | Size: 496 B |
@@ -0,0 +1,40 @@
|
||||
[remap]
|
||||
|
||||
importer="texture"
|
||||
type="CompressedTexture2D"
|
||||
uid="uid://boxshmixmuxpq"
|
||||
path="res://.godot/imported/mode_draw.png-1c38cc62dec1b3f727d51934949004da.ctex"
|
||||
metadata={
|
||||
"vram_texture": false
|
||||
}
|
||||
|
||||
[deps]
|
||||
|
||||
source_file="res://addons/polydoodle/icons/mode_draw.png"
|
||||
dest_files=["res://.godot/imported/mode_draw.png-1c38cc62dec1b3f727d51934949004da.ctex"]
|
||||
|
||||
[params]
|
||||
|
||||
compress/mode=0
|
||||
compress/high_quality=false
|
||||
compress/lossy_quality=0.7
|
||||
compress/uastc_level=0
|
||||
compress/rdo_quality_loss=0.0
|
||||
compress/hdr_compression=1
|
||||
compress/normal_map=0
|
||||
compress/channel_pack=0
|
||||
mipmaps/generate=false
|
||||
mipmaps/limit=-1
|
||||
roughness/mode=0
|
||||
roughness/src_normal=""
|
||||
process/channel_remap/red=0
|
||||
process/channel_remap/green=1
|
||||
process/channel_remap/blue=2
|
||||
process/channel_remap/alpha=3
|
||||
process/fix_alpha_border=true
|
||||
process/premult_alpha=false
|
||||
process/normal_map_invert_y=false
|
||||
process/hdr_as_srgb=false
|
||||
process/hdr_clamp_exposure=false
|
||||
process/size_limit=0
|
||||
detect_3d/compress_to=1
|
||||
|
After Width: | Height: | Size: 1.0 KiB |
@@ -0,0 +1,40 @@
|
||||
[remap]
|
||||
|
||||
importer="texture"
|
||||
type="CompressedTexture2D"
|
||||
uid="uid://cob7or53b0lm0"
|
||||
path="res://.godot/imported/mode_edge.png-7befa0a5220c9941a96de027cce1494d.ctex"
|
||||
metadata={
|
||||
"vram_texture": false
|
||||
}
|
||||
|
||||
[deps]
|
||||
|
||||
source_file="res://addons/polydoodle/icons/mode_edge.png"
|
||||
dest_files=["res://.godot/imported/mode_edge.png-7befa0a5220c9941a96de027cce1494d.ctex"]
|
||||
|
||||
[params]
|
||||
|
||||
compress/mode=0
|
||||
compress/high_quality=false
|
||||
compress/lossy_quality=0.7
|
||||
compress/uastc_level=0
|
||||
compress/rdo_quality_loss=0.0
|
||||
compress/hdr_compression=1
|
||||
compress/normal_map=0
|
||||
compress/channel_pack=0
|
||||
mipmaps/generate=false
|
||||
mipmaps/limit=-1
|
||||
roughness/mode=0
|
||||
roughness/src_normal=""
|
||||
process/channel_remap/red=0
|
||||
process/channel_remap/green=1
|
||||
process/channel_remap/blue=2
|
||||
process/channel_remap/alpha=3
|
||||
process/fix_alpha_border=true
|
||||
process/premult_alpha=false
|
||||
process/normal_map_invert_y=false
|
||||
process/hdr_as_srgb=false
|
||||
process/hdr_clamp_exposure=false
|
||||
process/size_limit=0
|
||||
detect_3d/compress_to=1
|
||||
|
After Width: | Height: | Size: 835 B |
@@ -0,0 +1,40 @@
|
||||
[remap]
|
||||
|
||||
importer="texture"
|
||||
type="CompressedTexture2D"
|
||||
uid="uid://wpixw314at37"
|
||||
path="res://.godot/imported/mode_face.png-dfb10639736896c291c84b0c336f3393.ctex"
|
||||
metadata={
|
||||
"vram_texture": false
|
||||
}
|
||||
|
||||
[deps]
|
||||
|
||||
source_file="res://addons/polydoodle/icons/mode_face.png"
|
||||
dest_files=["res://.godot/imported/mode_face.png-dfb10639736896c291c84b0c336f3393.ctex"]
|
||||
|
||||
[params]
|
||||
|
||||
compress/mode=0
|
||||
compress/high_quality=false
|
||||
compress/lossy_quality=0.7
|
||||
compress/uastc_level=0
|
||||
compress/rdo_quality_loss=0.0
|
||||
compress/hdr_compression=1
|
||||
compress/normal_map=0
|
||||
compress/channel_pack=0
|
||||
mipmaps/generate=false
|
||||
mipmaps/limit=-1
|
||||
roughness/mode=0
|
||||
roughness/src_normal=""
|
||||
process/channel_remap/red=0
|
||||
process/channel_remap/green=1
|
||||
process/channel_remap/blue=2
|
||||
process/channel_remap/alpha=3
|
||||
process/fix_alpha_border=true
|
||||
process/premult_alpha=false
|
||||
process/normal_map_invert_y=false
|
||||
process/hdr_as_srgb=false
|
||||
process/hdr_clamp_exposure=false
|
||||
process/size_limit=0
|
||||
detect_3d/compress_to=1
|
||||
|
After Width: | Height: | Size: 777 B |
@@ -0,0 +1,40 @@
|
||||
[remap]
|
||||
|
||||
importer="texture"
|
||||
type="CompressedTexture2D"
|
||||
uid="uid://0ogpktp37nsq"
|
||||
path="res://.godot/imported/mode_object.png-ec044a92c2c86ffa93b836444a34aceb.ctex"
|
||||
metadata={
|
||||
"vram_texture": false
|
||||
}
|
||||
|
||||
[deps]
|
||||
|
||||
source_file="res://addons/polydoodle/icons/mode_object.png"
|
||||
dest_files=["res://.godot/imported/mode_object.png-ec044a92c2c86ffa93b836444a34aceb.ctex"]
|
||||
|
||||
[params]
|
||||
|
||||
compress/mode=0
|
||||
compress/high_quality=false
|
||||
compress/lossy_quality=0.7
|
||||
compress/uastc_level=0
|
||||
compress/rdo_quality_loss=0.0
|
||||
compress/hdr_compression=1
|
||||
compress/normal_map=0
|
||||
compress/channel_pack=0
|
||||
mipmaps/generate=false
|
||||
mipmaps/limit=-1
|
||||
roughness/mode=0
|
||||
roughness/src_normal=""
|
||||
process/channel_remap/red=0
|
||||
process/channel_remap/green=1
|
||||
process/channel_remap/blue=2
|
||||
process/channel_remap/alpha=3
|
||||
process/fix_alpha_border=true
|
||||
process/premult_alpha=false
|
||||
process/normal_map_invert_y=false
|
||||
process/hdr_as_srgb=false
|
||||
process/hdr_clamp_exposure=false
|
||||
process/size_limit=0
|
||||
detect_3d/compress_to=1
|
||||
|
After Width: | Height: | Size: 564 B |
@@ -0,0 +1,40 @@
|
||||
[remap]
|
||||
|
||||
importer="texture"
|
||||
type="CompressedTexture2D"
|
||||
uid="uid://dnl4q3bt3qfal"
|
||||
path="res://.godot/imported/mode_paint.png-7edf3dbfb68acfcbb75a01b194be5dcf.ctex"
|
||||
metadata={
|
||||
"vram_texture": false
|
||||
}
|
||||
|
||||
[deps]
|
||||
|
||||
source_file="res://addons/polydoodle/icons/mode_paint.png"
|
||||
dest_files=["res://.godot/imported/mode_paint.png-7edf3dbfb68acfcbb75a01b194be5dcf.ctex"]
|
||||
|
||||
[params]
|
||||
|
||||
compress/mode=0
|
||||
compress/high_quality=false
|
||||
compress/lossy_quality=0.7
|
||||
compress/uastc_level=0
|
||||
compress/rdo_quality_loss=0.0
|
||||
compress/hdr_compression=1
|
||||
compress/normal_map=0
|
||||
compress/channel_pack=0
|
||||
mipmaps/generate=false
|
||||
mipmaps/limit=-1
|
||||
roughness/mode=0
|
||||
roughness/src_normal=""
|
||||
process/channel_remap/red=0
|
||||
process/channel_remap/green=1
|
||||
process/channel_remap/blue=2
|
||||
process/channel_remap/alpha=3
|
||||
process/fix_alpha_border=true
|
||||
process/premult_alpha=false
|
||||
process/normal_map_invert_y=false
|
||||
process/hdr_as_srgb=false
|
||||
process/hdr_clamp_exposure=false
|
||||
process/size_limit=0
|
||||
detect_3d/compress_to=1
|
||||
|
After Width: | Height: | Size: 1013 B |
@@ -0,0 +1,40 @@
|
||||
[remap]
|
||||
|
||||
importer="texture"
|
||||
type="CompressedTexture2D"
|
||||
uid="uid://qjwt3xhsdqke"
|
||||
path="res://.godot/imported/mode_vertex.png-be9f7ede7c0bffae2db846903ea3a3a0.ctex"
|
||||
metadata={
|
||||
"vram_texture": false
|
||||
}
|
||||
|
||||
[deps]
|
||||
|
||||
source_file="res://addons/polydoodle/icons/mode_vertex.png"
|
||||
dest_files=["res://.godot/imported/mode_vertex.png-be9f7ede7c0bffae2db846903ea3a3a0.ctex"]
|
||||
|
||||
[params]
|
||||
|
||||
compress/mode=0
|
||||
compress/high_quality=false
|
||||
compress/lossy_quality=0.7
|
||||
compress/uastc_level=0
|
||||
compress/rdo_quality_loss=0.0
|
||||
compress/hdr_compression=1
|
||||
compress/normal_map=0
|
||||
compress/channel_pack=0
|
||||
mipmaps/generate=false
|
||||
mipmaps/limit=-1
|
||||
roughness/mode=0
|
||||
roughness/src_normal=""
|
||||
process/channel_remap/red=0
|
||||
process/channel_remap/green=1
|
||||
process/channel_remap/blue=2
|
||||
process/channel_remap/alpha=3
|
||||
process/fix_alpha_border=true
|
||||
process/premult_alpha=false
|
||||
process/normal_map_invert_y=false
|
||||
process/hdr_as_srgb=false
|
||||
process/hdr_clamp_exposure=false
|
||||
process/size_limit=0
|
||||
detect_3d/compress_to=1
|
||||
|
After Width: | Height: | Size: 751 B |
@@ -0,0 +1,40 @@
|
||||
[remap]
|
||||
|
||||
importer="texture"
|
||||
type="CompressedTexture2D"
|
||||
uid="uid://fqeyem20hmvl"
|
||||
path="res://.godot/imported/open.png-273f8532ec1960b92e5ccbf615cce940.ctex"
|
||||
metadata={
|
||||
"vram_texture": false
|
||||
}
|
||||
|
||||
[deps]
|
||||
|
||||
source_file="res://addons/polydoodle/icons/open.png"
|
||||
dest_files=["res://.godot/imported/open.png-273f8532ec1960b92e5ccbf615cce940.ctex"]
|
||||
|
||||
[params]
|
||||
|
||||
compress/mode=0
|
||||
compress/high_quality=false
|
||||
compress/lossy_quality=0.7
|
||||
compress/uastc_level=0
|
||||
compress/rdo_quality_loss=0.0
|
||||
compress/hdr_compression=1
|
||||
compress/normal_map=0
|
||||
compress/channel_pack=0
|
||||
mipmaps/generate=false
|
||||
mipmaps/limit=-1
|
||||
roughness/mode=0
|
||||
roughness/src_normal=""
|
||||
process/channel_remap/red=0
|
||||
process/channel_remap/green=1
|
||||
process/channel_remap/blue=2
|
||||
process/channel_remap/alpha=3
|
||||
process/fix_alpha_border=true
|
||||
process/premult_alpha=false
|
||||
process/normal_map_invert_y=false
|
||||
process/hdr_as_srgb=false
|
||||
process/hdr_clamp_exposure=false
|
||||
process/size_limit=0
|
||||
detect_3d/compress_to=1
|
||||
|
After Width: | Height: | Size: 583 B |
@@ -0,0 +1,40 @@
|
||||
[remap]
|
||||
|
||||
importer="texture"
|
||||
type="CompressedTexture2D"
|
||||
uid="uid://kbpse2veoyf4"
|
||||
path="res://.godot/imported/paint_tools.png-0e3c546436df58df6861ac816ce1c7d1.ctex"
|
||||
metadata={
|
||||
"vram_texture": false
|
||||
}
|
||||
|
||||
[deps]
|
||||
|
||||
source_file="res://addons/polydoodle/icons/paint_tools.png"
|
||||
dest_files=["res://.godot/imported/paint_tools.png-0e3c546436df58df6861ac816ce1c7d1.ctex"]
|
||||
|
||||
[params]
|
||||
|
||||
compress/mode=0
|
||||
compress/high_quality=false
|
||||
compress/lossy_quality=0.7
|
||||
compress/uastc_level=0
|
||||
compress/rdo_quality_loss=0.0
|
||||
compress/hdr_compression=1
|
||||
compress/normal_map=0
|
||||
compress/channel_pack=0
|
||||
mipmaps/generate=false
|
||||
mipmaps/limit=-1
|
||||
roughness/mode=0
|
||||
roughness/src_normal=""
|
||||
process/channel_remap/red=0
|
||||
process/channel_remap/green=1
|
||||
process/channel_remap/blue=2
|
||||
process/channel_remap/alpha=3
|
||||
process/fix_alpha_border=true
|
||||
process/premult_alpha=false
|
||||
process/normal_map_invert_y=false
|
||||
process/hdr_as_srgb=false
|
||||
process/hdr_clamp_exposure=false
|
||||
process/size_limit=0
|
||||
detect_3d/compress_to=1
|
||||
|
After Width: | Height: | Size: 783 B |
@@ -0,0 +1,40 @@
|
||||
[remap]
|
||||
|
||||
importer="texture"
|
||||
type="CompressedTexture2D"
|
||||
uid="uid://cd4uc17i2kc00"
|
||||
path="res://.godot/imported/redo.png-a609584d9c9c2183dc2b6bfd92d55c43.ctex"
|
||||
metadata={
|
||||
"vram_texture": false
|
||||
}
|
||||
|
||||
[deps]
|
||||
|
||||
source_file="res://addons/polydoodle/icons/redo.png"
|
||||
dest_files=["res://.godot/imported/redo.png-a609584d9c9c2183dc2b6bfd92d55c43.ctex"]
|
||||
|
||||
[params]
|
||||
|
||||
compress/mode=0
|
||||
compress/high_quality=false
|
||||
compress/lossy_quality=0.7
|
||||
compress/uastc_level=0
|
||||
compress/rdo_quality_loss=0.0
|
||||
compress/hdr_compression=1
|
||||
compress/normal_map=0
|
||||
compress/channel_pack=0
|
||||
mipmaps/generate=false
|
||||
mipmaps/limit=-1
|
||||
roughness/mode=0
|
||||
roughness/src_normal=""
|
||||
process/channel_remap/red=0
|
||||
process/channel_remap/green=1
|
||||
process/channel_remap/blue=2
|
||||
process/channel_remap/alpha=3
|
||||
process/fix_alpha_border=true
|
||||
process/premult_alpha=false
|
||||
process/normal_map_invert_y=false
|
||||
process/hdr_as_srgb=false
|
||||
process/hdr_clamp_exposure=false
|
||||
process/size_limit=0
|
||||
detect_3d/compress_to=1
|
||||
|
After Width: | Height: | Size: 674 B |
@@ -0,0 +1,40 @@
|
||||
[remap]
|
||||
|
||||
importer="texture"
|
||||
type="CompressedTexture2D"
|
||||
uid="uid://urk6eibr1ajq"
|
||||
path="res://.godot/imported/rotate.png-b4afa77887ed3abff8f8e7cc75f003f9.ctex"
|
||||
metadata={
|
||||
"vram_texture": false
|
||||
}
|
||||
|
||||
[deps]
|
||||
|
||||
source_file="res://addons/polydoodle/icons/rotate.png"
|
||||
dest_files=["res://.godot/imported/rotate.png-b4afa77887ed3abff8f8e7cc75f003f9.ctex"]
|
||||
|
||||
[params]
|
||||
|
||||
compress/mode=0
|
||||
compress/high_quality=false
|
||||
compress/lossy_quality=0.7
|
||||
compress/uastc_level=0
|
||||
compress/rdo_quality_loss=0.0
|
||||
compress/hdr_compression=1
|
||||
compress/normal_map=0
|
||||
compress/channel_pack=0
|
||||
mipmaps/generate=false
|
||||
mipmaps/limit=-1
|
||||
roughness/mode=0
|
||||
roughness/src_normal=""
|
||||
process/channel_remap/red=0
|
||||
process/channel_remap/green=1
|
||||
process/channel_remap/blue=2
|
||||
process/channel_remap/alpha=3
|
||||
process/fix_alpha_border=true
|
||||
process/premult_alpha=false
|
||||
process/normal_map_invert_y=false
|
||||
process/hdr_as_srgb=false
|
||||
process/hdr_clamp_exposure=false
|
||||
process/size_limit=0
|
||||
detect_3d/compress_to=1
|
||||
|
After Width: | Height: | Size: 746 B |
@@ -0,0 +1,40 @@
|
||||
[remap]
|
||||
|
||||
importer="texture"
|
||||
type="CompressedTexture2D"
|
||||
uid="uid://b264tjghs0umn"
|
||||
path="res://.godot/imported/save.png-8b1bc6e351947e37c9a5ee6a2ca0f0d8.ctex"
|
||||
metadata={
|
||||
"vram_texture": false
|
||||
}
|
||||
|
||||
[deps]
|
||||
|
||||
source_file="res://addons/polydoodle/icons/save.png"
|
||||
dest_files=["res://.godot/imported/save.png-8b1bc6e351947e37c9a5ee6a2ca0f0d8.ctex"]
|
||||
|
||||
[params]
|
||||
|
||||
compress/mode=0
|
||||
compress/high_quality=false
|
||||
compress/lossy_quality=0.7
|
||||
compress/uastc_level=0
|
||||
compress/rdo_quality_loss=0.0
|
||||
compress/hdr_compression=1
|
||||
compress/normal_map=0
|
||||
compress/channel_pack=0
|
||||
mipmaps/generate=false
|
||||
mipmaps/limit=-1
|
||||
roughness/mode=0
|
||||
roughness/src_normal=""
|
||||
process/channel_remap/red=0
|
||||
process/channel_remap/green=1
|
||||
process/channel_remap/blue=2
|
||||
process/channel_remap/alpha=3
|
||||
process/fix_alpha_border=true
|
||||
process/premult_alpha=false
|
||||
process/normal_map_invert_y=false
|
||||
process/hdr_as_srgb=false
|
||||
process/hdr_clamp_exposure=false
|
||||
process/size_limit=0
|
||||
detect_3d/compress_to=1
|
||||
|
After Width: | Height: | Size: 637 B |
@@ -0,0 +1,40 @@
|
||||
[remap]
|
||||
|
||||
importer="texture"
|
||||
type="CompressedTexture2D"
|
||||
uid="uid://c1ikctnhdbeqe"
|
||||
path="res://.godot/imported/snap.png-51e87d26b89ab3e8662aed0b92ceeaee.ctex"
|
||||
metadata={
|
||||
"vram_texture": false
|
||||
}
|
||||
|
||||
[deps]
|
||||
|
||||
source_file="res://addons/polydoodle/icons/snap.png"
|
||||
dest_files=["res://.godot/imported/snap.png-51e87d26b89ab3e8662aed0b92ceeaee.ctex"]
|
||||
|
||||
[params]
|
||||
|
||||
compress/mode=0
|
||||
compress/high_quality=false
|
||||
compress/lossy_quality=0.7
|
||||
compress/uastc_level=0
|
||||
compress/rdo_quality_loss=0.0
|
||||
compress/hdr_compression=1
|
||||
compress/normal_map=0
|
||||
compress/channel_pack=0
|
||||
mipmaps/generate=false
|
||||
mipmaps/limit=-1
|
||||
roughness/mode=0
|
||||
roughness/src_normal=""
|
||||
process/channel_remap/red=0
|
||||
process/channel_remap/green=1
|
||||
process/channel_remap/blue=2
|
||||
process/channel_remap/alpha=3
|
||||
process/fix_alpha_border=true
|
||||
process/premult_alpha=false
|
||||
process/normal_map_invert_y=false
|
||||
process/hdr_as_srgb=false
|
||||
process/hdr_clamp_exposure=false
|
||||
process/size_limit=0
|
||||
detect_3d/compress_to=1
|
||||
|
After Width: | Height: | Size: 500 B |
@@ -0,0 +1,40 @@
|
||||
[remap]
|
||||
|
||||
importer="texture"
|
||||
type="CompressedTexture2D"
|
||||
uid="uid://c1pg4gdnle0i2"
|
||||
path="res://.godot/imported/tool_brush.png-049598faf06109bfac6f02e9a893c43f.ctex"
|
||||
metadata={
|
||||
"vram_texture": false
|
||||
}
|
||||
|
||||
[deps]
|
||||
|
||||
source_file="res://addons/polydoodle/icons/tool_brush.png"
|
||||
dest_files=["res://.godot/imported/tool_brush.png-049598faf06109bfac6f02e9a893c43f.ctex"]
|
||||
|
||||
[params]
|
||||
|
||||
compress/mode=0
|
||||
compress/high_quality=false
|
||||
compress/lossy_quality=0.7
|
||||
compress/uastc_level=0
|
||||
compress/rdo_quality_loss=0.0
|
||||
compress/hdr_compression=1
|
||||
compress/normal_map=0
|
||||
compress/channel_pack=0
|
||||
mipmaps/generate=false
|
||||
mipmaps/limit=-1
|
||||
roughness/mode=0
|
||||
roughness/src_normal=""
|
||||
process/channel_remap/red=0
|
||||
process/channel_remap/green=1
|
||||
process/channel_remap/blue=2
|
||||
process/channel_remap/alpha=3
|
||||
process/fix_alpha_border=true
|
||||
process/premult_alpha=false
|
||||
process/normal_map_invert_y=false
|
||||
process/hdr_as_srgb=false
|
||||
process/hdr_clamp_exposure=false
|
||||
process/size_limit=0
|
||||
detect_3d/compress_to=1
|
||||
|
After Width: | Height: | Size: 696 B |
@@ -0,0 +1,40 @@
|
||||
[remap]
|
||||
|
||||
importer="texture"
|
||||
type="CompressedTexture2D"
|
||||
uid="uid://bt0sxlooilqub"
|
||||
path="res://.godot/imported/tool_circle.png-a9b1864dac3e6f28d15f2452c4932cdc.ctex"
|
||||
metadata={
|
||||
"vram_texture": false
|
||||
}
|
||||
|
||||
[deps]
|
||||
|
||||
source_file="res://addons/polydoodle/icons/tool_circle.png"
|
||||
dest_files=["res://.godot/imported/tool_circle.png-a9b1864dac3e6f28d15f2452c4932cdc.ctex"]
|
||||
|
||||
[params]
|
||||
|
||||
compress/mode=0
|
||||
compress/high_quality=false
|
||||
compress/lossy_quality=0.7
|
||||
compress/uastc_level=0
|
||||
compress/rdo_quality_loss=0.0
|
||||
compress/hdr_compression=1
|
||||
compress/normal_map=0
|
||||
compress/channel_pack=0
|
||||
mipmaps/generate=false
|
||||
mipmaps/limit=-1
|
||||
roughness/mode=0
|
||||
roughness/src_normal=""
|
||||
process/channel_remap/red=0
|
||||
process/channel_remap/green=1
|
||||
process/channel_remap/blue=2
|
||||
process/channel_remap/alpha=3
|
||||
process/fix_alpha_border=true
|
||||
process/premult_alpha=false
|
||||
process/normal_map_invert_y=false
|
||||
process/hdr_as_srgb=false
|
||||
process/hdr_clamp_exposure=false
|
||||
process/size_limit=0
|
||||
detect_3d/compress_to=1
|
||||