π§ FBX#
FBX Format.
- Name:
Autodesk Filmbox
- Type:
π§ Model Encoder
- Wiki:
- Suffix:
.fbx- Support:
β οΈ Partial- Features:
Geometry
Example:
from scfile import formats
with formats.fbx.FbxEncoder(data) as fbx:
fbx.encode().save("output.fbx")
Encoder#
- class FbxEncoder(data, options=None, output=None)[source]#
Bases:
FileEncoder[ModelContent],FbxFileIO- format: FileFormat = 'fbx'#
Associated file format.
- order: ByteOrder = '<'#
Default byte order for pack/unpack operations.
- transforms: EncoderTransforms = [<function unique_names>, <function flip_uv>]#
Format-specific transforms applied to model data before serialization.
- add_signature()#
Write the format signature to the output stream.
- Return type:
None
- close()#
Flush and close the IO object.
This method has no effect if the file is already closed.
- Return type:
None
- property closed: bool#
- encode(transforms=None)#
Runs encoding pipeline.
- Parameters:
transforms (
Optional[list[Callable[[ModelScene],ModelScene]]]) β Override the default transforms for this call.- Return type:
Self- Returns:
Self (chaining).
- export(path, mode='wb')#
Write encoded data to file by stem. Format suffix appended. Closes encoder.
- Parameters:
path (
str|Path|PathLike[str]) β Output file path.mode (
Literal['rb','rb+','wb','wb+','ab','ab+']) β File mode (binary).
- Return type:
None
- export_as(path, mode='wb')#
Write encoded data to file by stem. Format suffix appended. Keeps the encoder open.
- Parameters:
path (
str|Path|PathLike[str]) β Output file path.mode (
Literal['rb','rb+','wb','wb+','ab','ab+']) β File mode (binary).
- Return type:
Self
- fileno()#
Returns underlying file descriptor if one exists.
OSError is raised if the IO object does not use a file descriptor.
- flush()#
Flush write buffers, if applicable.
This is not implemented for read-only and non-blocking streams.
- Return type:
None
- getvalue()#
- Return type:
bytes
- is_eof()#
- Return type:
bool
- isatty()#
Return whether this is an βinteractiveβ stream.
Return False if it canβt be determined.
- property location: str#
- prelude()#
Hook called before transforms, signature and serialization.
- Return type:
None
- read(size=-1)#
- Return type:
bytes
- readable()#
Return whether object was opened for reading.
If False, read() will raise OSError.
- Return type:
bool
- readline(size=-1, /)#
Read and return a line from the stream.
If size is specified, at most size bytes will be read.
The line terminator is always bβnβ for binary files; for text files, the newlines argument to open can be used to select the line terminator(s) recognized.
- readlines(hint=-1, /)#
Return a list of lines from the stream.
hint can be specified to control the number of lines read: no more lines will be read if the total size (in bytes/characters) of all lines so far exceeds hint.
- save(path, mode='wb')#
Write encoded data to file by name. Closes encoder.
- Parameters:
path (
str|Path|PathLike[str]) β Output file path.mode (
Literal['rb','rb+','wb','wb+','ab','ab+']) β File mode (binary).
- Return type:
None
- save_as(path, mode='wb')#
Write encoded data to file by name. Keeps encoder open.
- Parameters:
path (
str|Path|PathLike[str]) β Output file path.mode (
Literal['rb','rb+','wb','wb+','ab','ab+']) β File mode (binary).
- Return type:
Self
- seek(pos, whence=0)#
Change the stream position to the given byte offset.
- offset
The stream position, relative to βwhenceβ.
- whence
The relative position to seek from.
The offset is interpreted relative to the position indicated by whence. Values for whence are:
os.SEEK_SET or 0 β start of stream (the default); offset should be zero or positive
os.SEEK_CUR or 1 β current stream position; offset may be negative
os.SEEK_END or 2 β end of stream; offset is usually negative
Return the new absolute position.
- Return type:
int
- seekable()#
Return whether object supports random access.
If False, seek(), tell() and truncate() will raise OSError. This method may need to do a test seek().
- Return type:
bool
- signature: Optional[bytes] = None#
Expected file signature.
- size()#
- Return type:
int
- skip(size)#
- property suffix: str#
- tell()#
Return current stream position.
- Return type:
int
- transform(transforms=None)#
Apply format-specific transforms to model data.
- truncate()#
Truncate file to size bytes.
File pointer is left unchanged. Size defaults to the current IO position as reported by tell(). Returns the new size.
- unicode_errors: str = 'replace'#
Error handling mode for UTF-8 encoding/decoding.
- writable()#
Return whether object was opened for writing.
If False, write() will raise OSError.
- Return type:
bool
- write(data)#
- Return type:
int
- writelines(lines, /)#
Write a list of lines to stream.
Line separators are not added, so it is usual for each of the lines provided to have a line separator at the end.
- data: ContentType#
- options: Options#
Shared handlers options.
- ctx: TempContext#
IO#
Constants#
- class FBX[source]#
- VERSION = 7400#
- HEADER_VERSION = 1003#
- HEADER = b'Kaydara FBX Binary \x00\x1a\x00'#
- FILE_ID = b'(\xb5/\xfd\x8e\xb5NT\x9f8\x1e\xb9\xe6+\x92\xad'#
- NULL_NODE = b'\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00'#
- CREATOR = b'onejeuu/sc-file v5.1.0'#
- class DEFAULT[source]#
-
SETTINGS:
list[tuple[Any,...]] = [(b'UpAxis', b'int', b'Integer', b'', 1), (b'UpAxisSign', b'int', b'Integer', b'', 1), (b'FrontAxis', b'int', b'Integer', b'', 2), (b'FrontAxisSign', b'int', b'Integer', b'', 1), (b'CoordAxis', b'int', b'Integer', b'', 0), (b'CoordAxisSign', b'int', b'Integer', b'', 1), (b'UnitScaleFactor', b'double', b'Number', b'', 100.0), (b'TimeMode', b'enum', b'', b'', 11), (b'TimeSpanStart', b'KTime', b'Time', b'', 0), (b'TimeSpanStop', b'KTime', b'Time', b'', 0)]#
-
MESH:
list[tuple[Any,...]] = [(b'Lcl Translation', b'Lcl Translation', b'', b'A', 0.0, 0.0, 0.0), (b'Lcl Rotation', b'Lcl Rotation', b'', b'A', 0.0, 0.0, 0.0), (b'DefaultAttributeIndex', b'int', b'Integer', b'', 0), (b'InheritType', b'enum', b'', b'', 1)]#
-
MATERIAL:
list[tuple[Any,...]] = [(b'DiffuseColor', b'Color', b'', b'A', 0.8, 0.8, 0.8), (b'EmissiveColor', b'Color', b'', b'A', 1.0, 1.0, 1.0), (b'EmissiveFactor', b'Number', b'', b'A', 0.0), (b'AmbientColor', b'Color', b'', b'A', 0.05, 0.05, 0.05), (b'AmbientFactor', b'Number', b'', b'A', 0.0), (b'BumpFactor', b'double', b'Number', b'', 0.0), (b'SpecularColor', b'Color', b'', b'A', 0.8, 0.8, 0.8), (b'SpecularFactor', b'Number', b'', b'A', 0.0), (b'Shininess', b'Number', b'', b'A', 0.0), (b'ShininessExponent', b'Number', b'', b'A', 0.0), (b'ReflectionColor', b'Color', b'', b'A', 0.8, 0.8, 0.8), (b'ReflectionFactor', b'Number', b'', b'A', 0.0)]#
-
CURVE:
list[tuple[Any,...]] = [(b'd|X', b'Number', b'', b'A', 0.0), (b'd|Y', b'Number', b'', b'A', 0.0), (b'd|Z', b'Number', b'', b'A', 0.0)]#
-
SETTINGS: