Skip to content

Commit

Permalink
Merge branch 'devel-ThicknessChecker'
Browse files Browse the repository at this point in the history
n-taka committed Feb 9, 2019
2 parents 6881f8a + 92c879f commit 06fd728
Showing 22 changed files with 153 additions and 34 deletions.
110 changes: 77 additions & 33 deletions ThicknessChecker/ThicknessChecker.txt
Original file line number Diff line number Diff line change
@@ -1,27 +1,47 @@
//////
// variable definitions
//////
////
// export setting
////
[VarDef, Tool_Export_Tri]
[VarDef, Tool_Polypaint_Colorize]
[VarDef, Tool_Export_Txr]
[VarDef, Tool_Export_Flp]
[VarDef, Tool_Export_Mrg]
[VarDef, Tool_Export_Grp]

////
// dll path, language
////
[VarDef, zfutilPath, "dummy"]
[VarDef, dllPath, "dummy"]
// hard coded...
[VarDef, enLangFilePath, "dummy"]
[VarDef, language]
// debug
//[VarDef, dataDirPath, [fileNameResolvePath, "ThicknessCheckerData\"]]
// install
[VarDef, dataDirPath, [fileNameResolvePath, "ZBRUSH_ZSTARTUP\ZPlugs64\ThicknessCheckerData\"]]
////
// temporary files
////
[VarDef, tmpFile, "tmp.obj"]
[VarDef, colorOBJFile, "thickness.obj"]

////
// parameters for computation
////
[VarDef, height, 100.0]
[VarDef, preferredThickness, 5.0]
[VarDef, minimumThickness, 3.0]
[VarDef, doubleParam]
[MemCreate, acceleratorTextMem, 256, 0]
[VarDef, acceleratorText, ""]
[VarDef, chosenAccelerator, "dummy"]
//////

// check if this plugin is correctly installed
//////
// search dlls
// from http://docs.pixologic.com/user-guide/customizing-zbrush/zscripting/zfileutils/#dllPath
//////
[RoutineDef, CheckSystem,
//check ZBrush version
[VarSet,Zvers,[ZBrushInfo,0]]
@@ -33,45 +53,48 @@
[If, [ZBrushInfo, 6]==0,//windows
//use the path below for testing only
//[VarSet, dllPath, "ThicknessCheckerData\ThicknessChecker.dll"]
//[VarSet, zfutilPath, "ThicknessCheckerData\ZFileUtils64.dll"]
//[VarSet, enLangFilePath, "ThicknessCheckerData\lang\ThicknessChecker_en.xml"]
//use the path below for installed plugins
[VarSet, dllPath, "ZBRUSH_ZSTARTUP\ZPlugs64\ThicknessCheckerData\ThicknessChecker.dll"]
[VarSet, zfutilPath, "ZBRUSH_ZSTARTUP\ZPlugs64\ThicknessCheckerData\ZFileUtils64.dll"]
[VarSet, enLangFilePath, "ZBRUSH_ZSTARTUP\ZPlugs64\ThicknessCheckerData\lang\ThicknessChecker_en.xml"]
,
//use the path below for testing only
//[VarSet, dllPath, "ThicknessCheckerData/ThicknessChecker.lib"]
//[VarSet, zfutilPath, "ThicknessCheckerData/ZFileUtils.lib"]
//[VarSet, enLangFilePath, "ThicknessCheckerData/lang/ThicknessChecker_en.xml"]
//use the path below for installed plugins
[VarSet, dllPath, "ZBRUSH_ZSTARTUP/ZPlugs64/ThicknessCheckerData/ThicknessChecker.lib"]
[VarSet, zfutilPath, "ZBRUSH_ZSTARTUP/ZPlugs64/ThicknessCheckerData/ZFileUtils.lib"]
[VarSet, enLangFilePath, "ZBRUSH_ZSTARTUP/ZPlugs64/ThicknessCheckerData/lang/ThicknessChecker_en.xml"]
]
// check if there are dll/lib exists
[If, [FileExists, [Var,dllPath]],
, // else no DLL.
[Note,"\Cff9923Note :\Cc0c0c0 The \Cff9923 ThicknessChecker plugin \Cffffffdll/lib\Cc0c0c0 could not be found at the correct location. Please re-install the plugin, making sure the relevant files and folders are in the \CffffffZStartup/ZPlugs\Cc0c0c0 folder."]
[Exit]
]
]//end routine

////
// main processing
[ISubPalette, "ZPlugin:ThicknessChecker"]
[ISlider, "ZPlugin:ThicknessChecker:Height (Y)", 100.0, 0.001, 0, 1000, "Set height (Y)",
[VarSet, height, [IGet, "ZPlugin:ThicknessChecker:Height (Y)"]],
0,
1
]
[ISlider, "ZPlugin:ThicknessChecker:Preferred thickness", 5.0, 0.001, 0, 100, "Set preferred thickness",
[VarSet, preferredThickness, [IGet, "ZPlugin:ThicknessChecker:Preferred thickness"]],
0,
1
]
[ISlider, "ZPlugin:ThicknessChecker:Minimum thickness", 3.0, 0.001, 0, 50, "Set minimum required thickness",
[VarSet, minimumThickness, [IGet, "ZPlugin:ThicknessChecker:Minimum thickness"]],
0,
1
]
//////

//////
// translation routine
// from http://docs.pixologic.com/user-guide/customizing-zbrush/zscripting/zfileutils/localization/
//////
[RoutineDef, ZFU_RegisterLocalizationFile,
[FileExecute, [Var, zfutilPath], RegisterLocalizationFile, enFilePath]
, enFilePath]
//////

// on startup,
//////
// startup
//////
// + search dll
// + get accelerators
[RoutineCall, CheckSystem]
//[RoutineCall, ZFU_GetCurrentLanguage, language]
[RoutineCall, ZFU_RegisterLocalizationFile, [FileNameResolvePath, [Var, enLangFilePath]]]
[FileExecute, [Var, dllPath], "getAccelerator", , , acceleratorTextMem]
[MemReadString, acceleratorTextMem, acceleratorText]
// 4 is hard coded...
@@ -108,6 +131,27 @@
[ISet, [StrMerge, "ZPlugin:ThicknessChecker:GPU:", [Var, acceleratorNames(3)]], [StrFind, [Var, acceleratorNames(3)], [Var, chosenAccelerator]] == 0]
]

//////
// UI
//////
[ISubPalette, "ZPlugin:ThicknessChecker"]

[ISlider, "ZPlugin:ThicknessChecker:Height (Y)", 100.0, 0.001, 0.0, 300.0, "Height along with Y direction",
[VarSet, height, [IGet, "ZPlugin:ThicknessChecker:Height (Y)"]],
0,
1
]
[ISlider, "ZPlugin:ThicknessChecker:Preferred thickness", 5.0, 0.001, 0, 10.0, "The region thicker than this value, it will be colored in blue",
[VarSet, preferredThickness, [IGet, "ZPlugin:ThicknessChecker:Preferred thickness"]],
0,
1
]
[ISlider, "ZPlugin:ThicknessChecker:Minimum thickness", 3.0, 0.001, 0, 10.0, "The region thinner than this value, it will be colored in red",
[VarSet, minimumThickness, [IGet, "ZPlugin:ThicknessChecker:Minimum thickness"]],
0,
1
]

[ISubPalette, "ZPlugin:ThicknessChecker:GPU"]

[ISwitch, [StrMerge, "ZPlugin:ThicknessChecker:GPU:", [Var, acceleratorNames(0)]], 1, [Var, acceleratorSpecs(0)],
@@ -154,7 +198,7 @@
[VarSet, chosenAccelerator, [Var, acceleratorNames(0)]]


[IButton, "ZPlugin:ThicknessChecker:Compute", "Compute thickness",
[IButton, "ZPlugin:ThicknessChecker:Compute", "Start thickness computation",
[If, [IExists, Tool:Export],
[RoutineCall, CheckSystem]
// store current export settings
@@ -190,24 +234,24 @@
[ISet, Tool:Export:Grp, [Var, Tool_Export_Grp]]
////

// "../../testModels/,Dog.obj,thickness.obj,Radeon RX Vega M GH Graphics\0"
[VarDef, textForDll, [StrMerge, [Var, dataDirPath], ",", [Var, tmpFile], ",", [Var, colorOBJFile], ",", [Var, chosenAccelerator]]]
[MVarDef, mem, 3, 0]
[MVarSet, mem, 0, [Var, height]]
[MVarSet, mem, 1, [Var, preferredThickness]]
[MVarSet, mem, 2, [Var, minimumThickness]]
// [VarDef, doubleForDll, ([Var, height] * 1024.0 * 1024.0) + ([Var, preferredThickness] * 1024.0) + [Var, minimumThickness]]
[VarDef, result, [FileExecute, [Var, dllPath], "checkThickness", textForDll, 0, mem]]

[If, result,
// import to Tool
[IPress,Tool:PolyMesh3D]
[FileNameSetNext, [StrMerge, [Var, dataDirPath], [Var, colorOBJFile]]]
[IPress,"Tool:Import"]
[IFreeze,
[IPress,Tool:PolyMesh3D]
[FileNameSetNext, [StrMerge, [Var, dataDirPath], [Var, colorOBJFile]]]
[IPress,"Tool:Import"]

// erase temporary file.
[FileDelete, [StrMerge, [Var, dataDirPath], [Var, tmpFile]]]
[FileDelete, [StrMerge, [Var, dataDirPath], [Var, colorOBJFile]]]
// erase temporary file.
[FileDelete, [StrMerge, [Var, dataDirPath], [Var, tmpFile]]]
[FileDelete, [StrMerge, [Var, dataDirPath], [Var, colorOBJFile]]]
]
,
[Note, "Sorry, there is some error..."]
]
Binary file modified ThicknessChecker/ThicknessChecker.zsc
Binary file not shown.
Binary file not shown.
Binary file not shown.
1 change: 0 additions & 1 deletion ThicknessChecker/ThicknessCheckerData/FromThis.txt

This file was deleted.

Binary file not shown.
Binary file not shown.
38 changes: 38 additions & 0 deletions ThicknessChecker/ThicknessCheckerData/lang/ThicknessChecker_en.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
<buttons>
<button path="ZPlugin:ThicknessChecker">
<title text="ThicknessChecker" trans=""/>
</button>
<button path="ZPlugin:ThicknessChecker:Height (Y)">
<title text="Height (Y)" trans=""/>
<info text="Height along with Y direction" trans=""/>
</button>
<button path="ZPlugin:ThicknessChecker:Preferred thickness">
<title text="Preferred thickness" trans=""/>
<info text="The region thicker than this value, it will be colored in blue" trans=""/>
</button>
<button path="ZPlugin:ThicknessChecker:Minimum thickness">
<title text="Minimum thickness" trans=""/>
<info text="The region thinner than this value, it will be colored in red" trans=""/>
</button>
<button path="ZPlugin:ThicknessChecker:GPU">
<title text="GPU" trans=""/>
</button>
<button path="ZPlugin:ThicknessChecker:Compute">
<title text="Compute" trans=""/>
<info text="Start thickness computation" trans=""/>
</button>
<!-- <button tag="">
<title text="" trans=""/>
<info text="" trans=""/>
</button> -->
</buttons>

<messages>
<!-- <message tag="ZFU_RENAME_SUBTOOL_CONFIRMATION">
<info text="You are about to rename current SubTool as %arg1%.\nAre your sure you really want to name it %arg1%?" trans=""/>
</message> -->
<!-- <message tag="">
<title text="" trans=""/>
<info text="" trans=""/>
</message> -->
</messages>
38 changes: 38 additions & 0 deletions ThicknessChecker/ThicknessCheckerData/lang/ThicknessChecker_jp.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
<buttons>
<button path="ZPlugin:ThicknessChecker">
<title text="ThicknessChecker" trans="太さ・厚さチェッカー"/>
</button>
<button path="ZPlugin:ThicknessChecker:Height (Y)">
<title text="Height (Y)" trans="高さ (Y)"/>
<info text="Height along with Y direction" trans="Y軸に沿った高さ"/>
</button>
<button path="ZPlugin:ThicknessChecker:Preferred thickness">
<title text="Preferred thickness" trans="安定して造形できる太さ・厚さ"/>
<info text="The region thicker than this value, it will be colored in blue" trans="この値より太い・厚い部分は青色で表示されます"/>
</button>
<button path="ZPlugin:ThicknessChecker:Minimum thickness">
<title text="Minimum thickness" trans="最低限必要な太さ・厚さ"/>
<info text="The region thinner than this value, it will be colored in red" trans="この値より細い・薄い部分は赤色で表示されます"/>
</button>
<button path="ZPlugin:ThicknessChecker:GPU">
<title text="GPU" trans="GPU"/>
</button>
<button path="ZPlugin:ThicknessChecker:Compute">
<title text="Compute" trans="計算開始"/>
<info text="Start thickness computation" trans="太さ・厚さの計算を開始します"/>
</button>
<!-- <button tag="">
<title text="" trans=""/>
<info text="" trans=""/>
</button> -->
</buttons>

<messages>
<!-- <message tag="ZFU_RENAME_SUBTOOL_CONFIRMATION">
<info text="You are about to rename current SubTool as %arg1%.\nAre your sure you really want to name it %arg1%?" trans=""/>
</message> -->
<!-- <message tag="">
<title text="" trans=""/>
<info text="" trans=""/>
</message> -->
</messages>
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file removed ThicknessChecker/ThicknessCheckerData/libgmp-10.dll
Binary file not shown.
Binary file not shown.
Binary file removed ThicknessChecker/ThicknessCheckerData/libmpfr-4.dll
Binary file not shown.
Binary file not shown.
Binary file modified distribute/ThicknessChecker.zip
Binary file not shown.

0 comments on commit 06fd728

Please sign in to comment.