markdown 存储在TouchDesigner中

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了markdown 存储在TouchDesigner中相关的知识,希望对你有一定的参考价值。

Storage
Storage can be used to keep data within components. Storage is implemented as one python dictionary per node.

When an element of storage is changed by using n.store() as explained below, expressions and operators that depend on it will automatically re-cook. It is retrieved with the n.fetch() function.

Storage is saved in .toe and .tox files and restored on startup.

Storage can hold any python object type (not just strings as in Tscript variables). Storage elements can also have optional startup values, specified separately. Use these startup values for example, to avoid saving and loading some session specific object, and instead save or load a well defined object like None.

See the Examine DAT for procedurally viewing the contents of storage.

```python
fetch(key, default, search=True, storeDefault=False)→ value:
```
Return an object from the OP storage dictionary. If the item is not found, and a default it supplied, it will be returned instead.
* key - The name of the entry to retrieve.
* default - (Optional) If provided and no item is found then the passed value/object is returned instead.
* storeDefault - (Keyword, Optional) If True, and the key is not found, the default is stored as well.
* search - (Keyword, Optional) If True, the parent of each OP is searched recursively until a match is found
  ```python
  v = n.fetch('sales5', 0.0)
  ```
```python
fetchOwner(key)→ OP:
```
Return the operator which contains the stored key, or None if not found.
* key - The key to the stored entry you are looking for.
* who = n.fetchOwner('sales5') #find the OP that has a storage entry called 'sales5'

```python
  store(key, value)→ value:
```
Add the key/value pair to the OP's storage dictionary, or replace it if it already exists. If this value is not intended to be saved and loaded in the toe file, it can be be given an alternate value for saving and loading, by using the method storeStartupValue described below.
* key - A string name for the storage entry. Use this name to retrieve the value using fetch().
* value - The value/object to store.

```python
  n.store('sales5', 34.5) # stores a floating point value 34.5.
  n.store('moviebank', op('/project1/movies')) # stores an OP for easy access later on.
```
```python
unstore(keys1, keys2..)→ None:
```
For key, remove it from the OP's storage dictionary. Pattern Matching is supported as well.
* keys - The name or pattern defining which key/value pairs to remove from the storage dictionary.
```python
n.unstore('sales*') # removes all entries from this OPs storage that start with 'sales'
```
```python
storeStartupValue(key, value)→ None:
```
Add the key/value pair to the OP's storage startup dictionary. The storage element will take on this value when the file starts up.
* key - A string name for the storage startup entry.
* value - The startup value/object to store.
```python
  n.storeStartupValue('sales5', 1) # 'sales5' will have a value of 1 when the file starts up.
```
```python
unstoreStartupValue(keys1, keys2..)→ None:
```

For key, remove it from the OP's storage startup dictionary. Pattern Matching is supported as well. This does not affect the stored value, just its startup value.
* keys - The name or pattern defining which key/value pairs to remove from the storage startup dictionary.
```python
n.unstoreStartupValue('sales*') # removes all entries from this OPs storage startup that start with 'sales'
```

以上是关于markdown 存储在TouchDesigner中的主要内容,如果未能解决你的问题,请参考以下文章

markdown TouchDesigner中的模块

python 使用自定义环境值启动TouchDesigner

python touchdesigner-通用代码分割-jobEXT-示例

python touchdesigner-通用代码分割-generalEXT-示例

python 怎么,不至延迟功能于TouchDesigner

python TouchDesigner OP Snippets