nimphs.properties.utils
Modules
nimphs.properties.utils.interpolation
- class InterpInfo
Bases:
object
Base class of utility classes to get interpolation information for sequence objects.
- exists: bool = True
Indicate the current time point is an existing time point
- Type
bool
- frame: int = 0
Current frame
- Type
int
- has_data: bool = False
Indicate if data has been successfully computed
- Type
bool
- left: int = 0
Previous existing time point
- Type
int
- left_frame: int = 0
Frame at the "left" of the current time point
- Type
int
- right: int = 0
Next existing time point
- Type
int
- time_steps: int = 0
Number of time steps between each existing time point
- Type
int
- class InterpInfoMeshSequence(obj: Object, frame: int, threshold: float = 0.0001)
Bases:
InterpInfo
Utility class to get interpolation information for 'mesh sequence' objects.
- compute(obj: Object, frame: int, threshold: float = 0.0001) None
Compute time information for interpolation of 'mesh sequence' objects.
- Parameters
obj (Object) -- sequence object
frame (int) -- current frame
threshold (float, optional) -- shape_key value threshold. Defaults to 0.0001.
- scan(bmesh: Mesh, threshold: float = 0.0001) None
Scan time information for interpolation of 'mesh sequence' objects.
Example of output: * Mesh sequence: frame start = 12, anim length = 50. * Shape keys are linearly interpolated (2 time steps between each time point) * Current frame: 125 Timeline Frames: (12)⌄ (15)⌄ (125)⌄ (159)⌄ * + + * ... * + + * + + * + + * ... * + + * Time points: (0)⌃ (1)⌃ (36)⌃ (37)⌃ (38)⌃ (39)⌃ (49)⌃ Outputs: { "state": enum in ['BASIS', 'EXISTING', 'INTERPOLATED'] here 'INTERPOLATED', "start_offset": 0, "time_points": [37, 38], "ids": [123, 126], "frame_start": 12, "frame_end": 159 }
- Parameters
bmesh (Mesh) -- mesh from which to get the information
threshold (float, optional) -- threshold on the shape_key value. Defaults to 0.0001.
- class InterpInfoStreamingSequence(frame: int, start: int, time_steps: int)
Bases:
InterpInfo
Utility class to get interpolation information for 'streaming sequence' objects.
- compute(frame: int, start: int, time_steps: int) None
Compute time information for interpolation of 'streaming sequence' objects.
- Parameters
frame (int) -- _description_
start (int) -- _description_
time_steps (int) -- _description_
- scan(time_point: int, time_steps: int) tuple[int, int, bool]
Scan time information for interpolation of 'streaming sequence' objects.
- Parameters
time_point (int) -- current time point
time_steps (int) -- number of time steps between each time point
- Returns
left time point, right time point, if left time point is an existing time point
- Return type
tuple[int, int, bool]
nimphs.properties.utils.others
- nimphs_on_save_pre(_dummy) None
Save data before the blender file is saved.
- register_custom_progress_bar() None
Register the custom progress bar.
nimphs.properties.utils.point_data
- class PointDataInformation(name: str = 'None', unit: str = '', range: ~nimphs.properties.utils.point_data.ValueRange = <nimphs.properties.utils.point_data.ValueRange object>, json_string: str = '')
Bases:
object
Data structure which hold information on a given point data.
- dumps() str
Serialize this data structure to a JSON formatted str.
- Returns
JSON stringified data
- Return type
str
- name: str = ''
Name of point data
- Type
str
- range: ValueRange = <nimphs.properties.utils.point_data.ValueRange object>
Point data value ranges information
- Type
- unit: str = ''
Unit of point data
- Type
str
- class PointDataManager(json_string: str = '')
Bases:
object
Data structure to manage point data information for both modules.
- append(name: str = 'NONE', unit: str = '', range: ~nimphs.properties.utils.point_data.ValueRange = <nimphs.properties.utils.point_data.ValueRange object>, data: ~typing.Optional[~typing.Union[dict, ~nimphs.properties.utils.point_data.PointDataInformation]] = None) None
Append new point data to the data structure.
- Parameters
name (str, optional) -- name. Defaults to "".
unit (str, optional) -- unit. Defaults to "".
range (ValueRange, optional) -- value range. Defaults to ValueRange().
data (Union[dict, PointDataInformation], optional) -- data. Defaults to None.
- clear() None
Clear all data.
- dumps() str
Serialize this data structure to a JSON formatted str.
- Returns
JSON stringified data
- Return type
str
- get(id: Union[str, int], prop: str = '') Optional[Union[PointDataInformation, str, ValueRange]]
Return information about point data at the given index.
- Parameters
id (Union[str, int]) -- can be the index or the name of point data
prop (str, optional) -- name of a specific property to get. If not set, return all. Defaults to "".
- Returns
information on point data.
- Return type
Union[PointDataInformation, str, ValueRange, None]
- length() int
Get the number of point data.
- Returns
number of point data
- Return type
int
- names: list[str] = []
Point data names
- Type
list[str]
- ranges: list[nimphs.properties.utils.point_data.ValueRange] = []
List of ValueRange
- Type
list[ValueRange]
- remove(id: int) None
Remove point data at the given index.
- Parameters
id (int) -- index of point data to remove
- units: list[str] = []
Point data units
- Type
list[str]
- update(data: PointDataInformation) None
Update point data information of the given point data if found in the list.
- Parameters
data (PointDataInformation) -- _description_
- class ValueRange(json_string: str = '')
Bases:
object
Data structure which hold information on point data value ranges.
- dumps() str
Serialize this data structure to a JSON formatted str.
- Returns
JSON stringified data
- Return type
str
- get(type: str) list[float]
Return a value range in a list of floats.
- Parameters
type (str) -- type of the value range, enum in ['LOCAL', 'GLOBAL', 'CUSTOM']
- Returns
value range
- Return type
list[float]
- maxC: float = nan
custom maximum
- Type
float
- maxG: float = nan
global maximum
- Type
float
- maxL: float = nan
local maximum
- Type
float
- minC: float = nan
custom minimum
- Type
float
- minG: float = nan
global minimum
- Type
float
- minL: float = nan
local minimum
- Type
float
nimphs.properties.utils.properties
- available_point_data(self, context: Context) list
Generate the list of available point data.
- Parameters
context (Context) -- context
- Returns
available point data
- Return type
list
- get_sequence_length(self) int
Return the animation length value.
- Returns
value
- Return type
int
- scalars(self, context: Context) list
Generate the list of available scalars for clipping.
- Parameters
context (Context) -- context
- Returns
point data
- Return type
list
- set_sequence_length(self, value: int) None
Set length of the animation.
Function triggered when the user sets a new animation length. This let us to make sure the new value is not higher than the available time steps.
- Parameters
self (IntProperty) -- property
value (int) -- new value
- update_clip_value(self, _context: Context) None
Set clip value.
Function triggered when the user sets a new clip value. This let us to make sure the new value is in the value range of the selected scalar. Set the value to the nearest bound if outside the range.
- Parameters
context (Context) -- context
- update_preview_time_point(self, context: Context) None
Update selected value of time point (make sure the user can only select available time points).
- Parameters
context (Context) -- context