Hello, hope to get your help! I scaled the first model. I want to achieve uniform scaling for other models, and the most important thing is that their distance will not change. Keep the distance between the original models! How to solve this need to use zbrush script! I have studied for 3 days without success, hope you help me!
Hi,
As you’ve found, this is a little tricky, especially when combining resizing with moving the model:
[VarDef,xPos,0]
[VarDef,yPos,0]
[VarDef,zPos,0]
[VarDef,sizeXYZ,0]
[VarDef,shiftX,0]
[VarDef,shiftY,0]
[VarDef,shiftZ,0]
[VarDef,newSizeXYZ,0]
//before moving a subtool, store position:
[IButton,Store,"Store the size and position of the selected SubTool",
[VarSet,xPos,[IGet,Tool:Geometry:X Position]]
[VarSet,yPos,[IGet,Tool:Geometry:Y Position]]
[VarSet,zPos,[IGet,Tool:Geometry:Z Position]]
[VarSet,sizeXYZ,[IGet,Tool:Geometry:XYZ Size]]
]
//after moving and scaling a subtool, resize and shift the others:
[IButton,Size_and Move_All,"Resize and Move All other SubTools",
[VarSet,activeSubTool,[SubToolGetActiveIndex]]
//calculate size difference
[VarSet,newSizeXYZ,sizeXYZ/[IGet,Tool:Geometry:XYZ Size]]
//calculate position difference
[VarSet,shiftX,[IGet,Tool:Geometry:X Position]-(xPos/newSizeXYZ)]
[VarSet,shiftY,[IGet,Tool:Geometry:Y Position]-(yPos/newSizeXYZ)]
[VarSet,shiftZ,[IGet,Tool:Geometry:Z Position]-(zPos/newSizeXYZ)]
[SubToolSelect,0]
[Loop,[SubToolGetCount],
[If,[Val,n] != #activeSubTool,
//resize the subtool
[ISet,Tool:Geometry:X Position,[IGet,Tool:Geometry:X Position]/newSizeXYZ]
[ISet,Tool:Geometry:Y Position,[IGet,Tool:Geometry:Y Position]/newSizeXYZ]
[ISet,Tool:Geometry:Z Position,[IGet,Tool:Geometry:Z Position]/newSizeXYZ]
[ISet,Tool:Geometry:XYZ Size,[IGet,Tool:Geometry:XYZ Size]/newSizeXYZ]
]
[IPress,Tool:SubTool:Select Down]
,n]
[SubToolSelect,0]
[Loop,[SubToolGetCount],
[If,[Val,n] != #activeSubTool,
//move the subtool
[ISet,Tool:Geometry:X Position,[IGet,Tool:Geometry:X Position]+shiftX]
[ISet,Tool:Geometry:Y Position,[IGet,Tool:Geometry:Y Position]+shiftY]
[ISet,Tool:Geometry:Z Position,[IGet,Tool:Geometry:Z Position]+shiftZ]
]
[IPress,Tool:SubTool:Select Down]
,n]
[SubToolSelect,activeSubTool]
]
I tried putting the resize and the shift into a single loop but it didn’t work for reasons I don’t understand. It may be that the Position/Size sliders are not updating immediately with the new values. They do behave oddly at times.
HTH,
Marcus
Thank you very much. I will try it. It seems that newSizeXYZ needs to add if to judge.