Scene class¶
Scene class.
Scene(scene_id: int, project: Project)
¶
Bases: pytvpaint.utils.Removable
A Scene is a collection of clips. A Scene is parented to a project.
Source code in pytvpaint/scene.py
20 21 22 23 | |
is_current: bool
property
¶
Returns True if the scene is the current one.
id: int
property
¶
The scene id.
project: Project
property
¶
The scene's project.
position: int
property
writable
¶
The scene's position in the project.
Raises:
| Type | Description |
|---|---|
ValueError
|
if scene cannot be found in the project |
clip_ids: Iterator[int]
property
¶
Returns an Returns an iterator over the clip ids.
clips: Iterator[Clip]
property
¶
Yields the scene clips.
refresh_on_call = True
instance-attribute
¶
is_removed: bool
property
¶
Checks if the object is removed by trying to refresh its data.
Returns:
| Name | Type | Description |
|---|---|---|
bool |
bool
|
whether if it was removed or not |
current_scene_id() -> int
staticmethod
¶
Returns the current scene id (the current clip's scene).
Source code in pytvpaint/scene.py
35 36 37 38 | |
current_scene() -> Scene
staticmethod
¶
Returns the current scene of the current project.
Source code in pytvpaint/scene.py
40 41 42 43 44 45 46 | |
new(project: Project | None = None, clips: list[str] | None = None) -> Scene
classmethod
¶
Creates a new scene in the provided project.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
project
|
pytvpaint.project.Project | None
|
parent project |
None
|
clips
|
list[str] | None
|
list of clip names to create alongside new scene |
None
|
Returns:
| Type | Description |
|---|---|
pytvpaint.scene.Scene
|
new scene instance |
Source code in pytvpaint/scene.py
48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 | |
make_current() -> None
¶
Make this scene the current one.
Source code in pytvpaint/scene.py
86 87 88 89 90 91 92 93 | |
get_clip(by_id: int | None = None, by_name: str | None = None, by_regex: re.Pattern[str] | None = None) -> Clip | None
¶
Find a clip by id or by name.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
by_id
|
int | None
|
search by id. Defaults to None. |
None
|
by_name
|
str | None
|
search by name, search is case-insensitive. Defaults to None. |
None
|
by_regex
|
re.Pattern[str] | None
|
search by name using a compiled regex, case-sensitivity is left to the regex. Defaults to None. |
None
|
Raises:
| Type | Description |
|---|---|
ValueError
|
if none of the search arguments where provided |
Returns:
| Type | Description |
|---|---|
pytvpaint.clip.Clip | None
|
Clip | None: the searched element or None if search was unsuccessful |
Source code in pytvpaint/scene.py
139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 | |
add_clip(clip_name: str) -> Clip
¶
Adds a new clip to the scene.
Source code in pytvpaint/scene.py
160 161 162 163 164 | |
duplicate() -> Scene
¶
Duplicate the scene and return it.
Source code in pytvpaint/scene.py
166 167 168 169 170 171 172 | |
split() -> list[Scene]
¶
Duplicate the scene and return it.
Source code in pytvpaint/scene.py
174 175 176 177 178 179 180 181 182 183 184 185 186 187 | |
remove() -> None
¶
Remove the scene and all the clips inside.
Warning
All Clip instances will be invalid after removing the scene.
There's no protection mechanism to prevent accessing clip data that doesn't exist anymore.
Source code in pytvpaint/scene.py
189 190 191 192 193 194 195 196 197 | |
refresh() -> None
¶
Does a refresh of the object data.
Raises:
| Type | Description |
|---|---|
ValueError
|
if the object has been mark removed |
Source code in pytvpaint/utils.py
70 71 72 73 74 75 76 77 | |
mark_removed() -> None
¶
Marks the object as removed and is therefor not usable.
Source code in pytvpaint/utils.py
98 99 100 | |