Skip to content

Commit

Permalink
RUV v1.6
Browse files Browse the repository at this point in the history
  • Loading branch information
nguyentutiensinh committed Oct 18, 2023
1 parent 6f9edae commit 2226e75
Show file tree
Hide file tree
Showing 43 changed files with 161 additions and 24 deletions.
Binary file added .DS_Store
Binary file not shown.
12 changes: 6 additions & 6 deletions __init__.py → RUV/__init__.py
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
bl_info = {
"name": "RizomUV Bridge MacOS",
"name": "RUV Blender MacOS",
"author": "nguyendinhat",
"version": (1, 2),
"blender": (3, 6, 3),
"version": (1, 6),
"blender": (3, 6, 4),
"location": "View3D > Sidebar",
"description": "Addon Connect Blender with RizomUV",
"doc_url": "https://github.com/nguyendinhat/RizomUV_Bridge_for_Blender",
"description": "Addon Connect Blender with RizomUV MaOS",
"warning": "",
"doc_url": "https://github.com/nguyendinhat/RizomUV_Bridge_for_Blender_MacOS",
"category": "UV",
}

import bpy

from .context import addon, context
from .operators import export_uv, import_uv, auto_uv, fixuvmap, load_recent, close_rizom, reset
from .interface import View3D
Expand Down
Binary file added RUV/context/.DS_Store
Binary file not shown.
3 changes: 1 addition & 2 deletions context/addon.py → RUV/context/addon.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@

import tempfile, os, bpy
from bpy.props import (StringProperty, BoolProperty,IntProperty,FloatProperty, FloatVectorProperty, EnumProperty,PointerProperty,)
from bpy.props import (StringProperty, BoolProperty,EnumProperty)
from bpy.types import AddonPreferences

from ..operators import utility
Expand Down
3 changes: 1 addition & 2 deletions context/context.py → RUV/context/context.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
import bpy
from bpy.props import (StringProperty, BoolProperty,IntProperty,FloatProperty, FloatVectorProperty, EnumProperty,PointerProperty,)
from bpy.props import (BoolProperty,EnumProperty)
from bpy.types import PropertyGroup
from ..context import items

class RUV_Context(PropertyGroup):
"""Property group to set the UI tabs."""
prefs = bpy.context.preferences.addons["RUV"].preferences
panel_enums: EnumProperty(
items=(items.get_panels),
Expand Down
1 change: 0 additions & 1 deletion context/items.py → RUV/context/items.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@

import bpy

def get_panels(self, context): # pylint: disable=unused-argument
Expand Down
Binary file added RUV/interface/.DS_Store
Binary file not shown.
7 changes: 1 addition & 6 deletions interface/View3D.py → RUV/interface/View3D.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,17 +11,12 @@ class RUV_Panel(Panel):
bl_label = "RizomUV Bridge"
spaceTypes = ['VIEW_3D', 'IMAGE_EDITOR', 'NODE_EDITOR']



def draw(self, context):
props = context.window_manager.RUV_Context
prefs = bpy.context.preferences.addons["RUV"].preferences

# addons = context.preferences.addons

layout = self.layout


box = layout.box()
row = box.row(align=True)
row.scale_y = 1.25
Expand Down Expand Up @@ -64,7 +59,7 @@ def draw(self, context):
row = box.row(align=True)
row.scale_y = 1.25
row.prop(props, "uv_maps")
row.operator("ruv.fix_uvmaps", text="Fix UVSets", icon="FAKE_USER_ON")
row.operator(fixuvmap.OP_FixUVMaps.bl_idname, text="Fix UVSets", icon="FAKE_USER_ON")

col = split.column(align=True)
col.scale_y = 1.25
Expand Down
Binary file added RUV/operators/.DS_Store
Binary file not shown.
File renamed without changes.
File renamed without changes.
2 changes: 0 additions & 2 deletions operators/export_uv.py → RUV/operators/export_uv.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
from ..operators import utility
from ..scripts import setup


class OP_EXP(Operator):
bl_idname = "ruv.exp"
bl_label = "Export"
Expand All @@ -13,7 +12,6 @@ class OP_EXP(Operator):
communicate: bpy.props.BoolProperty(name="Communicate", default=False)
global RUV_PROCESS


@classmethod
def poll(cls, context):
return context.active_object is not None
Expand Down
File renamed without changes.
5 changes: 2 additions & 3 deletions operators/import_uv.py → RUV/operators/import_uv.py
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,6 @@ def execute(self, context):
bpy.ops.object.mode_set(mode='OBJECT', toggle=False)
bpy.ops.object.editmode_toggle()
bpy.context.window.workspace = bpy.data.workspaces['UV Editing']
bpy.ops.mesh.select_all(action='SELECT')


bpy.context.scene.tool_settings.use_uv_select_sync = True
# bpy.ops.mesh.select_all(action='SELECT')
return {'FINISHED'}
File renamed without changes.
1 change: 0 additions & 1 deletion operators/reset.py → RUV/operators/reset.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
from bpy.types import Operator

class OP_ResetAddon(Operator):
"""Reset bridge addon settings to default values."""

bl_description = "Reset Addon RUV settings"
bl_idname = "ruv.bridge_config_reset"
Expand Down
File renamed without changes.
Binary file added RUV/scripts/.DS_Store
Binary file not shown.
File renamed without changes.
149 changes: 149 additions & 0 deletions RUV/scripts/final_script.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,149 @@

ZomSet({Path = "Prefs.FileSuffix", Value = ""})
ZomSet({Path = "Prefs.File.FBX.UseUVSetNames", Value = true})

ZomSet({Path="Vars.Viewport.ColorMapIDDisplayMode", Value=1})

ZomSet({Path="Prefs.UI.Display.MultiUVSet", Value=false})
ZomSet({Path="Prefs.UI.Display.AlignStraightenFlip", Value=true})
ZomSet({Path="Prefs.UI.Display.AutoSelect", Value=true})
ZomSet({Path="Prefs.UI.Display.Help", Value=false})
ZomSet({Path="Prefs.UI.Display.Seams", Value=false})
ZomSet({Path="Prefs.UI.Display.ScriptLog", Value=false})
ZomSet({Path="Prefs.UI.Display.PackLayout", Value=true})
ZomSet({Path="Prefs.UI.Display.UnfoldOptimize", Value=true})
ZomSet({Path="Prefs.UI.Display.Transform", Value=false})
ZomSet({Path="Prefs.UI.Display.Proportional", Value=false})
ZomSet({Path="Prefs.UI.Display.Grid", Value=false})
ZomSet({Path="Prefs.UI.Display.TileSizeOffset", Value=false})
ZomSet({Path="Prefs.UI.Display.MultiTile", Value=false})


ZomSet({Path="Prefs.Default.Packing.MinScaling", Value=0})
ZomSet({Path="Prefs.Default.Packing.MaxScaling", Value=1e+06})
ZomSet({Path="Prefs.PackOptions.MixScales", Value=true})

ZomSet({Path="Prefs.CustomMousePreset", Value={ORBIT={MB="MMB", MODS="", KEYCODE=0}, ZOOM={MB="MMB", MODS="Alt-Ctrl", KEYCODE=0}, PAN={MB="MMB", MODS="Shift", KEYCODE=0}, DENSITY_PAINT={MB="LMB", MODS="", KEYCODE=0}, OPTIMIZE_PAINT={MB="LMB", MODS="", KEYCODE=0}, PIN_PAINT={MB="LMB", MODS="", KEYCODE=0}, PROTECT_PAINT={MB="LMB", MODS="", KEYCODE=0}, UNFOLD_PAINT={MB="LMB", MODS="", KEYCODE=0}, SPREAD={MB="LMB", MODS="", KEYCODE=0}, PINCH={MB="LMB", MODS="", KEYCODE=0}, DRAG={MB="LMB", MODS="", KEYCODE=0}, SELECT={MB="LMB", MODS="", KEYCODE=0}, ADD_SELECT={MB="LMB", MODS="Ctrl", KEYCODE=0}, DESELECT={MB="LMB", MODS="Alt", KEYCODE=0}, ADD_SELECT_SHORT_PATH={MB="LMB", MODS="Shift", KEYCODE=0}, SELECT_LOOP_PATH={MB="DLMB", MODS="", KEYCODE=0}, ADD_SELECT_LOOP_PATH={MB="DLMB", MODS="Ctrl", KEYCODE=0}, DESELECT_PATH={MB="DLMB", MODS="Alt", KEYCODE=0}, SELECT_TRANSLATE={MB="MMB", MODS="", KEYCODE=32}, SELECT_ROTATE={MB="RMB", MODS="", KEYCODE=32}, SELECT_SCALE={MB="LMB", MODS="", KEYCODE=32}, ADD_SELECT_TRANSLATE={MB="MMB", MODS="Ctrl", KEYCODE=32}, ADD_SELECT_ROTATE={MB="RMB", MODS="Ctrl", KEYCODE=32}, ADD_SELECT_SCALE={MB="LMB", MODS="Ctrl", KEYCODE=32}, TRANSLATE_ISLAND={MB="MMB", MODS="", KEYCODE=68}, ROTATE_ISLAND={MB="RMB", MODS="", KEYCODE=68}, SCALE_ISLAND={MB="LMB", MODS="", KEYCODE=68}, PREVIEW_SHORT_PATH={MB="", MODS="Shift", KEYCODE=0}}})ZomSet({Path="Prefs.MousePresetMode", Value=11})
ZomLoad({File={Path="/var/folders/jf/pqnw30vs0wv45kz43ft65bn80000gn/T/export_temp.fbx", ImportGroups=true, XYZUVW=true, UVWProps=true}, __UpdateGUIFilePath=true, __Focus=true})
target_map = "UVMap"
map_list = {'UVMap'}
branch = false
cylinders = true
handles = true
holes =false
init_orient = 1
leaf = false
map_res = 2048
mosaic_value = 0.75
mutations = 1
orient_step = 90
overlap = true
pack_qual = 512
margin = 0.00390625
spacing = 0.0078125
sharp_value = 30
stretch = 0.0
tex_density = 1023.9999771118164
tex_unit = "tx/cm"
tflip = true
trunk = false

-- settings.lua

if type(map_list) == "table" then
for _, x in pairs(map_list) do
ZomUvset({Mode = "SetCurrent", Name = x})

ZomIslandGroups({
Mode = "SetGroupsProperties",
WorkingSet = "Visible",
MergingPolicyString = "A_ADD|AIB_ADD_A_VALUE_B|B_CLONE",
GroupPath = "RootGroup",
Properties = {
Pack = {
Scaling = {TexelDensity = tex_density},
MapResolution = map_res,
MarginSize = margin,
PaddingSize = spacing,
Rotate = {Step = orient_step, Mode = init_orient},
MaxMutations = mutations,
Resolution = pack_qual
}
}
})
-- prevent tflips/overlaps
ZomSet({Path = "Prefs.TriangleFlipsOn", Value = tflip})
ZomSet({Path = "Prefs.OverlapsOn", Value = overlap})
end
end


stretch = ZomGet("Vars.AutoSelect.BijectiverMinQ")
holes = ZomGet("Vars.AutoSelect.LinkHoles")
handles = ZomGet("Vars.AutoSelect.CutHandles")
mosaic_value = ZomGet("Vars.AutoSelect.Mosaic.Developability")
sharp_value = ZomGet("Vars.AutoSelect.SharpEdges.Angle")

leaf = ZomGet("Vars.AutoSelect.Hierarchical.Leafs")
branch = ZomGet("Vars.AutoSelect.Hierarchical.Branches")
trunk = ZomGet("Vars.AutoSelect.Hierarchical.Trunk")

stretch_bool = ZomGet("Vars.AutoSelect.Bijectiver")
-- stretch control (autoseams)
if stretch > 0 then
ZomSet({Path = "Vars.AutoSelect.Bijectiver", Value = true})
else
ZomSet({Path = "Vars.AutoSelect.Bijectiver", Value = false})
end

ZomSet({Path = "Vars.AutoSelect.BijectiverMinQ", Value = stretch})

-- sharp edge angle (autoseams)
ZomSet({Path = "Vars.AutoSelect.SharpEdges.Angle", Value = sharp_value})

-- mosaic value (autoseams)
ZomSet({Path = "Vars.AutoSelect.Mosaic.Developability", Value = mosaic_value})

-- cut handles/cut holes (autoseams)
ZomSet({Path = "Vars.AutoSelect.CutHandles", Value = handles})
ZomSet({Path = "Vars.AutoSelect.LinkHoles", Value = holes})
ZomSet({Path = "Vars.AutoSelect.OpenCylinders", Value = cylinders})

-- leaf/branch/trunk (autoseams)
ZomSet({Path = "Vars.AutoSelect.Hierarchical.Leafs", Value = leaf})
ZomSet({Path = "Vars.AutoSelect.Hierarchical.Branches", Value = branch})
ZomSet({Path = "Vars.AutoSelect.Hierarchical.Trunk", Value = trunk})

-- image_path
if image_path then
ZomLoadUserTexture(image_path)
ZomSet({Path = "Vars.Viewport.Viewport3D.Textured", Value = true})
ZomSet({Path = "Vars.Viewport.TextureID", Value = 2})
ZomSet({Path = "Vars.Viewport.BackGroundTextureOn", Value = true})
ZomSet({Path = "Vars.Viewport.ViewportUV.Textured", Value = true})
ZomSet({Path = "Vars.Viewport.TextureID", Value = 2})
ZomSet({Path = "Vars.Viewport.ColorMapIDDisplayMode", Value = 0})
end



if leaf then
leaf = 1
else
leaf = 0
end

if branch then
branch = 2
else
branch = 0
end

if trunk then
trunk = 3
else
trunk = 0
end

ZomUvset({Mode="SetCurrent", Name="UVMap"})
ZomSave({File={Path="/var/folders/jf/pqnw30vs0wv45kz43ft65bn80000gn/T/export_temp.fbx", UVWProps=true, FBX={UseUVSetNames=true}}, __UpdateUIObjFileName=true})
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ ZomMove({WorkingSet="Visible", PrimType="Edge", Geometrical="TransformIslandsByE
ZomWeld({PrimType="Edge", WorkingSet="Visible", Mode="All"})
ZomResetTo3d({WorkingSet="Visible", Rescale=true})

ZomSelect({PrimType="Edge", WorkingSet="Visible", Select=true, ResetBefore=true, ProtectMapName="Protect", FilterIslandVisible=true, Auto={Skeleton={Open=true}, PipesCutter=holes, HandleCutter=handles, QuadLoopCutter=cylinders, StretchLimiter=stretch_bool, Quality=stretch, StoreCoordsUVW=true, FlatteningMode=0, FlatteningUnfoldParams={StopIfZeroMix=true, BorderIntersections=true, TriangleFlips=true}}})
ZomSelect({PrimType="Edge", WorkingSet="Visible", Select=true, ResetBefore=true, ProtectMapName="Protect", FilterIslandVisible=true, Auto={Skeleton={Open=true}, PipesCutter=holes, HandleCutter=handles, QuadLoopCutter=cylinders, StretchLimiter=stretch_bool, Quality=stretch, StoreCoordsUVW=true, FlatteningMode=0, FlatteningUnfoldParams={StopIfZeroMix=true, BorderIntersections=true, TriangleFlips=true}}})
ZomCut({PrimType="Edge", WorkingSet="Visible"})
ZomLoad({Data={CoordsUVWInternalPath="#Mesh.Tmp.AutoSelect.UVW "}})
ZomIslandGroups({Mode="DistributeInTilesByBBox", WorkingSet="Visible", MergingPolicyString="A_ADD|AIB_ADD_A_VALUE_B|B_CLONE"})
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Binary file modified __pycache__/__init__.cpython-310.pyc
Binary file not shown.
Binary file removed __pycache__/utility.cpython-310.pyc
Binary file not shown.
Binary file removed context/__pycache__/addon.cpython-310.pyc
Binary file not shown.
Binary file removed context/__pycache__/context.cpython-310.pyc
Binary file not shown.
Binary file removed context/__pycache__/items.cpython-310.pyc
Binary file not shown.
Binary file removed interface/__pycache__/View3D.cpython-310.pyc
Binary file not shown.
Binary file removed operators/__pycache__/auto_uv.cpython-310.pyc
Binary file not shown.
Binary file removed operators/__pycache__/close_rizom.cpython-310.pyc
Binary file not shown.
Binary file removed operators/__pycache__/export_uv.cpython-310.pyc
Binary file not shown.
Binary file removed operators/__pycache__/fixuvmap.cpython-310.pyc
Binary file not shown.
Binary file removed operators/__pycache__/import_uv.cpython-310.pyc
Binary file not shown.
Binary file removed operators/__pycache__/load_recent.cpython-310.pyc
Binary file not shown.
Binary file removed operators/__pycache__/reset.cpython-310.pyc
Binary file not shown.
Binary file removed operators/__pycache__/utility.cpython-310.pyc
Binary file not shown.
Binary file removed scripts/__pycache__/setup.cpython-310.pyc
Binary file not shown.
Empty file removed scripts/final_script.lua
Empty file.

0 comments on commit 2226e75

Please sign in to comment.