Skip to content

Commit

Permalink
Implement sub tool switching (#12)
Browse files Browse the repository at this point in the history
* first pass subtool drop down

* Fix send new sub tool

* add subtool folder name and add sdiv slider

* sub tool handling
  • Loading branch information
JonasOuellet authored Apr 18, 2023
1 parent ab299ef commit c621c1d
Show file tree
Hide file tree
Showing 31 changed files with 1,948 additions and 1,794 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
dist/ZlmData/*
dist/test
!dist/ZlmData/zlmOps.txt
!dist/ZlmData/zLayerUpdate.txt
!dist/ZlmData/app/*
Expand Down
9 changes: 3 additions & 6 deletions .vscode/launch.json
Original file line number Diff line number Diff line change
Expand Up @@ -35,14 +35,11 @@
"request": "launch",
"module": "zlm_ui",
"args": [
"370",
"${workspaceFolder}\\layers.TXT"
"406",
"${workspaceFolder}\\dist\\ZlmData\\layers.TXT"
],
"envFile": "${workspaceFolder}/.env",
"env": {
"ZLM_SETTINGS_PATH": "C:\\dev\\animtools\\GbxAnimLauncher\\Tools\\ZLayerManager",
"ZLM_PRESET_PATH": "c:\\dev\\Cypress2\\ContentSource\\cypress2source\\Character\\__Shared\\Head\\ZBrush\\presets"
}
"qt": "auto"
},
{
"name": "Python: Current File (Integrated Terminal)",
Expand Down
24 changes: 10 additions & 14 deletions dist/ZlmData/zLayerUpdate.TXT
Original file line number Diff line number Diff line change
Expand Up @@ -9,17 +9,13 @@

<zscriptinsert, "zlmOps.txt">

// check if there is a subtool loaded
[If, [IExists, "Tool:Layers:Layers Scrollbar"],
[VarSet, filePath, ""]
[VarSet, exec, ""]
[RoutineCall, zlmGetLayerPath, filePath]
[RoutineCall, zlmSaveLayerInfo, filePath]
[RoutineCall, zlmGetExecutable, exec]
[VarSet, quote, [StrFromAsc, 34]]

[VarSet, cmd, [StrMerge, "start ", #quote, #quote, " ", #quote, #exec, #quote, " -o -f ", #quote, #filePath, #quote]]
// [Note, cmd]
[ShellExecute, cmd]
,
]
[VarSet, filePath, ""]
[VarSet, exec, ""]
[RoutineCall, zlmGetLayerPath, filePath]
[RoutineCall, zlmSaveLayerInfo, filePath]
[RoutineCall, zlmGetExecutable, exec]
[VarSet, quote, [StrFromAsc, 34]]

[VarSet, cmd, [StrMerge, "start ", #quote, #quote, " ", #quote, #exec, #quote, " -o -f ", #quote, #filePath, #quote]]
// [Note, cmd]
[ShellExecute, cmd]
108 changes: 68 additions & 40 deletions dist/ZlmData/zlmOps.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,25 +3,26 @@

//initialise output value to 0
[VarSet, output, 0]
[If, [IExists, "Tool:Layers:Layers Scrollbar"],
//if there's a scrollbar there is more than one layer
[If, [IsEnabled, "Tool:Layers:Layers Scrollbar"],

//if there's a scrollbar there is more than one layer
[If, [IsEnabled, "Tool:Layers:Layers Scrollbar"],

//store current scroll bar position
[VarSet, tmpLyScrPos, [IGetSecondary, "Tool:Layers:Layers Scrollbar"]]
//store current scroll bar position
[VarSet, tmpLyScrPos, [IGetSecondary, "Tool:Layers:Layers Scrollbar"]]

//set scroll bar to a maximum to ensure it is at the top
[ISet, "Tool:Layers:Layers Scrollbar", 0, 256]
[VarSet, output, [IGetSecondary, "Tool:Layers:Layers Scrollbar"] + 1]
//set scroll bar to a maximum to ensure it is at the top
[ISet, "Tool:Layers:Layers Scrollbar", 0, 256]
[VarSet, output, [IGetSecondary, "Tool:Layers:Layers Scrollbar"] + 1]

// restore scroll bar position
[ISet, "Tool:Layers:Layers Scrollbar", 0, tmpLyScrPos]
,

[If,[IsEnabled, "Tool:Layers:Layer Intensity"],
[VarSet,output,1]
]
]
// restore scroll bar position
[ISet, "Tool:Layers:Layers Scrollbar", 0, tmpLyScrPos]
,

[If,[IsEnabled, "Tool:Layers:Layer Intensity"],
[VarSet,output,1]
]
]
]
]
,output]

Expand All @@ -44,13 +45,14 @@
[VarSet, layersCount, 0]
[RoutineCall, zlmGetLayerCount, layersCount]

// set max subdivs
[VarSet, subdiv, [IGet, "Tool:Geometry:SDiv"]]
[VarSet, tmpLyScrPos, [IGetSecondary, "Tool:Layers:Layers Scrollbar"]]

[VarSet, isRecording, 0]
[VarSet, recordingYpos, 0]
[If, layersCount > 0,
// set max subdivs
[VarSet, subdiv, [IGet, "Tool:Geometry:SDiv"]]
[VarSet, tmpLyScrPos, [IGetSecondary, "Tool:Layers:Layers Scrollbar"]]

[VarSet, isRecording, 0]
[VarSet, recordingYpos, 0]


[VarSet, layerIdOne, 0]
[RoutineCall, zlmGetIdFirstLayerID, layerIdOne]
Expand Down Expand Up @@ -119,20 +121,41 @@

, counter]

// Write the name of the sub tools
[VarSet, subtoolName, [IGetTitle, "Tool:ItemInfo"]]
[VarSet, idx, [SubToolGetActiveIndex]]
[VarSet, subtoolLine, [StrMerge, #quote, #subtoolName, #quote, " ", #idx]]

[VarAdd, currentSize, [StrLength, subtoolLine]]

[VarSet, currentSubToolIndex, [SubToolGetActiveIndex]]
[VarSet, subtoolLine, [StrMerge, "SubTools: ", #currentSubToolIndex]]
[If, [IExists, "Tool:Geometry:SDiv"],

[VarSet, subtoolLine, [StrMerge, #subtoolLine, " ", [IGet, "Tool:Geometry:SDiv"], " ", [IGetMax, "Tool:Geometry:SDiv"]]]
]
[VarSet, subtoolLine, [StrMerge, #subtoolLine, [StrFromAsc, 10]]]
[VarAdd, currentSize, [StrLength, #subtoolLine]]
// Check if memory is big enough
// Resize it enough so we dont have to resize everytime
[If, currentSize > [MemGetSize, layerNameMem],
[MemResize, layerNameMem, currentSize]
,]
[VarAdd, byteOffset, [MemWriteString, layerNameMem, subtoolLine, byteOffset, 0]]

[VarSet, subToolCount, [SubToolGetCount]]
[Loop, subToolCount,
[SubToolSelect, #index]
[VarSet, subToolFolder, [SubToolGetFolderName, #index]]
[If, [StrLength, subToolFolder],
[VarSet, subToolName, [StrMerge, #quote, subToolFolder, "/", [IGetTitle, "Tool:ItemInfo"], #quote]]
,
[VarSet, subToolName, [StrMerge, #quote, [IGetTitle, "Tool:ItemInfo"], #quote]]
]
[If, #index + 1 < subToolCount,
[VarSet, subToolName, [StrMerge, #subToolName, [StrFromAsc, 10]]]
]
[VarAdd, currentSize, [StrLength, subToolName]]
// Check if memory is big enough
// Resize it enough so we dont have to resize everytime
[If, currentSize > [MemGetSize, layerNameMem],
[MemResize, layerNameMem, currentSize]
,]
[VarAdd, byteOffset, [MemWriteString, layerNameMem, subToolName, byteOffset, 0]]
, index]

// Resize memory to the actual total size so we don't write any empty bits.
[MemResize, layerNameMem, currentSize]
Expand All @@ -141,20 +164,25 @@

[MemDelete, layerNameMem]

[SubToolSelect, #currentSubToolIndex]

// If was recording
[If, #isRecording,
[ISet, "Tool:Layers:Layers Scrollbar", 0, recordingYpos]
[VarSet, wid, [IWidth, #layerIdOne]]
[IClick, #layerIdOne, wid-20, 5]
]
[If, layersCount > 0,
[If, #isRecording,
[ISet, "Tool:Layers:Layers Scrollbar", 0, recordingYpos]
[VarSet, wid, [IWidth, #layerIdOne]]
[IClick, #layerIdOne, wid-20, 5]
]

// restore scroll bar position
[If, [IsEnabled, "Tool:Layers:Layers Scrollbar"],
[ISet, "Tool:Layers:Layers Scrollbar", 0, tmpLyScrPos]
]
// restore scroll bar position
[If, [IsEnabled, "Tool:Layers:Layers Scrollbar"],
[ISet, "Tool:Layers:Layers Scrollbar", 0, tmpLyScrPos]
]

// restore subdiv.
[ISet, "Tool:Geometry:SDiv", #subdiv, 0]

// restore subdiv.
[ISet, "Tool:Geometry:SDiv", #subdiv, 0]
]

] // IFreeze

Expand Down
4 changes: 2 additions & 2 deletions doc_src/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,9 @@
author = 'Jonathan Ouellet'

# The short X.Y version
version = '1.9'
version = '1.10'
# The full version, including alpha/beta/rc tags
release = '1.9.0'
release = '1.10.0'


# -- General configuration ---------------------------------------------------
Expand Down
2 changes: 1 addition & 1 deletion doc_src/installation.rst
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ Click on `open` to open the standalone UI.
- If this is the first time you use the tool and it freeze ZBrush when opening it, the os is preventing you from using the tool, you have to open it manually and say that you trust the tool.

- Close Zbrush
- Navigate to ZlmData\zlm_ui.exe and open it.
- Navigate to `ZlmData/zlm_ui.exe` and open it.
- Awnser trust and open anyway.

- You must have a subtool selected to open the UI
Expand Down
2 changes: 1 addition & 1 deletion docs/.buildinfo
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Sphinx build info version 1
# This file hashes the configuration used when building these files. When it is not found, a full rebuild will be done.
config: fe3b8e9f1fb877ddfa4b188f4eab9c95
config: 19061fb87860115581c0641d7edec690
tags: 645f666f9bcd5a90fca523b33c5a78b7
2 changes: 1 addition & 1 deletion docs/_static/documentation_options.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
var DOCUMENTATION_OPTIONS = {
URL_ROOT: document.getElementById("documentation_options").getAttribute('data-url_root'),
VERSION: '1.9.0',
VERSION: '1.10.0',
LANGUAGE: 'None',
COLLAPSE_INDEX: false,
FILE_SUFFIX: '.html',
Expand Down
4 changes: 2 additions & 2 deletions docs/application/maya.html
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@

<meta name="viewport" content="width=device-width, initial-scale=1.0">

<title>Maya &mdash; ZLayerManager 1.9.0 documentation</title>
<title>Maya &mdash; ZLayerManager 1.10.0 documentation</title>



Expand Down Expand Up @@ -61,7 +61,7 @@


<div class="version">
1.9
1.10
</div>


Expand Down
4 changes: 2 additions & 2 deletions docs/genindex.html
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@

<meta name="viewport" content="width=device-width, initial-scale=1.0">

<title>Index &mdash; ZLayerManager 1.9.0 documentation</title>
<title>Index &mdash; ZLayerManager 1.10.0 documentation</title>



Expand Down Expand Up @@ -59,7 +59,7 @@


<div class="version">
1.9
1.10
</div>


Expand Down
4 changes: 2 additions & 2 deletions docs/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@

<meta name="viewport" content="width=device-width, initial-scale=1.0">

<title>ZLayerManager &mdash; ZLayerManager 1.9.0 documentation</title>
<title>ZLayerManager &mdash; ZLayerManager 1.10.0 documentation</title>



Expand Down Expand Up @@ -60,7 +60,7 @@


<div class="version">
1.9
1.10
</div>


Expand Down
6 changes: 3 additions & 3 deletions docs/installation.html
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@

<meta name="viewport" content="width=device-width, initial-scale=1.0">

<title>Installation &mdash; ZLayerManager 1.9.0 documentation</title>
<title>Installation &mdash; ZLayerManager 1.10.0 documentation</title>



Expand Down Expand Up @@ -61,7 +61,7 @@


<div class="version">
1.9
1.10
</div>


Expand Down Expand Up @@ -224,7 +224,7 @@ <h2>Install<a class="headerlink" href="#install" title="Permalink to this headli
<li><p>If this is the first time you use the tool and it freeze ZBrush when opening it, the os is preventing you from using the tool, you have to open it manually and say that you trust the tool.</p>
<ul>
<li><p>Close Zbrush</p></li>
<li><p>Navigate to ZlmDatazlm_ui.exe and open it.</p></li>
<li><p>Navigate to <cite>ZlmData/zlm_ui.exe</cite> and open it.</p></li>
<li><p>Awnser trust and open anyway.</p></li>
</ul>
</li>
Expand Down
2 changes: 1 addition & 1 deletion docs/objects.inv
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Sphinx inventory version 2
# Project: ZLayerManager
# Version: 1.9
# Version: 1.10
# The remainder of this file is compressed using zlib.
x�u��j�0��z
�@z���B��Kokq�C�!~��Z +¾�f�[�epN����a��v��w~D���&6��F�3��Q�@U)���l���M����Чd��T�����yS��b��[N�(����R���w�4
Expand Down
4 changes: 2 additions & 2 deletions docs/search.html
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

<meta name="viewport" content="width=device-width, initial-scale=1.0">

<title>Search &mdash; ZLayerManager 1.9.0 documentation</title>
<title>Search &mdash; ZLayerManager 1.10.0 documentation</title>



Expand Down Expand Up @@ -59,7 +59,7 @@


<div class="version">
1.9
1.10
</div>


Expand Down
Loading

0 comments on commit c621c1d

Please sign in to comment.