pooltool.objects.ball.sets#
Ballset module#
What is a ballset?
A ballset specifies the set that a ball belongs to.
Why is it important?
Ballsets are important for properly rendering balls in a scene. By specifying a ballset for a ball, you declare the visual texture / skin that the ball should be wrapped in. If a ball’s ballset is not declared, it will be rendered with the default skin.
What ballsets are available?
See get_ballset_names().
Where are ballsets stored?
Each ballset is represented as a subdirectory within the following directory:
$ echo $(python -c "import pooltool; print(pooltool.__file__[:-12])")/models/balls
Each ball model is a .glb file. Its base name represents the model’s ID, and
matching ball IDs will be textured by this model. To associate multiple ball IDs to the
same model, a conversion.json file is used. For example, see how the
generic_snooker ballset matches the red ball IDs to the same model ID:
$ cat $(python -c "import pooltool; print(pooltool.__file__[:-12])")/models/balls/generic_snooker/conversion.json
{
"red_01": "red",
"red_02": "red",
"red_03": "red",
"red_04": "red",
"red_05": "red",
"red_06": "red",
"red_07": "red",
"red_08": "red",
"red_09": "red",
"red_10": "red",
"red_11": "red",
"red_12": "red",
"red_13": "red",
"red_14": "red",
"red_15": "red"
}
Overview#
|
Return the ballset with the given name. |
Returns a list of available ballset names |
Classes#
- class pooltool.objects.ball.sets.BallSet(name: str)[source]#
A ballset
- name#
The name of the ballset.
During instantiation, the validity of this name will be checked, and a ValueError will be raised if the ballset doesn’t exist.
- Type:
- property path: pathlib.Path#
The path of the ballset directory
This directory holds the ball models.
- Return type:
Methods:
- ball_path(id: str) pathlib.Path[source]#
The model path used for a given ball ID
- Parameters:
id (str) -- The ball ID.
- Raises:
ValueError -- If Ball ID doesn’t match to the ballset.
- Returns:
The model path.
- Return type:
Path
Functions#
- pooltool.objects.ball.sets.get_ballset(name: str) BallSet[source]#
Return the ballset with the given name.
- Parameters:
name (str) -- The name of the ballset. To list available ballset names, call
get_ballset_names().- Raises:
ValueError -- If Ball ID doesn’t match to the ballset.
- Returns:
A ballset.
- Return type: