3 Commits

Author SHA1 Message Date
akaneyu 354cc6e952 Support Blender 5.0 2025-12-23 22:03:43 +09:00
akaneyu 628ccb5ce0 Update readme 2025-04-09 20:30:25 +09:00
akaneyu 280a9f5c94 Update readme 2025-04-08 00:05:06 +09:00
6 changed files with 55 additions and 33 deletions
+26 -1
View File
@@ -1,3 +1,28 @@
# Symmetrize Texture # Symmetrize Texture
Symmetrize Texture is an add-on that lets you symmetrize your texture image along a specified axis. ![Symmetrize Texture](doc/images/featured.png)
Symmetrize Texture is a Blender add-on that lets you symmetrize your texture image along a specified axis.
If you want to symmetrize your texture image by using the add-on, make sure the base UV map is already symmetrical. The [Symmetrize UV Util](https://superhivemarket.com/products/symmetrize-uv-util) add-on could help you create a symmetrical UV map.
3D Brush
You can use a special brush in the 3D view. When you trace some parts with the brush, the only traced parts are symmetrized. The size of brush can be changed by pressing the "F" key.
This feature runs in the 3D view in Object Mode. (It does not work in Texture Paint mode)
![3D brush](doc/images/symtex_3d_brush.gif)
## 2D Brush
This is a 2D version of the mirror brush as described above.
This feature runs in the UV/Image Editor.
![2D brush](doc/images/symtex_2d_brush.gif)
## Mirrored Copy
It makes mirror-image copy of one side, leaving the original in place. This is useful for drawing model that is symmetrical about x or y axis. Draw one side of the model, then use the feature for the other side.
This feature runs in the UV/Image Editor.
+2 -2
View File
@@ -18,8 +18,8 @@
bl_info = { bl_info = {
"name": "Symmetrize Texture", "name": "Symmetrize Texture",
"author": "akaneyu", "author": "akaneyu",
"version": (1, 3, 0), "version": (1, 4, 0),
"blender": (3, 3, 0), "blender": (4, 2, 0),
"location": "View3D", "location": "View3D",
"warning": "", "warning": "",
"description": "", "description": "",
+27 -30
View File
@@ -1,5 +1,5 @@
''' '''
Copyright (C) 2020 - 2024 Akaneyu Copyright (C) 2020 - 2025 Akaneyu
This program is free software: you can redistribute it and/or modify This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by it under the terms of the GNU General Public License as published by
@@ -16,15 +16,12 @@
''' '''
import gpu import gpu
from gpu.shader import create_from_info
from gpu_extras.batch import batch_for_shader from gpu_extras.batch import batch_for_shader
from mathutils import Matrix from mathutils import Matrix
import numpy as np import numpy as np
default_vertex_shader = ''' default_vertex_shader = '''
uniform mat4 ModelViewProjectionMatrix;
in vec2 pos;
void main() void main()
{ {
gl_Position = ModelViewProjectionMatrix * vec4(pos, 0, 1.0); gl_Position = ModelViewProjectionMatrix * vec4(pos, 0, 1.0);
@@ -32,10 +29,6 @@ void main()
''' '''
default_fragment_shader = ''' default_fragment_shader = '''
uniform vec4 color;
out vec4 fragColor;
void main() void main()
{ {
fragColor = color; fragColor = color;
@@ -43,13 +36,6 @@ void main()
''' '''
dotted_line_vertex_shader = ''' dotted_line_vertex_shader = '''
uniform mat4 ModelViewProjectionMatrix;
in vec2 pos;
in float arcLength;
out float arcLengthInter;
void main() void main()
{ {
arcLengthInter = arcLength; arcLengthInter = arcLength;
@@ -59,15 +45,6 @@ void main()
''' '''
dotted_line_fragment_shader = ''' dotted_line_fragment_shader = '''
uniform float scale;
uniform float offset;
uniform vec4 color1;
uniform vec4 color2;
in float arcLengthInter;
out vec4 fragColor;
void main() void main()
{ {
if (step(sin((arcLengthInter + offset) * scale), 0.5) == 1) { if (step(sin((arcLengthInter + offset) * scale), 0.5) == 1) {
@@ -80,12 +57,32 @@ void main()
class UIRenderer: class UIRenderer:
def __init__(self): def __init__(self):
self.default_shader = gpu.types.GPUShader(default_vertex_shader, default_shader_info = gpu.types.GPUShaderCreateInfo()
default_fragment_shader) default_shader_info.push_constant('MAT4', 'ModelViewProjectionMatrix')
self.default_shader_u_color = self.default_shader.uniform_from_name("color") default_shader_info.push_constant('VEC4', 'color')
default_shader_info.vertex_in(0, 'VEC2', 'pos')
default_shader_info.fragment_out(0, 'VEC4', 'fragColor')
default_shader_info.vertex_source(default_vertex_shader)
default_shader_info.fragment_source(default_fragment_shader)
self.default_shader = create_from_info(default_shader_info)
self.default_shader_u_color = self.default_shader.uniform_from_name('color')
self.dotted_line_shader = gpu.types.GPUShader(dotted_line_vertex_shader, dotted_line_shader_inter = gpu.types.GPUStageInterfaceInfo("dotted_line")
dotted_line_fragment_shader) dotted_line_shader_inter.smooth('FLOAT', "arcLengthInter")
dotted_line_shader_info = gpu.types.GPUShaderCreateInfo()
dotted_line_shader_info.push_constant('MAT4', 'ModelViewProjectionMatrix')
dotted_line_shader_info.push_constant('FLOAT', 'scale')
dotted_line_shader_info.push_constant('FLOAT', 'offset')
dotted_line_shader_info.push_constant('VEC4', 'color1')
dotted_line_shader_info.push_constant('VEC4', 'color2')
dotted_line_shader_info.vertex_in(0, 'VEC2', 'pos')
dotted_line_shader_info.vertex_in(1, 'FLOAT', 'arcLength')
dotted_line_shader_info.vertex_out(dotted_line_shader_inter)
dotted_line_shader_info.fragment_out(0, 'VEC4', 'fragColor')
dotted_line_shader_info.vertex_source(dotted_line_vertex_shader)
dotted_line_shader_info.fragment_source(dotted_line_fragment_shader)
self.dotted_line_shader = create_from_info(dotted_line_shader_info)
self.dotted_line_shader_u_color1 = self.dotted_line_shader.uniform_from_name("color1") self.dotted_line_shader_u_color1 = self.dotted_line_shader.uniform_from_name("color1")
self.dotted_line_shader_u_color2 = self.dotted_line_shader.uniform_from_name("color2") self.dotted_line_shader_u_color2 = self.dotted_line_shader.uniform_from_name("color2")
Binary file not shown.

After

Width:  |  Height:  |  Size: 207 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.2 MiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.7 MiB