CINEMA 4D plugin template wizard.
Main class which provides methods for replacements in the names and contents of files contained within a folder structure.
Get a string with all data entries of the token table, including forms.
Parameters: | indent (int) – how many spaces for indentation. |
---|
Replace tokens in file contents based on rules.py
Parameters: | exclude (string) – if filename (incl. ext) matches this regex, the file is excluded from being processed. Note that self.excluded_files are being skipped by default. |
---|
Do magic token and rule based replacements in file and rootdir names.
A magic token has the form %!Value!% or %!ValueAsForm!% where Value is the value of an entry in the token table and Form a conjugate of that value.
E.g. Value might be PluginName which would result in the plugin’s name as entered by the user.
PluginNameAsID is PluginName taking the form of an ID, meaning it has invalid characters replaced, spaces stripped and converted to CamelCase form.
There are multiple such forms for each magic token. For an overview call print_tokentable().
Parameters: | overwrite (bool) – if True, rename a file or rootdir even if it would replace an already existing file or rootdir. |
---|
Methods for processing and transforming text.
Reduce some string to an abbreviation of a given length. Example:
>>> TextFX.abbreviate('AndisSSuper_PluginSTOP ')
'ASPS'
Parameters: |
|
---|
Decompose Unicode character sequences using either canonical or nominal mapping.
E.g. LATIN SMALL LETTER E WITH ACUTE (U+00E9) becomes LATIN SMALL LETTER E (U+0065) + COMBINING ACUTE ACCENT (U+0301).
Parameters: |
|
---|
Precompose Unicode character sequences, using either canonical or nominal mapping. E.g. LATIN SMALL LETTER E (U+0065) + COMBINING ACUTE ACCENT (U+0301) becomes LATIN SMALL LETTER E WITH ACUTE (U+00E9).
Parameters: |
|
---|
Sanitize word so that it might be used as a filename in an online transfer or in software that needs to work on a restricted set of names for files and other resource descriptors, e.g. only underscores are allowed, no accented characters, etc.
Tries to deal gracefully with higher order characters, such as diacritics so that the original meaning of a word may be preserved better than, for example, just replacing higher order chars with a char deemed safe, like an underbar ‘_’, e.g. given ‘Über’, ‘Ueber’ or ‘Uber’ are generally favorable to ‘_ber’.
Examples:
>>> TextFX.sanitize(u'Äsbëst-Shop')
u'_sb_st-Shop'
>>> TextFX.sanitize(u'Äsbëst-Shop', safechar='')
u'sbst-Shop'
>>> TextFX.sanitize(u'Äsbëst-Shop', safechar='', replace_umlauts=True)
u'Aesbst-Shop'
>>> TextFX.sanitize(u'Äsbëst-Shop', safechar='', replace_umlauts=True, replace_diacritics=True)
u'Aesbest-Shop'
>>> TextFX.sanitize(u'Äsbëst-Shop', safechar='', replace_umlauts=True, replace_diacritics=True, allowed_chars='')
u'AesbestShop'
Parameters: |
|
---|
Split a CamelCaseString into ['Camel', 'Case', 'String'].
Parameters: | word (string) – the string to split |
---|
Convert ‘word’ to CamelCase.
Examples:
>>> TextFX.to_camelcase('hot flaming cats')
'HotFlamingCats'
>>> TextFX.to_camelcase('HotFlamingCats')
'HotFlamingCats'
>>> TextFX.to_camelcase('hotFlamingCats')
'HotFlamingCats'
>>> TextFX.to_camelcase('hot_flaming_cats')
'HotFlamingCats'
>>> TextFX.to_camelcase('Hot Flaming _ Cats')
'HotFlamingCats'
>>> print(TextFX.to_camelcase(u'höt_fläming_cäts', False))
hötFlämingCäts
Parameters: |
|
---|