├── .packagefolder
├── .touchdesigner-version
├── Demo.toe
├── .gitignore
├── TauCeti_PresetSystem.toe
├── dist
└── Default
│ ├── Tweener.tox
│ ├── PresetDashboard.tox
│ └── PresetManager.tox
├── src
├── tdpTauCeti
│ ├── Tweener
│ │ ├── Tweener.tox
│ │ ├── curves
│ │ │ └── curves.tox
│ │ ├── Exceptions.py
│ │ ├── __init__.py
│ │ ├── TweenValue.py
│ │ ├── TweenObject.py
│ │ └── extTweener.py
│ ├── PresetManager
│ │ ├── ui
│ │ │ └── ui.tox
│ │ ├── PresetManager.tox
│ │ ├── __init__.py
│ │ ├── ParUtils.py
│ │ ├── extParStack.py
│ │ └── extTauCetiManager.py
│ ├── PresetCuelist
│ │ ├── PresetCuelist.tox
│ │ └── extCuelist.py
│ ├── PresetChopMapper
│ │ ├── PresetChopMapper.tox
│ │ └── extPresetMapper.py
│ ├── PresetDashboard
│ │ ├── PresetDashboard.tox
│ │ ├── __init__.py
│ │ └── extDashboard.py
│ ├── __init__.py
│ └── tweenerTest.py
└── TauCeti
│ └── __init__.py
├── AppData
├── Components
│ └── PrivateInvestigator.tox
├── PrivateInvestigator
│ ├── AC_Group.json
│ └── AC_Group.schema.json
└── Scripts
│ ├── package_release.py
│ └── sys.py
├── pyproject.toml
├── readme.md
└── LICENSE
/.packagefolder:
--------------------------------------------------------------------------------
1 | src
--------------------------------------------------------------------------------
/.touchdesigner-version:
--------------------------------------------------------------------------------
1 | 2023.00000
--------------------------------------------------------------------------------
/Demo.toe:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/PlusPlusOneGmbH/TauCeti/HEAD/Demo.toe
--------------------------------------------------------------------------------
/.gitignore:
--------------------------------------------------------------------------------
1 |
2 | Lib
3 | *.pyi
4 | *__pycache__*
5 | *.egg-info*
6 | TDImportCache
7 | .vscode
--------------------------------------------------------------------------------
/TauCeti_PresetSystem.toe:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/PlusPlusOneGmbH/TauCeti/HEAD/TauCeti_PresetSystem.toe
--------------------------------------------------------------------------------
/dist/Default/Tweener.tox:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/PlusPlusOneGmbH/TauCeti/HEAD/dist/Default/Tweener.tox
--------------------------------------------------------------------------------
/dist/Default/PresetDashboard.tox:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/PlusPlusOneGmbH/TauCeti/HEAD/dist/Default/PresetDashboard.tox
--------------------------------------------------------------------------------
/dist/Default/PresetManager.tox:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/PlusPlusOneGmbH/TauCeti/HEAD/dist/Default/PresetManager.tox
--------------------------------------------------------------------------------
/src/tdpTauCeti/Tweener/Tweener.tox:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/PlusPlusOneGmbH/TauCeti/HEAD/src/tdpTauCeti/Tweener/Tweener.tox
--------------------------------------------------------------------------------
/src/tdpTauCeti/PresetManager/ui/ui.tox:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/PlusPlusOneGmbH/TauCeti/HEAD/src/tdpTauCeti/PresetManager/ui/ui.tox
--------------------------------------------------------------------------------
/AppData/Components/PrivateInvestigator.tox:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/PlusPlusOneGmbH/TauCeti/HEAD/AppData/Components/PrivateInvestigator.tox
--------------------------------------------------------------------------------
/src/tdpTauCeti/Tweener/curves/curves.tox:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/PlusPlusOneGmbH/TauCeti/HEAD/src/tdpTauCeti/Tweener/curves/curves.tox
--------------------------------------------------------------------------------
/src/tdpTauCeti/PresetCuelist/PresetCuelist.tox:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/PlusPlusOneGmbH/TauCeti/HEAD/src/tdpTauCeti/PresetCuelist/PresetCuelist.tox
--------------------------------------------------------------------------------
/src/tdpTauCeti/PresetManager/PresetManager.tox:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/PlusPlusOneGmbH/TauCeti/HEAD/src/tdpTauCeti/PresetManager/PresetManager.tox
--------------------------------------------------------------------------------
/src/tdpTauCeti/PresetChopMapper/PresetChopMapper.tox:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/PlusPlusOneGmbH/TauCeti/HEAD/src/tdpTauCeti/PresetChopMapper/PresetChopMapper.tox
--------------------------------------------------------------------------------
/src/tdpTauCeti/PresetDashboard/PresetDashboard.tox:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/PlusPlusOneGmbH/TauCeti/HEAD/src/tdpTauCeti/PresetDashboard/PresetDashboard.tox
--------------------------------------------------------------------------------
/AppData/PrivateInvestigator/AC_Group.json:
--------------------------------------------------------------------------------
1 | {
2 | "Groups": {
3 | "Default": [
4 | "*"
5 | ]
6 | },
7 | "$schema": "./AC_Group.schema.json"
8 | }
--------------------------------------------------------------------------------
/src/TauCeti/__init__.py:
--------------------------------------------------------------------------------
1 | print("Module is renamed from TauCeti to tdpTauCeti. TauCeti will be removed in future version. Please change every use of TauCeti to tdpTauCeti.")
2 |
3 | from tdpTauCeti import *
4 |
--------------------------------------------------------------------------------
/src/tdpTauCeti/Tweener/Exceptions.py:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 | '''Info Header Start
8 | Name : tweener_exceptions
9 | Author : Wieland PlusPlusOne@AMB-ZEPH15
10 | Saveorigin : TauCeti_PresetSystem.toe
11 | Saveversion : 2023.12000
12 | Info Header End'''
13 | class TargetIsNotParameter(Exception):
14 | pass
15 |
16 | class InvalidParMode(Exception):
17 | pass
--------------------------------------------------------------------------------
/src/tdpTauCeti/__init__.py:
--------------------------------------------------------------------------------
1 | # Makre sure subpackages are imported so they can be accesses via the mod. method.
2 | from . import PresetManager
3 | from . import Tweener
4 | from . import PresetDashboard
5 |
6 | # Future Proofing
7 | __minimum_td_version__ = "2023.1200"
8 |
9 | # Futureprrofing for automated search of toxfiles and imports.
10 | _ToxFiles = {
11 | "PresetManager" : PresetManager.ToxFile,
12 | "Tweener" : Tweener.ToxFile,
13 | "PresetDashboard" : PresetDashboard.ToxFile
14 | }
--------------------------------------------------------------------------------
/src/tdpTauCeti/Tweener/__init__.py:
--------------------------------------------------------------------------------
1 | '''Info Header Start
2 | Name : __init__
3 | Author : Wieland PlusPlusOne@AMB-ZEPH15
4 | Saveorigin : TauCeti_PresetSystem.toe
5 | Saveversion : 2023.12000
6 | Info Header End'''
7 | from pathlib import Path
8 | ToxFile = Path( Path( __file__ ).parent, "Tweener.tox" )
9 | DefaultGlobalOpShortcut = "TAUCETI_TWEENER"
10 |
11 |
12 | from typing import TYPE_CHECKING, Union
13 | if TYPE_CHECKING:
14 | from .extTweener import extTweener
15 | Typing = Union[
16 | extTweener
17 | ]
18 | else:
19 | Typing = None
20 |
21 | __all__ = ["ToxFile", "Typing"]
--------------------------------------------------------------------------------
/AppData/PrivateInvestigator/AC_Group.schema.json:
--------------------------------------------------------------------------------
1 | {
2 | "$schema": "https://json-schema.org/draft/2020-12/schema",
3 | "$id": "https://example.com/product.schema.json",
4 | "title": "TouchdesignerConfig",
5 | "description": "A dynamic and schemabased jsonConfig for Touchdesigner",
6 | "type": "object",
7 | "properties": {
8 | "Groups": {
9 | "description": "",
10 | "type": "object",
11 | "additionalProperties": {
12 | "description": "",
13 | "type": "array",
14 | "items": {
15 | "description": "",
16 | "type": [
17 | "string"
18 | ]
19 | }
20 | }
21 | }
22 | }
23 | }
--------------------------------------------------------------------------------
/src/tdpTauCeti/PresetDashboard/__init__.py:
--------------------------------------------------------------------------------
1 | '''Info Header Start
2 | Name : __init__
3 | Author : Wieland PlusPlusOne@AMB-ZEPH15
4 | Saveorigin : TauCeti_PresetSystem.toe
5 | Saveversion : 2023.12000
6 | Info Header End'''
7 |
8 | from pathlib import Path
9 | ToxFile = Path( Path( __file__ ).parent, "PresetDashboard.tox" )
10 | DefaultGlobalOpShortcut = "TAUCETI_PRESETDASHBOARD"
11 |
12 |
13 | from typing import TYPE_CHECKING, Union
14 | if TYPE_CHECKING:
15 |
16 | from .extDashboard import extDashboard
17 | Typing = Union[
18 | extDashboard
19 | ]
20 | else:
21 | Typing = None
22 |
23 | __all__ = ["ToxFile", "Typing"]
24 |
--------------------------------------------------------------------------------
/src/tdpTauCeti/PresetManager/__init__.py:
--------------------------------------------------------------------------------
1 | '''Info Header Start
2 | Name : __init__
3 | Author : Wieland PlusPlusOne@AMB-ZEPH15
4 | Saveorigin : TauCeti_PresetSystem.toe
5 | Saveversion : 2023.12000
6 | Info Header End'''
7 |
8 | from pathlib import Path
9 | ToxFile = Path( Path( __file__ ).parent, "PresetManager.tox" )
10 | DefaultGlobalOpShortcut = "TAUCETI_PRESETMANAGER"
11 |
12 |
13 | from typing import TYPE_CHECKING, Union
14 | if TYPE_CHECKING:
15 | from .extParStack import extParStack
16 | from .extTauCetiManager import extTauCetiManager
17 | Typing = Union[
18 | extParStack, extTauCetiManager
19 | ]
20 | else:
21 | Typing = None
22 |
23 | __all__ = ["ToxFile", "Typing"]
24 |
--------------------------------------------------------------------------------
/src/tdpTauCeti/PresetManager/ParUtils.py:
--------------------------------------------------------------------------------
1 |
2 |
3 | '''Info Header Start
4 | Name : ParUtils
5 | Author : Wieland PlusPlusOne@AMB-ZEPH15
6 | Saveorigin : TauCeti_PresetSystem.toe
7 | Saveversion : 2023.12000
8 | Info Header End'''
9 |
10 | def bool_parse( parameter ):
11 | return int( null_parse(parameter))
12 |
13 | def null_parse( parameter ):
14 | return parameter.eval()
15 |
16 | def val_parse( parameter ):
17 | return parameter.val
18 |
19 | parser = { "Toggle" : bool_parse,
20 | "Momentary" : bool_parse,
21 | "OP" : val_parse,
22 | "COMP" : val_parse,
23 | "TOP" : val_parse,
24 | "DAT" : val_parse,
25 | "CHOP" : val_parse,
26 | "MAT" : val_parse,
27 | "SOP" : val_parse
28 | }
29 |
30 | def parse( parameter ):
31 | return parser.get( parameter.style, null_parse )( parameter )
32 |
--------------------------------------------------------------------------------
/pyproject.toml:
--------------------------------------------------------------------------------
1 | [project]
2 | name = "tdp-TauCeti"
3 | version = "5.1.4"
4 | description = "Presetmanagement and parameer manipulation in TouchDesigner."
5 | readme = "README.md"
6 | license-files = ["LICENSE"]
7 | requires-python = ">=3.11"
8 |
9 | authors = [
10 | {name = "Wieland Hilker", email = "wieland@plusplus.one"},
11 | ]
12 | keywords = ["TouchDesigner", "Parameter", "Tweener", "2023.12000"]
13 | dependencies = []
14 |
15 | [project.urls]
16 | Website = "https://plusplus.one"
17 | Repository = "https://github.com/PlusPlusOneGmbH/TD_TauCeti_Presetsystem"
18 |
19 | [build-system]
20 | requires = ["setuptools>=61.0"]
21 | build-backend = "setuptools.build_meta"
22 |
23 | [tool.setuptools.packages.find]
24 | where = ["src"]
25 |
26 | [tool.setuptools.package-data]
27 | "*" = ["*.tox"]
28 |
29 | [dependency-groups]
30 | dev = [
31 | "monkeybrain>=0.2.3",
32 | ]
33 |
34 |
35 | [tool.touchdesigner]
36 | projectfile = "TauCeti_PresetSystem.toe" # Adjust if you rename the base project.
37 | enforce-version="latest-build" # Options: strict, closest-build, latest-build, latest-version
38 |
--------------------------------------------------------------------------------
/AppData/Scripts/package_release.py:
--------------------------------------------------------------------------------
1 |
2 |
3 | from subprocess import call
4 |
5 | search_tag = "package_release_candidate"
6 | release_candidates = parent.Project.findChildren( tags = [search_tag] )
7 |
8 | # Lets release the proper dist to the actual repository for everyone to be able to fetch them directly without having to
9 | # select the correct branch.
10 | for target in release_candidates:
11 | target.tags.remove(search_tag)
12 | op("PrivateInvestigator").Release( target )
13 |
14 |
15 | call("uv version --bump patch")
16 | import tomllib
17 | with open("pyproject.toml", "rb") as projecttoml:
18 | projectdata = tomllib.load( projecttoml )
19 | version = projectdata["project"]["version"]
20 |
21 | call("git add .")
22 | call(f'git commit . -m "Bump to Version {version}"')
23 |
24 | # Now lets prepare everything for a clean buildprocess.
25 | # In the future all of this will run outside ;)
26 |
27 | for target in release_candidates:
28 | for child in list( target.findChildren( tags = [op("PrivateInvestigator").par.Tag.eval()] ) ) + [target]:
29 | debug(f"Removing tag from {child}")
30 | child.tags.remove( op("PrivateInvestigator").par.Tag.eval() )
31 |
32 | prereleasescript = target.op("pre_release")
33 | if prereleasescript is not None: prereleasescript.run()
34 | op("PrivateInvestigator").Save( target )
35 |
36 | call(f'git checkout -b v{version}')
37 | call("git add .")
38 | call(f'git commit . -m "TauCeti Release v{version}" ')
39 |
40 |
41 |
42 |
43 |
--------------------------------------------------------------------------------
/src/tdpTauCeti/PresetChopMapper/extPresetMapper.py:
--------------------------------------------------------------------------------
1 | '''Info Header Start
2 | Name : extPresetMapper
3 | Author : Wieland PlusPlusOne@AMB-ZEPH15
4 | Saveorigin : TauCeti_PresetSystem.toe
5 | Saveversion : 2023.12000
6 | Info Header End'''
7 | class extPresetMapper:
8 | """
9 | extPresetMapper description
10 | """
11 | def __init__(self, ownerComp):
12 | # The component to which this extension is attached
13 | self.ownerComp = ownerComp
14 | #self.maps = self.ownerComp.op('maps')
15 | self.learn_table = self.ownerComp.op('learn')
16 | self.selector = self.ownerComp.op('selector')
17 |
18 | self.selected_index = 0
19 |
20 | @property
21 | def maps(self):
22 | return self.ownerComp.op("repo_maker").Repo
23 |
24 | def get_engine(self):
25 | return self.ownerComp.par.Manager.eval()
26 |
27 | def Do_Map(self, name, time):
28 | for preset in self.maps.rows( name ):
29 | self.get_engine().Recall_Preset( preset[1].val, time)
30 |
31 | def Set_Name(self, index, name):
32 | self.maps[index, 'name'] = name
33 |
34 | def Open_Selection(self, index):
35 | self.selected_index = index
36 | self.selector.par.display = True
37 | return
38 |
39 | def Clear_Preset(self, index):
40 | self.maps[ index, "preset"] = ''
41 |
42 | def Select_Preset(self, value):
43 | self.selector.par.display = False
44 | if not value: return
45 | self.maps[ self.selected_index, "preset"] = value
46 |
47 | def Learn(self, index):
48 | learn_cell = self.learn_table[str(index), 0]
49 | if learn_cell is None:
50 | return self.learn_table.appendRow( index )
51 | self.learn_table.deleteRow( learn_cell.row )
52 |
53 | def Handle_On(self, name, time):
54 | for index in self.learn_table.rows():
55 | self.maps[ int( index[0].val ), "name"] = name
56 | self.learn_table.clear()
57 |
58 | self.Do_Map( name, time )
59 | return
--------------------------------------------------------------------------------
/AppData/Scripts/sys.py:
--------------------------------------------------------------------------------
1 | import sys as __surely_not_even_close_to_sys
2 |
3 | # This is a hack that allows us to overwrite the default beavhiour of the sys module.
4 | # By hijacking the import of sys on import, we can inject custom paths without having
5 | # to rely on any order of init that is the big problem with any current teached approach.
6 |
7 | def _setup_path_from_packagefolder():
8 | import os, re
9 | from sys import path
10 |
11 | def replace_var(match):
12 | var_name = match.group(1)
13 | if len( env_naming := var_name.split("||") ) == 2:
14 | return os.environ.get( env_naming[0], env_naming[1] )
15 | else:
16 | return os.environ[env_naming[0]]
17 |
18 | with open(".packagefolder", "a+t") as package_folder_file:
19 | # Lets read the .packagefolder and add specified elements.
20 | # Monkeybrain uv run mb init.files will create this, otherwise it will simply be empty.
21 | package_folder_file.seek(0)
22 | for _line in reversed( package_folder_file.readlines() ):
23 | line = _line.strip()
24 | if not line: continue # skip empty lines
25 | if line.startswith("#"): continue # skip comments
26 | try:
27 | enved_line = re.sub(r"\$\{([^}]+)\}", replace_var, line)
28 | except KeyError:
29 | continue
30 |
31 | if enved_line in path: continue
32 |
33 | # ok, now insert.
34 | path.insert(0, enved_line )
35 |
36 |
37 | _setup_path_from_packagefolder()
38 | del _setup_path_from_packagefolder
39 |
40 | for module_name in dir( __surely_not_even_close_to_sys ):
41 | # If we would just import *, we would not import all modules but only ones not preficed with _
42 | locals()[ module_name ] = getattr( __surely_not_even_close_to_sys, module_name )
43 |
44 | # Some cleanup.
45 | del __surely_not_even_close_to_sys
--------------------------------------------------------------------------------
/src/tdpTauCeti/tweenerTest.py:
--------------------------------------------------------------------------------
1 |
2 | '''Info Header Start
3 | Name : tweenerTest
4 | Author : Wieland PlusPlusOne@AMB-ZEPH15
5 | Saveorigin : TauCeti_PresetSystem.toe
6 | Saveversion : 2023.12000
7 | Info Header End'''
8 |
9 | # Imports
10 | from asyncio import sleep
11 | from typing import cast, Union, TYPE_CHECKING, Any
12 |
13 | # Recommend using the TYPE_CHECKING route here
14 | if TYPE_CHECKING:
15 | from TauCeti.Tweener.extTweener import extTweener
16 | else:
17 | extTweener = Any
18 |
19 | # Typing Definitions
20 |
21 | class TestParDef:
22 | Float1: Par
23 | Float2: Par
24 |
25 | class TestComp:
26 | par : TestParDef
27 |
28 | tweener = cast( extTweener, op("Tweener") )
29 | parComp = cast( Union[TestComp, COMP], op("parameter1") )
30 |
31 | # Test Routine
32 |
33 | async def naiveTweenerTest():
34 | parComp.par.Float1.val = 0
35 | parComp.par.Float2.val = 0
36 | # Test awaitability
37 |
38 | await tweener.AbsoluteTween(
39 | parComp.par.Float1,
40 | 1,
41 | 1
42 | ).Resolve()
43 |
44 | assert parComp.par.Float1.eval() == 1
45 |
46 | await tweener.RelativeTween(
47 | parComp.par.Float2,
48 | 1,
49 | 1
50 | ).Resolve()
51 |
52 | assert parComp.par.Float2.eval() == 1
53 |
54 |
55 | tweener.AbsoluteTweens(
56 | [
57 | { "par" : parComp.par.Float1, "end" : 0},
58 | { "par" : parComp.par.Float2, "end" : 0, "time" : 2}
59 | ],
60 | time = 1
61 | )
62 | await sleep(2)
63 | assert parComp.par.Float1.eval() == 0 and parComp.par.Float2.eval() == 0
64 |
65 |
66 |
67 | tweener.RelativeTweens(
68 | [
69 | { "par" : parComp.par.Float1, "end" : 1},
70 | { "par" : parComp.par.Float2, "end" : 1, "speed" : 2}
71 | ],
72 | speed = 1
73 | )
74 | await sleep(1)
75 |
76 | assert parComp.par.Float1.eval() == 1 and parComp.par.Float2.eval() == 1
77 |
78 | # Execute Routine
79 |
80 | op("TDAsyncIO").Run( naiveTweenerTest() ) # type: ignore
--------------------------------------------------------------------------------
/src/tdpTauCeti/Tweener/TweenValue.py:
--------------------------------------------------------------------------------
1 |
2 |
3 | '''Info Header Start
4 | Name : tween_value
5 | Author : Wieland PlusPlusOne@AMB-ZEPH15
6 | Saveorigin : TauCeti_PresetSystem.toe
7 | Saveversion : 2023.12000
8 | Info Header End'''
9 | from td import *
10 | if __package__ is None:
11 | import Exceptions
12 | else:
13 | from . import Exceptions
14 |
15 | from functools import lru_cache
16 | from typing import Union
17 | from abc import abstractmethod, ABCMeta
18 | from enum import Enum
19 |
20 | # Where does this come from?
21 | class ParMode(Enum):
22 | BIND = "BIND"
23 | CONSTANT = "CONSTANT"
24 | EXPORT = "EXPORT"
25 | EXPRESSION = "EXPRESSION"
26 |
27 | par_modes = [parmode.name.upper() for parmode in ParMode._value2member_map_.values()]
28 | TweenableValue = Union[int, float]
29 |
30 |
31 | @lru_cache(maxsize=None)
32 | def getParamaterTypecast(parameter):
33 | if parameter.style == "Pulse": return bool
34 | if parameter.style == "Toggle": return lambda value: bool(float(value))
35 | return type( parameter.val )
36 |
37 | class _tweenValue(metaclass = ABCMeta):
38 | @abstractmethod
39 | def eval(self) -> float:
40 | pass
41 |
42 | @abstractmethod
43 | def assignToPar(self, parameter:Par):
44 | pass
45 |
46 | class ExpressionValue( _tweenValue ):
47 | def __init__(self, parameter:Par , expression_string:str):
48 | self.expressionString = expression_string
49 | self.expressionFunction = lambda : parameter.owner.evalExpression( expression_string )
50 |
51 | def eval(self):
52 | return self.expressionFunction()
53 |
54 | def assignToPar(self, parameter:Par):
55 | parameter.mode = ParMode.EXPRESSION
56 | parameter.expr = self.expressionString
57 |
58 |
59 | class StaticValue( _tweenValue ):
60 | def __init__(self, parameter:Par, value:TweenableValue):
61 | self.value = getParamaterTypecast( parameter )(value)
62 |
63 | def eval(self):
64 | return self.value
65 |
66 | def assignToPar(self, parameter:Par):
67 | parameter.val = self.eval()
68 |
69 |
70 |
71 | @lru_cache(None)
72 | def stringifyParmode( mode:ParMode ):
73 | if isinstance(mode, ParMode): return mode.name.upper()
74 | if isinstance(mode, str) and mode.upper() in par_modes: return mode.upper()
75 | raise Exceptions.InvalidParMode
76 |
77 | def tweenValueFromParameter( parameter:Par ):
78 | if parameter.mode.name =="EXPRESSION": return ExpressionValue( parameter, parameter.expr ) # type: ignore WTF, why does it think the classInstanciator takes 2 arguments?
79 | return StaticValue( parameter, parameter.eval() ) # type: ignore
80 |
81 | def tweenValueFromArguments( parameter:Par, mode:Union[str, ParMode], expression:Union[str, None], value:TweenableValue):
82 | if stringifyParmode(mode) =="EXPRESSION" and expression: return ExpressionValue( parameter, expression ) # type: ignore
83 | return StaticValue( parameter, value ) # type: ignore
84 |
85 |
86 |
--------------------------------------------------------------------------------
/src/tdpTauCeti/PresetDashboard/extDashboard.py:
--------------------------------------------------------------------------------
1 | '''Info Header Start
2 | Name : extDashboard
3 | Author : Wieland PlusPlusOne@AMB-ZEPH15
4 | Saveorigin : TauCeti_PresetSystem.toe
5 | Saveversion : 2023.12480
6 | Info Header End'''
7 |
8 |
9 | import uuid
10 |
11 | class extDashboard:
12 |
13 | def __init__(self, ownerComp):
14 | # The component to which this extension is attached
15 | self.ownerComp = ownerComp
16 | self.selected_cell = (-1, -1)
17 | self.selected_preset = ''
18 | self.engine = self.ownerComp.par.Manager.eval
19 | self.ownerComp.par.Selectedbank = self.bank_comp
20 |
21 | @property
22 | def Banks(self):
23 | return self.ownerComp.op("repo_maker").Repo
24 |
25 | @property
26 | def bankParDefinition(self):
27 | return tdu.ParMenu(
28 | [child for child in self.Banks.findChildren(depth = 1, type = COMP)],
29 | [child.name for child in self.Banks.findChildren(depth = 1, type = COMP)]
30 | )
31 |
32 | @property
33 | def bank_comp(self):
34 | return op(self.ownerComp.par.Selectedbank.eval()) or self.Banks.findChildren(depth=1)[0]
35 |
36 | @property
37 | def map_table(self):
38 | return self.bank_comp.op("data")
39 |
40 | def New_Bank(self):
41 | new_bank = self.Banks.copy( self.ownerComp.op("prefab_bank") )
42 | new_bank.op("data").par.cols = self.ownerComp.par.Defaultbanksize1.eval()
43 | new_bank.op("data").par.rows = self.ownerComp.par.Defaultbanksize2.eval()
44 | return new_bank
45 |
46 | def Get_Engine(self):
47 | return self.ownerComp.par.Manager.eval()
48 |
49 | def Recall_Preset( self, preset, time ):
50 | self.Get_Engine().Recall_Preset( preset, time)
51 |
52 | def Delete_Preset(self, preset):
53 | self.Get_Engine().Remove_Preset( preset )
54 | self.map_table.text = self.map_table.text.replace(preset, "")
55 |
56 | def Start_Map(self, row, col):
57 | self.selected_cell = (row, col)
58 | selector = self.ownerComp.op('selector')
59 | selector.par.display = True
60 | selector.par.Page = 0
61 | selector.par.Searchterm = ""
62 |
63 | def Do_Map(self, value):
64 | self.map_table[ self.selected_cell ].val = value
65 | self.ownerComp.op('selector').par.display = False
66 | return
67 |
68 |
69 | def Record(self, row, col):
70 | index = str( uuid.uuid1() ).split('-')[0]
71 | tag = self.ownerComp.par.Tag.eval()
72 | self.map_table[row, col].val = self.Get_Engine().Store_Preset( index, tag = tag, preset_id = self.map_table[row, col].val)
73 | return
74 |
75 | def Start_Rename(self, preset, row, col):
76 | if not preset: return
77 | self.ownerComp.op("prompt_overlay").par.display = True
78 | self.selected_cell = (row, col)
79 | self.selected_preset = preset
80 |
81 | def Do_Rename(self, new_name):
82 | new_name = self.Get_Engine().Rename(self.selected_preset, new_name)
83 | self.ownerComp.op("prompt_overlay").par.display = False
84 |
85 | def Rename( self, preset_id, value):
86 | new_name = self.Get_Engine().Rename(preset_id, value)
87 |
88 | def check_bank(self):
89 | if self.ownerComp.par.Selectedbank.eval(): return
90 | repo = self.ownerComp.op("repository_comp").Get_Repository()
91 | children = repo.findChildren( depth = 1, type = COMP)
92 | if children:
93 | self.ownerComp.par.Selectedbank = children[0]
94 | return
95 | self.ownerComp.par.Selectedbank = self.New_Bank().path
96 |
--------------------------------------------------------------------------------
/src/tdpTauCeti/PresetCuelist/extCuelist.py:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | '''Info Header Start
6 | Name : extCuelist
7 | Author : Wieland PlusPlusOne@AMB-ZEPH15
8 | Saveorigin : TauCeti_PresetSystem.toe
9 | Saveversion : 2023.12480
10 | Info Header End'''
11 | class extCuelist:
12 | """
13 | extCuelist description
14 | """
15 | def __init__(self, ownerComp):
16 | # The component to which this extension is attached
17 | self.ownerComp = ownerComp
18 | self.data = self.ownerComp.op("dictParser")
19 | #self.cue_table = self.ownerComp.op('cuelist')
20 |
21 | # if self.ownerComp.par.Manager.eval() is not None: self.Recall_Cue( "", time = 0 )
22 |
23 | @property
24 | def selected_cue(self):
25 | return self.ownerComp.par.Selectedcue.eval()
26 |
27 | @property
28 | def loop(self):
29 | return self.ownerComp.par.Loop.eval()
30 |
31 | def get_engine(self):
32 | return self.ownerComp.par.Manager.eval()
33 |
34 |
35 |
36 | def Reorder(self, sourceIndex, targetIndex):
37 | if sourceIndex > targetIndex:
38 | nextIndex = targetIndex
39 | prevIndex = targetIndex - 1
40 | else :
41 | nextIndex = targetIndex + 1
42 | prevIndex = targetIndex
43 |
44 | nextItem = self.data.GetItem(
45 | min( nextIndex , self.data.NumItems ),
46 | rows = "id"
47 | )
48 |
49 | prevItem = self.data.GetItem(
50 | max(1, prevIndex ),
51 | rows = "id"
52 | )
53 | debug( prevItem )
54 | prev_index = float(prevItem["id"]) * bool(prevItem["_tableIndex"] != 1)
55 | next_index = float(nextItem["id"]) + 2 * bool(nextItem["_tableIndex"] == self.data.NumItems)
56 |
57 |
58 | new_id = f"{(next_index + prev_index) / 2:.2f}"
59 |
60 | self.data.UpdateItem(sourceIndex, {
61 | **self.data.GetItem(sourceIndex),
62 | "id" : new_id}
63 | )
64 | self._sort()
65 |
66 | return
67 |
68 | def _sort(self):
69 | self.data.SortTable( key = lambda row: float(row[0]))
70 | self.Select_Next_Cue()
71 |
72 | def Append_Cue(self, preset, time = 5):
73 | self.data.AddItem({
74 | "id" : math.floor(
75 | float(self.data.GetItem(-1)["id"])
76 | ) + 1 if self.data.NumItems else "1",
77 | "preset" : preset,
78 | "time" : time
79 | })
80 | self._sort()
81 |
82 |
83 | def Record_Cue(self, preset, time = 5):
84 | self.Append_Cue(
85 | self.get_engine().Store_Preset( preset ),
86 | time=time
87 | )
88 |
89 | def Delete_Cue(self, id):
90 | self.data.DeleteItem( id )
91 | self.Select_Next_Cue()
92 |
93 | def Select_Cue(self, id):
94 | self.ownerComp.par.Selectedcue.val = id
95 | return
96 |
97 | def Select_Next_Cue(self):
98 | if not self.data.NumItems: return
99 | nextCueIndex = self.ownerComp.par.Activecue.menuIndex + 1
100 | if self.loop: nextCueIndex %= len( self.ownerComp.par.Selectedcue.menuNames )
101 | self.Select_Cue(
102 | self.ownerComp.par.Selectedcue.menuNames[ nextCueIndex ]
103 | )
104 |
105 |
106 | def Recall_Cue(self, cue_id, time = None):
107 | cueData = self.data.GetItem( cue_id )
108 |
109 | self.get_engine().Recall_Preset(cueData["preset"], time or cueData["time"])
110 |
111 | self.ownerComp.par.Activecue.val = cueData["id"]
112 | self.Select_Next_Cue()
113 |
114 | self.ownerComp.op("callbackManager").Do_Callback(
115 | "onGo",
116 | cue_id,
117 | self.selected_cue,
118 | cueData["preset"],
119 | self.get_engine().Get_Preset_Name(cueData["preset"]),
120 | cueData["time"]
121 | )
122 |
123 | eventId = self.ownerComp.op("event1").createEvent(
124 | attackTime = cueData["time"]
125 | )
126 | self.ownerComp.op("recalled_cues").appendRow(
127 | [eventId, cue_id]
128 | )
129 |
130 | def _finalize_cue(self, eventId):
131 | cueId = self.ownerComp.op("recalled_cues")[eventId, "cueId"].val
132 | cueData = self.data.GetItem(cueId)
133 | presetId = cueData["preset"]
134 | presetName = self.get_engine().Get_Preset_Name(presetId)
135 |
136 | self.ownerComp.op("callbackManager").Do_Callback(
137 | "onDone",
138 | cueId,
139 | presetId,
140 | presetName
141 | )
142 |
143 | def Update_Cue(self, id, dataset:dict):
144 | self.data.UpdateItem(id, {
145 | **self.data.GetItem(id),
146 | **dataset}
147 | )
148 |
149 | def Assign_Preset(self, id, preset):
150 | self.Update_Cue(id, {"preset" : preset})
151 |
152 | def Assign_Time(self, id, time):
153 | self.Update_Cue(id, {"time" : time})
154 |
155 | def Assign_Id(self, id, newId):
156 | self.Update_Cue(id, {"id" : newId})
157 | self.data.SortTable( key = lambda row: float(row[0]))
158 | self.Select_Next_Cue()
159 |
160 | def Go(self):
161 | self.Recall_Cue(self.selected_cue)
162 |
163 |
--------------------------------------------------------------------------------
/src/tdpTauCeti/Tweener/TweenObject.py:
--------------------------------------------------------------------------------
1 |
2 |
3 | '''Info Header Start
4 | Name : fade
5 | Author : Wieland PlusPlusOne@AMB-ZEPH15
6 | Saveorigin : TauCeti_PresetSystem.toe
7 | Saveversion : 2023.12000
8 | Info Header End'''
9 |
10 | from td import *
11 | if __package__ is None:
12 | import TweenValue
13 | else:
14 | from . import TweenValue
15 |
16 |
17 |
18 | from dataclasses import dataclass, field
19 | from asyncio import sleep as asyncSleep
20 |
21 | from typing import Callable, List, Union, Hashable
22 | from abc import ABCMeta, abstractmethod
23 |
24 | @dataclass
25 | class _tween(metaclass = ABCMeta):
26 | """
27 | A tween component being used to programatically move between parameter states.
28 | Cntrolled via the TweenerCOMP Extension.
29 | """
30 | parameter : Par
31 | TweenerCOMP : COMP
32 | time : float
33 | startValue : TweenValue._tweenValue
34 | targetValue : TweenValue._tweenValue
35 | interpolation : str = "LinearInterpolation"
36 | id : Hashable = ""
37 | _currentStep : float = field( default= 0, repr=False)
38 |
39 | Active : bool = True
40 | OnDoneCallbacks : List[Callable] = field( default_factory = list)
41 |
42 | @abstractmethod
43 | def Step(self, stepsize:Union[float, None] = None):
44 | pass
45 |
46 | @abstractmethod
47 | def Finish(self):
48 | pass
49 |
50 |
51 | def _incrementStep(self, stepsize:Union[float, None]):
52 | stepsize = stepsize or absTime.stepSeconds
53 | self._currentStep += stepsize
54 | #self.current_step = tdu.clamp( self.current_step + stepsize, 0, self.time )
55 |
56 | @property
57 | def done(self):
58 | return self._currentStep >= self.time
59 |
60 | @property
61 | def Done(self):
62 | """ True if the Tween is done and will not continue. """
63 | return self.done
64 |
65 | @property
66 | def Remaining(self) -> float:
67 | """ Returns the remaining seconds of the tween until completion. """
68 | return self.time - self._currentStep
69 |
70 | def Pause(self):
71 | """ Halts the continuation of the tween untils resumed."""
72 | self.Active = False
73 |
74 | def Resume(self):
75 | """ Continues to tween."""
76 | self.Active = True
77 |
78 | def Stop(self):
79 | """ Tops the tween right where it is and removes it. """
80 | self.TweenerCOMP.StopTween(self) # type: ignore Circular Refference, so this has to stay.
81 |
82 |
83 | def Reset(self):
84 | """ Return to to the initital value and clean up."""
85 | self.targetValue = self.startValue
86 | self.Finish()
87 |
88 | def Reverse(self):
89 | """ Changes target and startingpoint mid flight. """
90 | _startValue = self.startValue
91 | self.startValue = self.targetValue
92 | self.targetValue = _startValue
93 |
94 | def Delay(self, offset:float):
95 | """ Reduces the current ime by offset. When at 0, this results in a delay, when above 0 will result in a stepback. """
96 | self._currentStep -= abs(offset)
97 |
98 |
99 | async def Resolve(self):
100 | """ Async Awaitable for finisshing up."""
101 | while not self.done:
102 | await asyncSleep(0)
103 | return
104 |
105 |
106 | class fade( _tween ):
107 | def Step(self, stepsize = None):
108 | self._incrementStep(stepsize)
109 |
110 | curves = me.parent.TWEENER.op("curves_repo").Repo # type: ignore Until I have proper package management this has to be taken for granted.
111 | # why do I have to do that? This feels strange.
112 | # is this because of my hack?
113 |
114 | curve_value = curves.GetValue( self._currentStep, self.time, self.interpolation )
115 | start_evaluated:float = self.startValue.eval()
116 | target_evaluated:float = self.targetValue.eval()
117 | difference = target_evaluated - start_evaluated
118 | new_value = start_evaluated + difference * curve_value
119 | self.parameter.val = new_value
120 | if self.done: self.Finish()
121 |
122 | def Finish(self):
123 | self.targetValue.assignToPar( self.parameter )
124 | for callback in self.OnDoneCallbacks:
125 | callback( self )
126 |
127 |
128 | class endsnap( _tween ):
129 |
130 | def Step(self, stepsize = None):
131 |
132 | self._incrementStep(stepsize)
133 | if self.done: self.Finish()
134 |
135 | def Finish(self):
136 | self.targetValue.assignToPar( self.parameter )
137 | for callback in self.OnDoneCallbacks:
138 | callback( self )
139 |
140 |
141 | class startsnap( _tween ):
142 |
143 | def Step(self, stepsize = None):
144 | self.targetValue.assignToPar( self.parameter )
145 | self._incrementStep(stepsize)
146 | if self.done: self.Finish()
147 |
148 | def Finish(self):
149 | for callback in self.OnDoneCallbacks:
150 | callback( self )
151 |
--------------------------------------------------------------------------------
/src/tdpTauCeti/PresetManager/extParStack.py:
--------------------------------------------------------------------------------
1 |
2 |
3 | '''Info Header Start
4 | Name : extParStack
5 | Author : Wieland PlusPlusOne@AMB-ZEPH15
6 | Saveorigin : TauCeti_PresetSystem.toe
7 | Saveversion : 2023.12000
8 | Info Header End'''
9 |
10 |
11 |
12 | from td import *
13 | if __package__:
14 | from . import ParUtils
15 | else:
16 | import ParUtils
17 |
18 | from typing import TypedDict, Union, Any, Literal, List, TYPE_CHECKING
19 |
20 | class StackElement(TypedDict):
21 | Type : Literal["fade", "startsnap", "endsnap"]
22 | Preload : bool
23 | Value : Union[Any, None]
24 | Parname : str
25 | Operator : OP
26 | Mode : Literal["CONSTANT", "EXPRESSION"]
27 | Expression : Union[str, None]
28 |
29 |
30 | class InvalidOperator( Exception):
31 | pass
32 |
33 | class extParStack:
34 | """
35 | extParStack description
36 | """
37 | def __init__(self, ownerComp):
38 | # The component to which this extension is attached
39 | self.ownerComp = ownerComp
40 |
41 |
42 | self.fadeable = ['Float', 'Int', 'XYZ', 'RGB', 'XY', 'RGBA', 'UV', 'UVW']
43 | self.fade_types = ["fade", "startsnap", "endsnap"]
44 | self.stack_table = self.ownerComp.op('stack_table')
45 |
46 | self.get_par = self.get_par_dict
47 | try:
48 | self.ownerComp.par['x']
49 | except:
50 | self.get_par = self.get_par_attr
51 |
52 | @property
53 | def relation(self):
54 | return self.ownerComp.par.Pathrelation.eval()
55 |
56 | @property
57 | def items(self):
58 | return self.ownerComp.op("Stack_RepoMaker").Repo.seq.Items
59 |
60 | def get_par_attr(self, op_path, par_name):
61 | return getattr( self.get_op_from_path(op_path).par, par_name)
62 |
63 | def get_par_dict(self, op_path, par_name):
64 | return self.get_op_from_path(op_path).par[par_name]
65 |
66 | def get_path(self, operator):
67 |
68 | if self.relation == "Relative":
69 | return self.ownerComp.op("Stack_RepoMaker").Repo.relativePath( operator )
70 | return operator.path
71 |
72 | def get_fade_type(self, par):
73 | if par.style in self.fadeable: return 'fade'
74 | return 'startsnap'
75 |
76 | def get_op_from_path(self, path):
77 | self.ownerComp.par.Oppath = path
78 | targetOperator = self.ownerComp.par.Oppath.eval()#
79 | if targetOperator is None: raise InvalidOperator(f"Operator {path} does not exist!")
80 | return targetOperator
81 |
82 | def Get_Parameter(self, op_path, parameter_name):
83 | return self.get_par( op_path, parameter_name)
84 |
85 | def Add_Comp(self, comp, page_scope = "*"):
86 | custom_page_dict = { page.name : page for page in comp.customPages }
87 | matched_pages = tdu.match( page_scope, list( custom_page_dict.keys() ) )
88 |
89 | for page_key in matched_pages:
90 | for parameter in custom_page_dict[ page_key ]:
91 | self.Add_Par( parameter )
92 |
93 |
94 | def Add_Par(self, parameter, preload = False, fade_type = ""):
95 | for item in self.items:
96 | if item.par.Parameter.eval() == parameter or item.par.Operator.eval() is None:
97 | item_block = item
98 | break
99 | continue
100 | else:
101 | item_block = self.items.insertBlock(0)
102 |
103 | item_block.par.Operator.val = self.get_path(parameter.owner)
104 | item_block.par.Preload.val = preload
105 | item_block.par.Parname.val = parameter.name
106 | item_block.par.Type.val = fade_type if fade_type else self.get_fade_type( parameter )
107 |
108 | def Get_Stack_Element_Dict(self, index) -> StackElement:
109 | block = self.items[index]
110 | parameter = block.par.Parameter.eval()
111 | if parameter is None:
112 | return None
113 | return {
114 | "Type" : block.par.Type.eval(),
115 | "Preload" : block.par.Preload.eval(),
116 | "Value" : ParUtils.parse( parameter ) if (parameter.mode != ParMode.EXPRESSION) else 0,
117 | "Parname" : block.par.Parname.eval(),
118 | "Operator" : block.par.Operator.eval(),
119 | "Mode" : parameter.mode.name,
120 | "Expression": parameter.expr if (parameter.mode == ParMode.EXPRESSION) else None,
121 | }
122 |
123 | def Refresh_Stack(self):
124 | temp_list = self.Get_Stack_Dict_List()
125 | self.Clear_Stack()
126 | for element in temp_list:
127 | if element["par"]: self.Add_Par( element["par"] )
128 | return
129 |
130 | def Get_Stack_Dict_List(self) -> List[StackElement]:
131 | return [ self.Get_Stack_Element_Dict(index) for index in range(0, self.items.numBlocks)]
132 |
133 | def Remove_Row_From_Stack(self, index):
134 | if self.items.numBlocks > 1:
135 | self.items.destroyBlock( index )
136 | else:
137 | block = self.items[0]
138 | block.par.Operator.val = ""
139 | block.par.Parname.val = ""
140 |
141 | def Clear_Stack(self):
142 | self.items.numBlocks = 1
143 | for parameter in self.items[0]:
144 | parameter.reset()
145 |
146 | #parameter.val = parameter.default
147 |
148 | def Change_Preload(self, index):
149 | self.items[index].par.Preload.val = not self.items[index].par.Preload.eval()
150 |
151 | def Change_Fadetype(self, index):
152 | self.items[index].par.Type.menuIndex = (
153 | self.items[index].par.Type.menuIndex+1
154 | ) % len( self.items[index].par.Type.menuNames )
155 |
--------------------------------------------------------------------------------
/src/tdpTauCeti/Tweener/extTweener.py:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 | '''Info Header Start
7 | Name : extTweener
8 | Author : Wieland PlusPlusOne@AMB-ZEPH15
9 | Saveorigin : TauCeti_PresetSystem.toe
10 | Saveversion : 2023.12000
11 | Info Header End'''
12 |
13 | from td import *
14 | # TD specific import shenaningans.
15 | if __package__ is None:
16 | import TweenObject
17 | import TweenValue
18 | import Exceptions
19 | from TweenValue import TweenableValue
20 | else:
21 | from . import TweenObject
22 | from . import TweenValue
23 | from . import Exceptions
24 | from .TweenValue import TweenableValue
25 |
26 | from asyncio import sleep as asyncSleep
27 |
28 | from typing import Callable, Union, Hashable, Dict, List, Literal, Type, TypedDict, NotRequired, cast
29 | from argparse import Namespace
30 |
31 |
32 |
33 |
34 | def _emptyCallback( value:TweenObject._tween ):
35 | pass
36 |
37 | _type = type
38 | PotentialCurves = Union[ str, Literal["s", "LinearInterpolation", "QuadraticEaseIn", "QuadraticEaseOut", "BackEaseIn", "BounceEaseIn"] ]
39 |
40 |
41 |
42 | class AbsoluteTweenDefinition(TypedDict):
43 | par : Par
44 | end : TweenableValue
45 | time : NotRequired[float]
46 | curve : NotRequired[PotentialCurves]
47 | delay : NotRequired[float]
48 | callback : NotRequired[Callable]
49 |
50 | class RelativeeTweenDefinition(TypedDict):
51 | par : Par
52 | end : TweenableValue
53 | speed : NotRequired[float]
54 | curve : NotRequired[PotentialCurves]
55 | delay : NotRequired[float]
56 | callback : NotRequired[Callable]
57 |
58 |
59 | class extTweener:
60 |
61 | def __init__(self, ownerComp):
62 | # The component to which this extension is attached
63 | self.ownerComp = ownerComp
64 | self.Tweens:Dict[int, TweenObject._tween] = {}
65 |
66 | self.Modules = Namespace(
67 | Exceptions = Exceptions
68 | )
69 | self.Constructor = Namespace(
70 | Expression = TweenValue.ExpressionValue,
71 | Static = TweenValue.StaticValue,
72 | FromPar = TweenValue.tweenValueFromParameter
73 | )
74 | self.callback = self.ownerComp.op('callbackManager')
75 |
76 | # Bacwards compatible stuff.
77 | # CLearer naming conventions.
78 |
79 | self.StopFade = self.StopTween
80 | self.getFadeId = self.getTweenId
81 | self.FadeStep = self.TweenStep
82 | self.StopAllFades = self.StopAllTweens
83 |
84 | def getTweenId(self, parameter:Par):
85 | return hash(parameter)
86 |
87 | def TweenStep(self, step_in_ms = None):
88 | """
89 | Progresses all active tweens for the given time.
90 | Should be called from the internal clock but can be also run from an external source if wished.
91 | """
92 | fadesCopy = self.Tweens.copy()
93 | for fade_id, tween_object in fadesCopy.items():
94 | if not tween_object.Active: continue
95 | tween_object.Step(step_in_ms)
96 | if tween_object.done: del self.Tweens[ fade_id ]
97 |
98 |
99 | def AbsoluteTweens(self, listOfTweenDefinition:List[AbsoluteTweenDefinition], curve:PotentialCurves = "s", time = 1) -> List[TweenObject._tween]:
100 | """
101 | Calls AbsoluteTween for each element of the given List of dicts
102 | which needs at least par and end memeber. otional time, curve, delay nd callback
103 | """
104 | return [
105 | self.AbsoluteTween(
106 | tweenDict["par"],
107 | tweenDict["end"],
108 | tweenDict.get("time", time),
109 | curve = tweenDict.get("curve", None) or curve,
110 | delay = tweenDict.get("delay", 0),
111 | callback= tweenDict.get("callback", None) or _emptyCallback,
112 | )
113 | for tweenDict in listOfTweenDefinition
114 | ]
115 |
116 |
117 | def RelativeTweens(self, listOfTweenDefinition : List[RelativeeTweenDefinition], curve:PotentialCurves = "s", speed = 1):
118 | """
119 | Calls AbsoluteTween for each element of the given List of dicts
120 | which needs at least par and end memeber. otional time, curve, delay nd callback
121 | """
122 | return [
123 | self.RelativeTween(
124 | tweenDict["par"],
125 | tweenDict["end"],
126 | tweenDict.get("speed", speed),
127 | curve = tweenDict.get("curve", None) or curve,
128 | delay = tweenDict.get("delay", 0),
129 | callback= tweenDict.get("callback", None) or _emptyCallback,
130 | )
131 | for tweenDict in listOfTweenDefinition
132 | ]
133 |
134 | def AbsoluteTween(self,
135 | parameter:Par,
136 | end:TweenableValue,
137 | time:float,
138 | curve:PotentialCurves = "LinearInterpolation",
139 | delay:float = 0,
140 | callback: Callable = _emptyCallback) -> TweenObject._tween:
141 | """
142 | Creates a tween that will resolve in the defines time.
143 | """
144 | return self.CreateTween(parameter, end, time, curve = curve, delay = delay, callback = callback)
145 |
146 |
147 | def RelativeTween(self,
148 | parameter:Par,
149 | end:TweenableValue,
150 | speed:float,
151 | curve:PotentialCurves = "LinearInterpolation",
152 | delay:float = 0,
153 | callback: Callable = _emptyCallback) -> TweenObject._tween:
154 | """
155 | Creates a tween that will resolve with the given peed ( value increment per seconds )
156 | """
157 | difference = abs(end - parameter.eval())
158 | time = difference / speed
159 | return self.CreateTween(parameter, end, time, curve = curve, delay = delay, callback = callback)
160 |
161 |
162 | def CreateTween(self,parameter,
163 | end :TweenableValue,
164 | time :float,
165 | type :Literal["fade", "startsnap", "endsnap"] = 'fade',
166 | curve :PotentialCurves = "LinearInterpolation",
167 | mode :Union[str, ParMode]= 'CONSTANT',
168 | expression :Union[str, None] = None,
169 | delay :float = 0.0,
170 | callback :Callable = _emptyCallback,
171 | id :Hashable = '', ) -> TweenObject._tween:
172 | """
173 | Creates the given tween object based on the definition.
174 | """
175 | if not isinstance( parameter, Par):
176 | raise Exceptions.TargetIsNotParameter(f"Invalid Parameterobject {parameter}")
177 |
178 |
179 | if isinstance( parameter.default, (int, float)):
180 | end = float( end ) # If we get a str value (or similiar) as the target value, we can make sure that we are fading non the less. Not perfect :()
181 |
182 |
183 | targetValue :TweenValue._tweenValue = TweenValue.tweenValueFromArguments( parameter, mode, expression, end )
184 | startValue :TweenValue._tweenValue = TweenValue.tweenValueFromParameter( parameter )
185 |
186 | tweenClass: Type[TweenObject._tween] = getattr( TweenObject, type, TweenObject.startsnap )
187 |
188 | tweenOject = tweenClass(
189 | parameter,
190 | self.ownerComp,
191 | time,
192 | startValue,
193 | targetValue,
194 | interpolation = curve,
195 | id = id
196 | )
197 | tweenOject.OnDoneCallbacks.append( callback or _emptyCallback )
198 |
199 | tweenOject.Delay( delay )
200 | self.Tweens[self.getTweenId( parameter )] = tweenOject
201 |
202 | tweenOject.Step( stepsize = 0 )
203 |
204 | return tweenOject
205 |
206 |
207 | def StopTween(self, target: Union[Par, TweenObject._tween]):
208 | """ Stops a tween by the tween object or the parameter wich it points to. """
209 | if isinstance( target, TweenObject._tween):
210 | target = target.parameter
211 |
212 | del self.Tweens[self.getTweenId(target)]
213 |
214 | def StopAllTweens(self):
215 | """ Stops all tweens."""
216 | self.Tweens = {}
217 |
218 | def ClearFades(self):
219 | self.Tweens.clear()
220 |
221 | def PrintFades(self):
222 | raise DeprecationWarning("Yeah, please dont.")
223 |
224 | def TweensByOp(self, targetOp:OP):
225 | """ Return all Tweens filtered by the given operator. """
226 | return {
227 | key : tween for key, tween in self.Tweens.items() if tween.parameter.owner == targetOp
228 | }
--------------------------------------------------------------------------------
/readme.md:
--------------------------------------------------------------------------------
1 | # TauCeti PresetSystem + Tweener
2 | Highly customisable and setup agnostic system for presets management in TouchDesigner
3 |
4 | ## Installation
5 |
6 | You can download standalone ToxFiles from the the dist-folders of the repository. Choose the specific branch for the correct version.
7 |
8 | ### PIP Installation
9 |
10 | This project implements ideas and features of TD_Package, a proposal by PlusPlusOne on how to create shareable components as python packages. This means, you can install this project via PIP and gain access to automated updates and code compleation.
11 |
12 | All modules (PresetManager and Tweener) implement the ToxFile member. Refference the ToxFile in the external-parameter of any COMP and force a reload.
13 |
14 | ```mod.tdpTauCeti.Tweener.ToxFile```
15 | will return the path to the ToxFile.
16 |
17 | For easy code compleation in your IDE use the exported Typying member of the module.
18 | ```python
19 | from tdpTauCeti.Tweener import Typing as TweenerTyping
20 |
21 | tweener_comp:TweenerTyping = op("Tweener")
22 | ```
23 | Typing is only importing and evaluating during TYPE_CHECKING and evaluates to NONE during runtime.
24 |
25 |
26 |
27 | ## Note on Versions
28 | This project uses SemVer. All releases of a major version will be fully compatible. Minor releases will only add new features. Patches should not change behaviour.
29 |
30 | ## Contributing
31 | This project is released under the GPL-3.0 license and part of PlusPlusOne FOSS projects.
32 | Feel free to open pull requests or open issues.
33 |
34 | ## Tweener
35 | The tweener is the heart of the whole system and a great component in itself. It allows for programmatic creation and management of Tweens, transitions between states of a parameter. Be it Expression or Static, fadeable and non-fadeable parameters, the Tweener should be able to handle them.
36 |
37 | __ There should only be one tweener per project. Use GlobalOP-Shortcuts or other means of dependency management __
38 |
39 |
40 | The tweener offers several ways of creating tweens. All do wrap arround CreateTween as the most important method.
41 | ```python
42 | op("Tweener").AbsoluteTween(
43 | parameter : Par,
44 | targetValue : any,
45 | time : float,
46 | curve : str = "LinearInterpolation",
47 | delay : float = 0,
48 | callback : Callable = _emptyCallback ) -> TweenObject
49 | # Creates a tween that will resolve in the defines time.
50 |
51 | op("Tweener").RelativeTween(
52 | parameter:Par,
53 | targetValue:any,
54 | speed:float,
55 | curve:str = "LinearInterpolation",
56 | delay:float = 0,
57 | callback: Callable = _emptyCallback) -> TweenObject
58 | # Creates a Tween that will resolve with the given speed in distance per seconds.
59 |
60 | ```
61 |
62 | Both functions are clearly aimed at fadeable, meaning numeric, parameters. They will fail for non-numeric values.
63 |
64 | For nun-numeric parameters the underlying CreateTween is required.
65 | ```python
66 | op("Tweener"):CreateTween(
67 | parameter :Par,
68 | targetValue :float,
69 | time :float,
70 | type :Literal["fade", "startsnap", "endsnap"] = 'fade',
71 | curve :str = "LinearInterpolation",
72 | mode :Union[str, ParMode]= 'CONSTANT',
73 | expression :str = None,
74 | delay :float = 0.0,
75 | callback :Callable = _emptyCallback,
76 | id :Hashable = '', ) -> TweenObject:
77 | # Creates a Tween for the given paramaters.
78 | # If mode is set to ParMode.EXPRESSION, the targetValue will be ignored and expression wil be used instead.
79 | ```
80 |
81 | calback is a function that takes a single arguments in form of the TweenObject.
82 |
83 | The TweenObject has the following attributes and methods:
84 |
85 | ```python
86 | Active : bool # If False, the tween will not be continued until Active is back to True
87 | OnDoneCallbacks : List[Callable] # A list of callales that will be executed once the tween is done.
88 | Done : bool # True if the Tween is done.
89 | Remaining : float # seconds left unti complition.
90 |
91 | Pause() # Halts the continuation of the tween untils resumed.
92 | Resume() # Continues the tween.
93 | Stop() # Stops the tween right where it is and removes it.
94 | Reset() # Reverses all changes done by the tween and stops it.
95 | Reverse() # Changes target and startingpoint mid flight.
96 | Delay(offset:float) # Reduces the current ime by offset. When at 0, this results in a delay, when above 0 will result in a stepback.
97 |
98 | Resolve() # In async context, await the compleation of the tween, then conitnue.
99 | ```
100 |
101 |
102 | The Tweener itself also offers some additional utility functions.
103 | ```python
104 | StopTween( target: Union[Par, TweenObject._tween]) # Stops a tween by the tween object or the parameter wich it points to.
105 | StopAllFades() # Does exactly what it sais it does. Should be named StopAllTweens though.
106 | Tweens : Dict[int, TweenObject] # A dict containing all tweens, keyed by an unique ID per parameter.
107 | TweensByOp( targetOpartor:OP) # Returns a list of all tweens that are running and pointing at a prameter of the given operator.
108 | ```
109 |
110 | ### Example
111 | Fading in a levelTOP in 1 second.
112 | ```python
113 | op("Tweener").AbsoluteTween( op("level1").par.opacity, 1, 1)
114 | ```
115 |
116 | Awaiting the completion of a tween.
117 | ```python
118 | await op("Tweener").AbsoluteTween( op("level1").par.opacity, 1, 1).Resolve()
119 | ```
120 |
121 | Transition from current value to a refference of an LFO.
122 | ```python
123 | op("Tweener").CreateTween(
124 | op("level1").par.opacity, None, 1,
125 | mode = ParMode.EXPRESSION,
126 | expr = "op('lfo1')['chan1']"
127 | )
128 | ```
129 |
130 | A pretty destructive tween.
131 | ```python
132 | def callback( tweenObject ):
133 | tweenObject.Paramater.owner.destroy()
134 |
135 | tweenObject = op("Tweener").AbsoluteTween( op("level1").par.opacity, 1, 1)
136 | tweenObject.OnDoneCallbacks.append( callback )
137 | ```
138 | ## PresetManager
139 | The presetmanager allows to store and recall state of any arbitrary parameters.
140 |
141 | Most operations will use the stack, which is a collection of parameters. To add any parameter to the stack, activate the viewer and add drop the parameter right in.
142 |
143 | This video contains most information required for the operation:
144 | https://www.youtube.com/watch?v=SSNvsvrnifI
145 |
146 | ### DataRepository
147 | The presetmanager holds all data in so called Repositories: Components that only hold data and do not enact any functionality. These components can be placed outside of the PresetManager, allowing for a seperation of the PresetManager and the dataset, allowing for super easy updates or transition between environments.
148 |
149 | ### Fademodes
150 | There are three fademodes.
151 | - Startsnap: Will set the value in 0 seconds when the preset gets recalled.
152 | - Endsnap: Will set the vaue in 0 seconds once the transition to the new preset is done.
153 | - Fade: Smoothly transition between states. Only for numeric parameters.
154 |
155 | ### Preloading
156 | Marks the parameter to be preloadable. A call to the ```Preload( preset_id )``` method of the presetManager will set it to the stored value witout triggering any transition or non marked parameters.
157 |
158 | This could be used to set colorvalue before fading in.
159 |
160 | ### Push
161 | Pushing allows to send the current stack to all presets stored, updating them with default values.
162 |
163 | ### Python API
164 | The manager can be controlled via an extensive python API. The most important ones of course are
165 | ```python
166 | Store_Preset( name:str, tag = '',preset_id = "") -> str:
167 | # Stores a preset with the given parameters and returns the preset_id.
168 | # Not that name and id are different things. The name is mutable and only a user-facing representation.
169 | # A name can containg spaces and more and can be change.
170 | # The ID is static and is required to refference a preset.
171 | # Depending on the selected mode the id will be either completly random or based on the name
172 | # passed to the method.
173 |
174 | Recall_Preset( preset_id:str, time:float, curve = "s", load_stack = False):
175 | # Recalls the preset in the given time.
176 | # Load Stack will recall the parameters and settings of the preset and store them in to the stack.
177 |
178 |
179 | Push_Stack_To_Presets( preset_id:str)
180 | # Saves all values of parameters currently on the stack
181 | # that are not present.
182 |
183 | Rename( preset_id:str, new_name:str)
184 | # Renames the preset but DOES NOT CHANGE THE ID!
185 | ```
186 |
187 | To be added:
188 | - Parameter
--------------------------------------------------------------------------------
/src/tdpTauCeti/PresetManager/extTauCetiManager.py:
--------------------------------------------------------------------------------
1 |
2 |
3 | '''Info Header Start
4 | Name : extTauCetiManager
5 | Author : Wieland PlusPlusOne@AMB-ZEPH15
6 | Saveorigin : TauCeti_PresetSystem.toe
7 | Saveversion : 2023.12480
8 | Info Header End'''
9 |
10 | TDFunctions = op.TDModules.mod.TDFunctions
11 | import uuid
12 | from .extParStack import InvalidOperator
13 | from typing import Literal, Union
14 |
15 | from typing import TYPE_CHECKING, Any
16 | from td import *
17 |
18 | from copy import copy
19 |
20 | if TYPE_CHECKING:
21 | from TauCeti.Tweener.extTweener import extTweener
22 | else:
23 | extTweener = Any
24 |
25 | def snakeCaseToCamelcase( classObject ):
26 | import inspect
27 | from optparse import OptionParser
28 | for methodName, methodObject in inspect.getmembers(OptionParser, predicate=inspect.isfunction) :
29 | if methodName[0].isupper():
30 | setattr(
31 | classObject,
32 | "".join( word.capitalize() for word in methodName.split("_")),
33 | methodObject
34 | )
35 |
36 | # This also is a testbench and will be implemented in a third party package.
37 | from os import environ
38 | from pathlib import Path
39 | def ensure_external(filepath, opshortcut, root_comp = root):
40 |
41 | if (_potentialy:= getattr(op, opshortcut, None)) is not None:
42 | return _potentialy
43 |
44 | current_comp = root_comp
45 | for path_element in environ.get("ENSURE_UTILITY_PATH", "utils").strip("/ ").split("/"):
46 | current_comp = current_comp.op( path_element ) or current_comp.create( baseCOMP, path_element)
47 |
48 | newly_loaded = current_comp.loadTox(filepath)
49 | newly_loaded.name = opshortcut
50 | newly_loaded.par.opshortcut.val = opshortcut
51 | newly_loaded.par.externaltox.val = Path(filepath).relative_to( Path(".").absolute() )
52 | newly_loaded.par.enableexternaltox.val = True
53 | newly_loaded.par.savebackup.val = False
54 | newly_loaded.par.reloadcustom.val = False
55 | newly_loaded.par.reloadbuiltin.val = False
56 | newly_loaded.par.enableexternaltoxpulse.pulse()
57 |
58 | return newly_loaded
59 |
60 |
61 | class PresetDoesNotExist(Exception):
62 | pass
63 |
64 | class extTauCetiManager:
65 |
66 | def __init__(self, ownerComp):
67 | # The component to which this extension is attached
68 | self.ownerComp = ownerComp
69 | # self.stack = self.ownerComp.ext.extParStack # ????
70 | # self.tweener = self.ownerComp.op('olib_dependancy').Get_Component()
71 | try:
72 | from TauCeti.Tweener import ToxFile as TweenerToxFile
73 | self.tweener:extTweener = ensure_external(TweenerToxFile, "TAUCETI_TWEENER")
74 | except ModuleNotFoundError:
75 | self.tweener:extTweener = self.ownerComp.op("remote_dependency").GetGlobalComponent()
76 | # We will use this as a fallback still for folks not using state of the art packagaging technology
77 | # brought to you in 3D
78 |
79 | self.preview:TOP = self.ownerComp.op("previews")
80 | self.logger = self.ownerComp.op("logger")
81 | self.prefab = self.ownerComp.op("emptyPreset")
82 | self.Record_Preset = self.Store_Preset
83 | self.PresetDoesNotExist = PresetDoesNotExist
84 | snakeCaseToCamelcase( self )
85 |
86 | @property
87 | def stack(self):
88 | return self.ownerComp
89 |
90 | @property
91 | def preset_folder(self):
92 | return self.ownerComp.op("Presetfolder_RepoMaker").Repo
93 |
94 | def Find_Presets(self, name:str="", tag:str="") -> list[str]:
95 | """
96 | Returns a listpreset_ids of presets given the defined parameters.
97 | """
98 | return_values = []
99 | for child in self.preset_folder.findChildren(depth = 1):
100 | if name and child.par.Name.eval() != name: continue
101 | if tag and child.par.Tag.eval() != name: continue
102 | return_values.append( child.name )
103 | return return_values
104 |
105 | def Export_Presets(self, path:str):
106 | """
107 | Save the preset as a TOX for the given path.
108 | """
109 | self.preset_folder.save( path, createFolders = True )
110 |
111 | def Import_Presets(self, path:str):
112 | """
113 | Load a TOX as the external presets.
114 | """
115 | self.preset_folder.par.externaltox = path
116 | self.preset_folder.par.reinitnet.pulse()
117 | self.preset_folder.par.externaltox = ""
118 |
119 | def store_prev(self, prefab):
120 | prefab.op("preview").par.top = self.ownerComp.op("preview")
121 | prefab.op("preview").bypass = False
122 | prefab.op("preview").lock = False
123 | prefab.op("preview").bypass = not self.ownerComp.par.Storepreviews.eval()
124 | prefab.op("preview").lock = self.ownerComp.par.Storepreviews.eval()
125 | prefab.op("preview").par.top = ""
126 |
127 | def Get_Preset_Comp(self,preset_id) -> COMP :
128 | """
129 | Returns the COMP defining the presets given thepreset_id.
130 | """
131 | return self.preset_folder.op(preset_id) or self.ownerComp.op("emptyPreset")
132 |
133 | def Get_Preset_Name(self,preset_id:str) -> str:
134 | """
135 | Return the Name of a Preset bypreset_id.
136 | """
137 | return self.Get_Preset_Comp(preset_id).par.Name.eval()
138 |
139 | def Get_Preview(self,preset_id:str) -> TOP:
140 | """
141 | Return the TOP showing the preview of the Presets.
142 | """
143 |
144 | return self.Get_Preset_Comp(preset_id).op("preview")
145 |
146 | def Store_Preset(self, name:str, tag = '',preset_id = "") -> str:
147 | """
148 | Store the Preset unter the given name.
149 | Ifpreset_id is not not supplied thepreset_id will be generated based on Parameters.
150 | """
151 | #creating newpreset_id if nopreset_id given.
152 | if self.ownerComp.par.Idmode.eval() == "Name":
153 | name = tdu.legalName( name )
154 | preset_id = name
155 |
156 | preset_id =preset_id or tdu.legalName( str( uuid.uuid4() ) )
157 |
158 | #checking for existing preset
159 | existing_preset_comp = self.preset_folder.op( preset_id )
160 |
161 | if existing_preset_comp:
162 | handle_override = self.ownerComp.par.Handleoverride.eval()
163 | if handle_override == "Request":
164 | if not ui.messageBox(
165 | "Override Preset",
166 | f"You are about to override the preset with the name {name} andpreset_id {preset_id}. Are you sure?",
167 | buttons = ["Cancel", "Ok"]
168 | ): return ""
169 | if handle_override == "Exception":
170 | raise Exception(f"Preset {preset_id} {name} already exists!")
171 |
172 | #calling update or create, depending on if a preset already exists.
173 | if existing_preset_comp:
174 | existing_preset_comp.destroy()
175 |
176 | #preset_comp = (self._update_preset if existing_preset else self._create_preset)(name, tag, preset_id)
177 | # Upadting is for a later time of day.
178 | # We should implement the Push here actually!
179 | preset_comp = self._create_preset( name, tag, preset_id )
180 |
181 | #storing the preview
182 | self.store_prev( preset_comp )
183 |
184 | #aranging the node
185 | TDFunctions.arrangeNode( preset_comp )
186 |
187 | #writing stack to preset-table
188 | stack_data = self.ownerComp.op("callbackManager").Do_Callback("getStack", self.ownerComp) or self.stack.Get_Stack_Dict_List()
189 |
190 | preset_comp.seq.Items.numBlocks = len( stack_data )
191 | data_seq = preset_comp.seq.Items
192 | for index, item in enumerate( stack_data ):
193 | if item is None: continue
194 | item["Operator"] = self.ownerComp.relativePath( item["Operator"]) if self.ownerComp.par.Pathrelation.eval() == "Relative" else item["Operator"].path
195 | for key, value in item.items():
196 | data_seq[index].par[key] = value
197 | pass
198 |
199 | if self.ownerComp.par.Pushstacktoallpresets.eval():
200 | self.Push_Stack_To_Presets()
201 | return preset_id
202 |
203 | @property
204 | def preset_comps(self):
205 | return [
206 | preset_comp for preset_comp in self.preset_folder.findChildren( depth = 1) if hasattr( preset_comp.seq, "Items" )
207 | ]
208 |
209 | def _create_preset(self, name, tag,preset_id):
210 | new_preset = self.preset_folder.copy( self.prefab, name =preset_id)
211 | new_preset.par.Tag = tag or self.ownerComp.par.Tag.eval()
212 | new_preset.par.Name = name
213 | self.ownerComp.op("callbackManager").Do_Callback( "onPresetRecord",
214 | new_preset.par.Name.eval(),
215 | new_preset.par.Tag.eval(),
216 | new_preset.name,
217 | self.ownerComp)
218 | return new_preset
219 |
220 | def _update_preset(self, name, tag,preset_id):
221 | preset_comp = self.preset_folder.op(id)
222 | self.ownerComp.op("callbackManager").Do_Callback( "onPresetUpdate",
223 | preset_comp.par.Name.eval(),
224 | preset_comp.par.Tag.eval(),
225 | preset_comp.name,
226 | self.ownerComp)
227 | return preset_comp
228 |
229 | def Remove_Preset(self,preset_id:str ):
230 | try:
231 | self.preset_folder.op(preset_id ).destroy()
232 | except :
233 | pass
234 |
235 | def Remove_All_Presets(self):
236 | for preset_comp in self.preset_folder.findChildren( depth = 1):
237 | preset_comp.destroy()
238 |
239 | def Preset_To_Stack(self,preset_id:str):
240 | preset_comp = self.preset_folder.op(preset_id )
241 | if not preset_comp: return
242 | self.stack.Clear_Stack()
243 |
244 | for block in preset_comp.seq.Items:
245 | try:
246 | self.stack.Add_Par(
247 | block.par.Parameter.eval(),
248 | preload = block.par.Preload.eval(),
249 | fade_type = block.par.Type.eval()
250 | )
251 |
252 | except AttributeError:
253 | continue
254 |
255 | def Recall_Preset(self,preset_id:str, time:float, curve = "s", load_stack = False):
256 | preset_comp = self.preset_folder.op(preset_id )
257 | self.logger.Log("Recalling preset", preset_id, time, curve, load_stack)
258 |
259 | if not preset_comp:
260 | if self.ownerComp.par.Handlenopreset.eval() == "Raise Exception":
261 | raise self.PresetDoesNotExist()
262 | return False
263 |
264 | self.ownerComp.op("callbackManager").Do_Callback(
265 | "onPresetRecall",
266 | preset_comp.par.Name.eval(),
267 | preset_comp.par.Tag.eval(),
268 | preset_comp.name,
269 | self.ownerComp
270 | )
271 |
272 | if load_stack: self.Preset_To_Stack( preset_id )
273 |
274 |
275 | for block in preset_comp.seq.Items:
276 |
277 |
278 | self.ownerComp.par.Evalref.val = block.par.Operator.eval()
279 | target_operator = self.ownerComp.par.Evalref.eval()
280 | if target_operator is None:
281 | self.logger.Log( "Target operator is None. Skipping.", self.ownerComp.par.Evalref.val )
282 | continue
283 |
284 | target_parameter = target_operator.par[ block.par.Parname.eval() ]
285 |
286 | if target_parameter is None:
287 | self.logger.Log(
288 | "Could not find Parameter stored in Preset",
289 | id,
290 | block.par.Operator.eval(),
291 | block.par.Parname.eval()
292 | )
293 | continue
294 |
295 | self.tweener.CreateTween( target_parameter,
296 | block.par.Value.eval(),
297 | time,
298 | type = block.par.Type.eval(),
299 | curve = curve,
300 | id = preset_comp,
301 | mode = block.par.Mode.eval(),
302 | expression = block.par.Expression.eval() )
303 | return True
304 |
305 | def Rename(self,preset_id:str, new_name:str ):
306 | preset_comp = self.preset_folder.op(preset_id )
307 | if not preset_comp: return
308 |
309 | if self.ownerComp.par.Renamemode.eval() == "Replacepreset_id":
310 | new_name = tdu.legalName( new_name )
311 | preset_comp.name = new_name
312 | preset_comp.par.Name.val = new_name
313 | else:
314 | preset_comp.par.Name = new_name
315 | return preset_comp
316 |
317 | def Push_Stack_To_Presets(self,
318 | mode:Literal["keep", "overwrite"] = "keep",
319 | _stackelements:Union[str, list, tuple] = "*",
320 | _presets:Union[str, list, tuple] = "*"):
321 | """
322 | Pushes all the parameters of the current stack to all presets.
323 | When using "overwrite" mode all parameters will b overwritten. CAUTION!
324 | """
325 |
326 | stack_data = self.ownerComp.op("callbackManager").Do_Callback("getStack", self.ownerComp) or self.stack.Get_Stack_Dict_List()
327 | for preset_comp in self.preset_comps:
328 |
329 | preset_data_seq = preset_comp.seq.Items
330 | append_data = []
331 | for stack_item in stack_data :
332 |
333 | if stack_item is None: continue
334 | self.ownerComp.par.Evalref.val = stack_item["Operator"]
335 | stack_operator = self.ownerComp.par.Evalref.eval()
336 | if stack_operator is None: continue
337 |
338 | stack_parameter = stack_operator.par[ stack_item["Parname"] ]
339 | if stack_parameter is None: continue
340 |
341 | for preset_seq_par in preset_data_seq:
342 | self.ownerComp.par.Evalref.val = preset_seq_par.par.Operator.val
343 | preset_operator = self.ownerComp.par.Evalref.eval()
344 | if stack_operator != preset_operator: continue
345 |
346 | preset_parameter = preset_operator.par[ preset_seq_par.par.Parname.eval() ]
347 | if preset_parameter is None: continue
348 |
349 |
350 | if hash( preset_parameter ) != hash( stack_parameter ): continue
351 | if mode == "overwrite":
352 | preset_seq_par.par.Value.val = stack_parameter.eval()
353 | break
354 | else:
355 | append_data.append( stack_item )
356 |
357 | for new_value_item in append_data:
358 | new_block = preset_comp.seq.Items.insertBlock(0)
359 | new_value_item["Operator"] = self.ownerComp.relativePath( new_value_item["Operator"] ) if self.ownerComp.par.Pathrelation.eval() == "Relative" else new_value_item["Operator"].path
360 | for key, value in new_value_item.items():
361 | setattr( new_block.par, key, value)
362 |
363 |
364 |
365 | return
366 |
367 | @property
368 | def PresetParMenuObject(self):
369 | return tdu.TableMenu(
370 | self.ownerComp.op("id_to_name"), labelCol = "name"
371 | )
--------------------------------------------------------------------------------
/LICENSE:
--------------------------------------------------------------------------------
1 | GNU GENERAL PUBLIC LICENSE
2 | Version 3, 29 June 2007
3 |
4 | Copyright (C) 2007 Free Software Foundation, Inc.
5 | Everyone is permitted to copy and distribute verbatim copies
6 | of this license document, but changing it is not allowed.
7 |
8 | Preamble
9 |
10 | The GNU General Public License is a free, copyleft license for
11 | software and other kinds of works.
12 |
13 | The licenses for most software and other practical works are designed
14 | to take away your freedom to share and change the works. By contrast,
15 | the GNU General Public License is intended to guarantee your freedom to
16 | share and change all versions of a program--to make sure it remains free
17 | software for all its users. We, the Free Software Foundation, use the
18 | GNU General Public License for most of our software; it applies also to
19 | any other work released this way by its authors. You can apply it to
20 | your programs, too.
21 |
22 | When we speak of free software, we are referring to freedom, not
23 | price. Our General Public Licenses are designed to make sure that you
24 | have the freedom to distribute copies of free software (and charge for
25 | them if you wish), that you receive source code or can get it if you
26 | want it, that you can change the software or use pieces of it in new
27 | free programs, and that you know you can do these things.
28 |
29 | To protect your rights, we need to prevent others from denying you
30 | these rights or asking you to surrender the rights. Therefore, you have
31 | certain responsibilities if you distribute copies of the software, or if
32 | you modify it: responsibilities to respect the freedom of others.
33 |
34 | For example, if you distribute copies of such a program, whether
35 | gratis or for a fee, you must pass on to the recipients the same
36 | freedoms that you received. You must make sure that they, too, receive
37 | or can get the source code. And you must show them these terms so they
38 | know their rights.
39 |
40 | Developers that use the GNU GPL protect your rights with two steps:
41 | (1) assert copyright on the software, and (2) offer you this License
42 | giving you legal permission to copy, distribute and/or modify it.
43 |
44 | For the developers' and authors' protection, the GPL clearly explains
45 | that there is no warranty for this free software. For both users' and
46 | authors' sake, the GPL requires that modified versions be marked as
47 | changed, so that their problems will not be attributed erroneously to
48 | authors of previous versions.
49 |
50 | Some devices are designed to deny users access to install or run
51 | modified versions of the software inside them, although the manufacturer
52 | can do so. This is fundamentally incompatible with the aim of
53 | protecting users' freedom to change the software. The systematic
54 | pattern of such abuse occurs in the area of products for individuals to
55 | use, which is precisely where it is most unacceptable. Therefore, we
56 | have designed this version of the GPL to prohibit the practice for those
57 | products. If such problems arise substantially in other domains, we
58 | stand ready to extend this provision to those domains in future versions
59 | of the GPL, as needed to protect the freedom of users.
60 |
61 | Finally, every program is threatened constantly by software patents.
62 | States should not allow patents to restrict development and use of
63 | software on general-purpose computers, but in those that do, we wish to
64 | avoid the special danger that patents applied to a free program could
65 | make it effectively proprietary. To prevent this, the GPL assures that
66 | patents cannot be used to render the program non-free.
67 |
68 | The precise terms and conditions for copying, distribution and
69 | modification follow.
70 |
71 | TERMS AND CONDITIONS
72 |
73 | 0. Definitions.
74 |
75 | "This License" refers to version 3 of the GNU General Public License.
76 |
77 | "Copyright" also means copyright-like laws that apply to other kinds of
78 | works, such as semiconductor masks.
79 |
80 | "The Program" refers to any copyrightable work licensed under this
81 | License. Each licensee is addressed as "you". "Licensees" and
82 | "recipients" may be individuals or organizations.
83 |
84 | To "modify" a work means to copy from or adapt all or part of the work
85 | in a fashion requiring copyright permission, other than the making of an
86 | exact copy. The resulting work is called a "modified version" of the
87 | earlier work or a work "based on" the earlier work.
88 |
89 | A "covered work" means either the unmodified Program or a work based
90 | on the Program.
91 |
92 | To "propagate" a work means to do anything with it that, without
93 | permission, would make you directly or secondarily liable for
94 | infringement under applicable copyright law, except executing it on a
95 | computer or modifying a private copy. Propagation includes copying,
96 | distribution (with or without modification), making available to the
97 | public, and in some countries other activities as well.
98 |
99 | To "convey" a work means any kind of propagation that enables other
100 | parties to make or receive copies. Mere interaction with a user through
101 | a computer network, with no transfer of a copy, is not conveying.
102 |
103 | An interactive user interface displays "Appropriate Legal Notices"
104 | to the extent that it includes a convenient and prominently visible
105 | feature that (1) displays an appropriate copyright notice, and (2)
106 | tells the user that there is no warranty for the work (except to the
107 | extent that warranties are provided), that licensees may convey the
108 | work under this License, and how to view a copy of this License. If
109 | the interface presents a list of user commands or options, such as a
110 | menu, a prominent item in the list meets this criterion.
111 |
112 | 1. Source Code.
113 |
114 | The "source code" for a work means the preferred form of the work
115 | for making modifications to it. "Object code" means any non-source
116 | form of a work.
117 |
118 | A "Standard Interface" means an interface that either is an official
119 | standard defined by a recognized standards body, or, in the case of
120 | interfaces specified for a particular programming language, one that
121 | is widely used among developers working in that language.
122 |
123 | The "System Libraries" of an executable work include anything, other
124 | than the work as a whole, that (a) is included in the normal form of
125 | packaging a Major Component, but which is not part of that Major
126 | Component, and (b) serves only to enable use of the work with that
127 | Major Component, or to implement a Standard Interface for which an
128 | implementation is available to the public in source code form. A
129 | "Major Component", in this context, means a major essential component
130 | (kernel, window system, and so on) of the specific operating system
131 | (if any) on which the executable work runs, or a compiler used to
132 | produce the work, or an object code interpreter used to run it.
133 |
134 | The "Corresponding Source" for a work in object code form means all
135 | the source code needed to generate, install, and (for an executable
136 | work) run the object code and to modify the work, including scripts to
137 | control those activities. However, it does not include the work's
138 | System Libraries, or general-purpose tools or generally available free
139 | programs which are used unmodified in performing those activities but
140 | which are not part of the work. For example, Corresponding Source
141 | includes interface definition files associated with source files for
142 | the work, and the source code for shared libraries and dynamically
143 | linked subprograms that the work is specifically designed to require,
144 | such as by intimate data communication or control flow between those
145 | subprograms and other parts of the work.
146 |
147 | The Corresponding Source need not include anything that users
148 | can regenerate automatically from other parts of the Corresponding
149 | Source.
150 |
151 | The Corresponding Source for a work in source code form is that
152 | same work.
153 |
154 | 2. Basic Permissions.
155 |
156 | All rights granted under this License are granted for the term of
157 | copyright on the Program, and are irrevocable provided the stated
158 | conditions are met. This License explicitly affirms your unlimited
159 | permission to run the unmodified Program. The output from running a
160 | covered work is covered by this License only if the output, given its
161 | content, constitutes a covered work. This License acknowledges your
162 | rights of fair use or other equivalent, as provided by copyright law.
163 |
164 | You may make, run and propagate covered works that you do not
165 | convey, without conditions so long as your license otherwise remains
166 | in force. You may convey covered works to others for the sole purpose
167 | of having them make modifications exclusively for you, or provide you
168 | with facilities for running those works, provided that you comply with
169 | the terms of this License in conveying all material for which you do
170 | not control copyright. Those thus making or running the covered works
171 | for you must do so exclusively on your behalf, under your direction
172 | and control, on terms that prohibit them from making any copies of
173 | your copyrighted material outside their relationship with you.
174 |
175 | Conveying under any other circumstances is permitted solely under
176 | the conditions stated below. Sublicensing is not allowed; section 10
177 | makes it unnecessary.
178 |
179 | 3. Protecting Users' Legal Rights From Anti-Circumvention Law.
180 |
181 | No covered work shall be deemed part of an effective technological
182 | measure under any applicable law fulfilling obligations under article
183 | 11 of the WIPO copyright treaty adopted on 20 December 1996, or
184 | similar laws prohibiting or restricting circumvention of such
185 | measures.
186 |
187 | When you convey a covered work, you waive any legal power to forbid
188 | circumvention of technological measures to the extent such circumvention
189 | is effected by exercising rights under this License with respect to
190 | the covered work, and you disclaim any intention to limit operation or
191 | modification of the work as a means of enforcing, against the work's
192 | users, your or third parties' legal rights to forbid circumvention of
193 | technological measures.
194 |
195 | 4. Conveying Verbatim Copies.
196 |
197 | You may convey verbatim copies of the Program's source code as you
198 | receive it, in any medium, provided that you conspicuously and
199 | appropriately publish on each copy an appropriate copyright notice;
200 | keep intact all notices stating that this License and any
201 | non-permissive terms added in accord with section 7 apply to the code;
202 | keep intact all notices of the absence of any warranty; and give all
203 | recipients a copy of this License along with the Program.
204 |
205 | You may charge any price or no price for each copy that you convey,
206 | and you may offer support or warranty protection for a fee.
207 |
208 | 5. Conveying Modified Source Versions.
209 |
210 | You may convey a work based on the Program, or the modifications to
211 | produce it from the Program, in the form of source code under the
212 | terms of section 4, provided that you also meet all of these conditions:
213 |
214 | a) The work must carry prominent notices stating that you modified
215 | it, and giving a relevant date.
216 |
217 | b) The work must carry prominent notices stating that it is
218 | released under this License and any conditions added under section
219 | 7. This requirement modifies the requirement in section 4 to
220 | "keep intact all notices".
221 |
222 | c) You must license the entire work, as a whole, under this
223 | License to anyone who comes into possession of a copy. This
224 | License will therefore apply, along with any applicable section 7
225 | additional terms, to the whole of the work, and all its parts,
226 | regardless of how they are packaged. This License gives no
227 | permission to license the work in any other way, but it does not
228 | invalidate such permission if you have separately received it.
229 |
230 | d) If the work has interactive user interfaces, each must display
231 | Appropriate Legal Notices; however, if the Program has interactive
232 | interfaces that do not display Appropriate Legal Notices, your
233 | work need not make them do so.
234 |
235 | A compilation of a covered work with other separate and independent
236 | works, which are not by their nature extensions of the covered work,
237 | and which are not combined with it such as to form a larger program,
238 | in or on a volume of a storage or distribution medium, is called an
239 | "aggregate" if the compilation and its resulting copyright are not
240 | used to limit the access or legal rights of the compilation's users
241 | beyond what the individual works permit. Inclusion of a covered work
242 | in an aggregate does not cause this License to apply to the other
243 | parts of the aggregate.
244 |
245 | 6. Conveying Non-Source Forms.
246 |
247 | You may convey a covered work in object code form under the terms
248 | of sections 4 and 5, provided that you also convey the
249 | machine-readable Corresponding Source under the terms of this License,
250 | in one of these ways:
251 |
252 | a) Convey the object code in, or embodied in, a physical product
253 | (including a physical distribution medium), accompanied by the
254 | Corresponding Source fixed on a durable physical medium
255 | customarily used for software interchange.
256 |
257 | b) Convey the object code in, or embodied in, a physical product
258 | (including a physical distribution medium), accompanied by a
259 | written offer, valid for at least three years and valid for as
260 | long as you offer spare parts or customer support for that product
261 | model, to give anyone who possesses the object code either (1) a
262 | copy of the Corresponding Source for all the software in the
263 | product that is covered by this License, on a durable physical
264 | medium customarily used for software interchange, for a price no
265 | more than your reasonable cost of physically performing this
266 | conveying of source, or (2) access to copy the
267 | Corresponding Source from a network server at no charge.
268 |
269 | c) Convey individual copies of the object code with a copy of the
270 | written offer to provide the Corresponding Source. This
271 | alternative is allowed only occasionally and noncommercially, and
272 | only if you received the object code with such an offer, in accord
273 | with subsection 6b.
274 |
275 | d) Convey the object code by offering access from a designated
276 | place (gratis or for a charge), and offer equivalent access to the
277 | Corresponding Source in the same way through the same place at no
278 | further charge. You need not require recipients to copy the
279 | Corresponding Source along with the object code. If the place to
280 | copy the object code is a network server, the Corresponding Source
281 | may be on a different server (operated by you or a third party)
282 | that supports equivalent copying facilities, provided you maintain
283 | clear directions next to the object code saying where to find the
284 | Corresponding Source. Regardless of what server hosts the
285 | Corresponding Source, you remain obligated to ensure that it is
286 | available for as long as needed to satisfy these requirements.
287 |
288 | e) Convey the object code using peer-to-peer transmission, provided
289 | you inform other peers where the object code and Corresponding
290 | Source of the work are being offered to the general public at no
291 | charge under subsection 6d.
292 |
293 | A separable portion of the object code, whose source code is excluded
294 | from the Corresponding Source as a System Library, need not be
295 | included in conveying the object code work.
296 |
297 | A "User Product" is either (1) a "consumer product", which means any
298 | tangible personal property which is normally used for personal, family,
299 | or household purposes, or (2) anything designed or sold for incorporation
300 | into a dwelling. In determining whether a product is a consumer product,
301 | doubtful cases shall be resolved in favor of coverage. For a particular
302 | product received by a particular user, "normally used" refers to a
303 | typical or common use of that class of product, regardless of the status
304 | of the particular user or of the way in which the particular user
305 | actually uses, or expects or is expected to use, the product. A product
306 | is a consumer product regardless of whether the product has substantial
307 | commercial, industrial or non-consumer uses, unless such uses represent
308 | the only significant mode of use of the product.
309 |
310 | "Installation Information" for a User Product means any methods,
311 | procedures, authorization keys, or other information required to install
312 | and execute modified versions of a covered work in that User Product from
313 | a modified version of its Corresponding Source. The information must
314 | suffice to ensure that the continued functioning of the modified object
315 | code is in no case prevented or interfered with solely because
316 | modification has been made.
317 |
318 | If you convey an object code work under this section in, or with, or
319 | specifically for use in, a User Product, and the conveying occurs as
320 | part of a transaction in which the right of possession and use of the
321 | User Product is transferred to the recipient in perpetuity or for a
322 | fixed term (regardless of how the transaction is characterized), the
323 | Corresponding Source conveyed under this section must be accompanied
324 | by the Installation Information. But this requirement does not apply
325 | if neither you nor any third party retains the ability to install
326 | modified object code on the User Product (for example, the work has
327 | been installed in ROM).
328 |
329 | The requirement to provide Installation Information does not include a
330 | requirement to continue to provide support service, warranty, or updates
331 | for a work that has been modified or installed by the recipient, or for
332 | the User Product in which it has been modified or installed. Access to a
333 | network may be denied when the modification itself materially and
334 | adversely affects the operation of the network or violates the rules and
335 | protocols for communication across the network.
336 |
337 | Corresponding Source conveyed, and Installation Information provided,
338 | in accord with this section must be in a format that is publicly
339 | documented (and with an implementation available to the public in
340 | source code form), and must require no special password or key for
341 | unpacking, reading or copying.
342 |
343 | 7. Additional Terms.
344 |
345 | "Additional permissions" are terms that supplement the terms of this
346 | License by making exceptions from one or more of its conditions.
347 | Additional permissions that are applicable to the entire Program shall
348 | be treated as though they were included in this License, to the extent
349 | that they are valid under applicable law. If additional permissions
350 | apply only to part of the Program, that part may be used separately
351 | under those permissions, but the entire Program remains governed by
352 | this License without regard to the additional permissions.
353 |
354 | When you convey a copy of a covered work, you may at your option
355 | remove any additional permissions from that copy, or from any part of
356 | it. (Additional permissions may be written to require their own
357 | removal in certain cases when you modify the work.) You may place
358 | additional permissions on material, added by you to a covered work,
359 | for which you have or can give appropriate copyright permission.
360 |
361 | Notwithstanding any other provision of this License, for material you
362 | add to a covered work, you may (if authorized by the copyright holders of
363 | that material) supplement the terms of this License with terms:
364 |
365 | a) Disclaiming warranty or limiting liability differently from the
366 | terms of sections 15 and 16 of this License; or
367 |
368 | b) Requiring preservation of specified reasonable legal notices or
369 | author attributions in that material or in the Appropriate Legal
370 | Notices displayed by works containing it; or
371 |
372 | c) Prohibiting misrepresentation of the origin of that material, or
373 | requiring that modified versions of such material be marked in
374 | reasonable ways as different from the original version; or
375 |
376 | d) Limiting the use for publicity purposes of names of licensors or
377 | authors of the material; or
378 |
379 | e) Declining to grant rights under trademark law for use of some
380 | trade names, trademarks, or service marks; or
381 |
382 | f) Requiring indemnification of licensors and authors of that
383 | material by anyone who conveys the material (or modified versions of
384 | it) with contractual assumptions of liability to the recipient, for
385 | any liability that these contractual assumptions directly impose on
386 | those licensors and authors.
387 |
388 | All other non-permissive additional terms are considered "further
389 | restrictions" within the meaning of section 10. If the Program as you
390 | received it, or any part of it, contains a notice stating that it is
391 | governed by this License along with a term that is a further
392 | restriction, you may remove that term. If a license document contains
393 | a further restriction but permits relicensing or conveying under this
394 | License, you may add to a covered work material governed by the terms
395 | of that license document, provided that the further restriction does
396 | not survive such relicensing or conveying.
397 |
398 | If you add terms to a covered work in accord with this section, you
399 | must place, in the relevant source files, a statement of the
400 | additional terms that apply to those files, or a notice indicating
401 | where to find the applicable terms.
402 |
403 | Additional terms, permissive or non-permissive, may be stated in the
404 | form of a separately written license, or stated as exceptions;
405 | the above requirements apply either way.
406 |
407 | 8. Termination.
408 |
409 | You may not propagate or modify a covered work except as expressly
410 | provided under this License. Any attempt otherwise to propagate or
411 | modify it is void, and will automatically terminate your rights under
412 | this License (including any patent licenses granted under the third
413 | paragraph of section 11).
414 |
415 | However, if you cease all violation of this License, then your
416 | license from a particular copyright holder is reinstated (a)
417 | provisionally, unless and until the copyright holder explicitly and
418 | finally terminates your license, and (b) permanently, if the copyright
419 | holder fails to notify you of the violation by some reasonable means
420 | prior to 60 days after the cessation.
421 |
422 | Moreover, your license from a particular copyright holder is
423 | reinstated permanently if the copyright holder notifies you of the
424 | violation by some reasonable means, this is the first time you have
425 | received notice of violation of this License (for any work) from that
426 | copyright holder, and you cure the violation prior to 30 days after
427 | your receipt of the notice.
428 |
429 | Termination of your rights under this section does not terminate the
430 | licenses of parties who have received copies or rights from you under
431 | this License. If your rights have been terminated and not permanently
432 | reinstated, you do not qualify to receive new licenses for the same
433 | material under section 10.
434 |
435 | 9. Acceptance Not Required for Having Copies.
436 |
437 | You are not required to accept this License in order to receive or
438 | run a copy of the Program. Ancillary propagation of a covered work
439 | occurring solely as a consequence of using peer-to-peer transmission
440 | to receive a copy likewise does not require acceptance. However,
441 | nothing other than this License grants you permission to propagate or
442 | modify any covered work. These actions infringe copyright if you do
443 | not accept this License. Therefore, by modifying or propagating a
444 | covered work, you indicate your acceptance of this License to do so.
445 |
446 | 10. Automatic Licensing of Downstream Recipients.
447 |
448 | Each time you convey a covered work, the recipient automatically
449 | receives a license from the original licensors, to run, modify and
450 | propagate that work, subject to this License. You are not responsible
451 | for enforcing compliance by third parties with this License.
452 |
453 | An "entity transaction" is a transaction transferring control of an
454 | organization, or substantially all assets of one, or subdividing an
455 | organization, or merging organizations. If propagation of a covered
456 | work results from an entity transaction, each party to that
457 | transaction who receives a copy of the work also receives whatever
458 | licenses to the work the party's predecessor in interest had or could
459 | give under the previous paragraph, plus a right to possession of the
460 | Corresponding Source of the work from the predecessor in interest, if
461 | the predecessor has it or can get it with reasonable efforts.
462 |
463 | You may not impose any further restrictions on the exercise of the
464 | rights granted or affirmed under this License. For example, you may
465 | not impose a license fee, royalty, or other charge for exercise of
466 | rights granted under this License, and you may not initiate litigation
467 | (including a cross-claim or counterclaim in a lawsuit) alleging that
468 | any patent claim is infringed by making, using, selling, offering for
469 | sale, or importing the Program or any portion of it.
470 |
471 | 11. Patents.
472 |
473 | A "contributor" is a copyright holder who authorizes use under this
474 | License of the Program or a work on which the Program is based. The
475 | work thus licensed is called the contributor's "contributor version".
476 |
477 | A contributor's "essential patent claims" are all patent claims
478 | owned or controlled by the contributor, whether already acquired or
479 | hereafter acquired, that would be infringed by some manner, permitted
480 | by this License, of making, using, or selling its contributor version,
481 | but do not include claims that would be infringed only as a
482 | consequence of further modification of the contributor version. For
483 | purposes of this definition, "control" includes the right to grant
484 | patent sublicenses in a manner consistent with the requirements of
485 | this License.
486 |
487 | Each contributor grants you a non-exclusive, worldwide, royalty-free
488 | patent license under the contributor's essential patent claims, to
489 | make, use, sell, offer for sale, import and otherwise run, modify and
490 | propagate the contents of its contributor version.
491 |
492 | In the following three paragraphs, a "patent license" is any express
493 | agreement or commitment, however denominated, not to enforce a patent
494 | (such as an express permission to practice a patent or covenant not to
495 | sue for patent infringement). To "grant" such a patent license to a
496 | party means to make such an agreement or commitment not to enforce a
497 | patent against the party.
498 |
499 | If you convey a covered work, knowingly relying on a patent license,
500 | and the Corresponding Source of the work is not available for anyone
501 | to copy, free of charge and under the terms of this License, through a
502 | publicly available network server or other readily accessible means,
503 | then you must either (1) cause the Corresponding Source to be so
504 | available, or (2) arrange to deprive yourself of the benefit of the
505 | patent license for this particular work, or (3) arrange, in a manner
506 | consistent with the requirements of this License, to extend the patent
507 | license to downstream recipients. "Knowingly relying" means you have
508 | actual knowledge that, but for the patent license, your conveying the
509 | covered work in a country, or your recipient's use of the covered work
510 | in a country, would infringe one or more identifiable patents in that
511 | country that you have reason to believe are valid.
512 |
513 | If, pursuant to or in connection with a single transaction or
514 | arrangement, you convey, or propagate by procuring conveyance of, a
515 | covered work, and grant a patent license to some of the parties
516 | receiving the covered work authorizing them to use, propagate, modify
517 | or convey a specific copy of the covered work, then the patent license
518 | you grant is automatically extended to all recipients of the covered
519 | work and works based on it.
520 |
521 | A patent license is "discriminatory" if it does not include within
522 | the scope of its coverage, prohibits the exercise of, or is
523 | conditioned on the non-exercise of one or more of the rights that are
524 | specifically granted under this License. You may not convey a covered
525 | work if you are a party to an arrangement with a third party that is
526 | in the business of distributing software, under which you make payment
527 | to the third party based on the extent of your activity of conveying
528 | the work, and under which the third party grants, to any of the
529 | parties who would receive the covered work from you, a discriminatory
530 | patent license (a) in connection with copies of the covered work
531 | conveyed by you (or copies made from those copies), or (b) primarily
532 | for and in connection with specific products or compilations that
533 | contain the covered work, unless you entered into that arrangement,
534 | or that patent license was granted, prior to 28 March 2007.
535 |
536 | Nothing in this License shall be construed as excluding or limiting
537 | any implied license or other defenses to infringement that may
538 | otherwise be available to you under applicable patent law.
539 |
540 | 12. No Surrender of Others' Freedom.
541 |
542 | If conditions are imposed on you (whether by court order, agreement or
543 | otherwise) that contradict the conditions of this License, they do not
544 | excuse you from the conditions of this License. If you cannot convey a
545 | covered work so as to satisfy simultaneously your obligations under this
546 | License and any other pertinent obligations, then as a consequence you may
547 | not convey it at all. For example, if you agree to terms that obligate you
548 | to collect a royalty for further conveying from those to whom you convey
549 | the Program, the only way you could satisfy both those terms and this
550 | License would be to refrain entirely from conveying the Program.
551 |
552 | 13. Use with the GNU Affero General Public License.
553 |
554 | Notwithstanding any other provision of this License, you have
555 | permission to link or combine any covered work with a work licensed
556 | under version 3 of the GNU Affero General Public License into a single
557 | combined work, and to convey the resulting work. The terms of this
558 | License will continue to apply to the part which is the covered work,
559 | but the special requirements of the GNU Affero General Public License,
560 | section 13, concerning interaction through a network will apply to the
561 | combination as such.
562 |
563 | 14. Revised Versions of this License.
564 |
565 | The Free Software Foundation may publish revised and/or new versions of
566 | the GNU General Public License from time to time. Such new versions will
567 | be similar in spirit to the present version, but may differ in detail to
568 | address new problems or concerns.
569 |
570 | Each version is given a distinguishing version number. If the
571 | Program specifies that a certain numbered version of the GNU General
572 | Public License "or any later version" applies to it, you have the
573 | option of following the terms and conditions either of that numbered
574 | version or of any later version published by the Free Software
575 | Foundation. If the Program does not specify a version number of the
576 | GNU General Public License, you may choose any version ever published
577 | by the Free Software Foundation.
578 |
579 | If the Program specifies that a proxy can decide which future
580 | versions of the GNU General Public License can be used, that proxy's
581 | public statement of acceptance of a version permanently authorizes you
582 | to choose that version for the Program.
583 |
584 | Later license versions may give you additional or different
585 | permissions. However, no additional obligations are imposed on any
586 | author or copyright holder as a result of your choosing to follow a
587 | later version.
588 |
589 | 15. Disclaimer of Warranty.
590 |
591 | THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY
592 | APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT
593 | HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY
594 | OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO,
595 | THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
596 | PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM
597 | IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF
598 | ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
599 |
600 | 16. Limitation of Liability.
601 |
602 | IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
603 | WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS
604 | THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY
605 | GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE
606 | USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF
607 | DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD
608 | PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS),
609 | EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF
610 | SUCH DAMAGES.
611 |
612 | 17. Interpretation of Sections 15 and 16.
613 |
614 | If the disclaimer of warranty and limitation of liability provided
615 | above cannot be given local legal effect according to their terms,
616 | reviewing courts shall apply local law that most closely approximates
617 | an absolute waiver of all civil liability in connection with the
618 | Program, unless a warranty or assumption of liability accompanies a
619 | copy of the Program in return for a fee.
620 |
621 | END OF TERMS AND CONDITIONS
622 |
623 | How to Apply These Terms to Your New Programs
624 |
625 | If you develop a new program, and you want it to be of the greatest
626 | possible use to the public, the best way to achieve this is to make it
627 | free software which everyone can redistribute and change under these terms.
628 |
629 | To do so, attach the following notices to the program. It is safest
630 | to attach them to the start of each source file to most effectively
631 | state the exclusion of warranty; and each file should have at least
632 | the "copyright" line and a pointer to where the full notice is found.
633 |
634 |
635 | Copyright (C)
636 |
637 | This program is free software: you can redistribute it and/or modify
638 | it under the terms of the GNU General Public License as published by
639 | the Free Software Foundation, either version 3 of the License, or
640 | (at your option) any later version.
641 |
642 | This program is distributed in the hope that it will be useful,
643 | but WITHOUT ANY WARRANTY; without even the implied warranty of
644 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
645 | GNU General Public License for more details.
646 |
647 | You should have received a copy of the GNU General Public License
648 | along with this program. If not, see .
649 |
650 | Also add information on how to contact you by electronic and paper mail.
651 |
652 | If the program does terminal interaction, make it output a short
653 | notice like this when it starts in an interactive mode:
654 |
655 | Copyright (C)
656 | This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
657 | This is free software, and you are welcome to redistribute it
658 | under certain conditions; type `show c' for details.
659 |
660 | The hypothetical commands `show w' and `show c' should show the appropriate
661 | parts of the General Public License. Of course, your program's commands
662 | might be different; for a GUI interface, you would use an "about box".
663 |
664 | You should also get your employer (if you work as a programmer) or school,
665 | if any, to sign a "copyright disclaimer" for the program, if necessary.
666 | For more information on this, and how to apply and follow the GNU GPL, see
667 | .
668 |
669 | The GNU General Public License does not permit incorporating your program
670 | into proprietary programs. If your program is a subroutine library, you
671 | may consider it more useful to permit linking proprietary applications with
672 | the library. If this is what you want to do, use the GNU Lesser General
673 | Public License instead of this License. But first, please read
674 | .
675 |
--------------------------------------------------------------------------------