本文整理汇总了Python中pyTuttle.tuttle.core函数的典型用法代码示例。如果您正苦于以下问题:Python core函数的具体用法?Python core怎么用?Python core使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了core函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Python代码示例。
示例1: generateThumbnail
def generateThumbnail(imgFile):
from pyTuttle import tuttle
tuttle.core().preload(False)
tuttle.compute([
tuttle.NodeInit( "tuttle.pngreader", filename=imgFile),
tuttle.NodeInit( "tuttle.resize", width=256, keepRatio=1),
tuttle.NodeInit( "tuttle.pngwriter", filename=imgFile + "-thumbnail"),
])
开发者ID:waffle-iron,项目名称:ShuttleOFX,代码行数:9,代码来源:views.py
示例2: configLocalPluginPath
def configLocalPluginPath(ofxPluginPaths):
tuttle.core().getPluginCache().addDirectoryToPath(globalOfxPluginPath)
for ofxPluginPath in ofxPluginPaths:
logging.info("ofxPluginPath:" + str(ofxPluginPath))
tuttle.core().getPluginCache().addDirectoryToPath(str(ofxPluginPath))
pluginCache = tuttle.core().getPluginCache()
tuttle.core().getFormatter().setLogLevel_int(5)
tuttle.core().preload(False)
logging.debug('Number of Plugins:' + str(len(pluginCache.getPlugins())))
开发者ID:waffle-iron,项目名称:ShuttleOFX,代码行数:11,代码来源:renderScene.py
示例3: testSimpleProcessGraph
def testSimpleProcessGraph():
graph = tuttle.Graph()
n = [
tuttle.NodeInit( "tuttle.exrreader", filename="TuttleOFX-data/image/openexr/DisplayWindow/t##.exr" ),
tuttle.NodeInit( "tuttle.invert" ),
tuttle.NodeInit( "tuttle.gamma", master=.5 ),
tuttle.NodeInit( "tuttle.jpegwriter", filename=".tests/fromExr/output-####.jpg" ),
]
nodes = graph.addConnectedNodes(n)
procOptions = tuttle.ComputeOptions()
procGraph = tuttle.ProcessGraph(procOptions, graph, [], tuttle.core().getMemoryCache())
print("before compute")
outputCache = tuttle.MemoryCache()
timeRange = tuttle.TimeRange(1, 16, 10)
print("setup")
procGraph.setup()
print("beginSequence")
procGraph.beginSequence(timeRange)
for time in range(timeRange._begin, timeRange._end, timeRange._step):
print("time:", time)
procGraph.setupAtTime(time)
procGraph.processAtTime(outputCache, time)
print("endSequence")
procGraph.endSequence()
print("after compute")
开发者ID:aoblet,项目名称:TuttleOFX,代码行数:30,代码来源:testProcessGraph.py
示例4: testBrowsePlugins
def testBrowsePlugins():
pluginCache = tuttle.core().getPluginCache()
pluginPath = pluginCache.getPluginPath()
print([p for p in pluginPath])
# print([p for p in pluginCache.getPluginPath()]) # BUG binding: TODO
print([p.getIdentifier() for p in pluginCache.getPlugins()])
开发者ID:aoblet,项目名称:TuttleOFX,代码行数:7,代码来源:testBrowsePlugins.py
示例5: _displayFileFormats
def _displayFileFormats(self):
"""
Display all supported input/output file formats.
"""
def getListOfSupportedExtension(ofxhImageEffectNodeDescriptor):
"""
Return list of supported extension from a given plugin descriptor.
"""
propSupportedExtension = ofxhImageEffectNodeDescriptor.getParamSetProps().fetchProperty('TuttleOfxImageEffectPropSupportedExtensions')
return samUtils.getListValues(propSupportedExtension)
supportedExtensions = {'r': [], 'w': []}
for plugin in tuttle.core().getImageEffectPluginCache().getPlugins():
try:
plugin.loadAndDescribeActions()
if plugin.supportsContext('OfxImageEffectContextReader'):
pluginDescriptor = plugin.getDescriptorInContext('OfxImageEffectContextReader')
if pluginDescriptor.getParamSetProps().hasProperty('TuttleOfxImageEffectPropSupportedExtensions'):
supportedExtensions['r'].extend(getListOfSupportedExtension(pluginDescriptor))
elif plugin.supportsContext('OfxImageEffectContextWriter'):
pluginDescriptor = plugin.getDescriptorInContext('OfxImageEffectContextWriter')
if pluginDescriptor.getParamSetProps().hasProperty('TuttleOfxImageEffectPropSupportedExtensions'):
supportedExtensions['w'].extend(getListOfSupportedExtension(pluginDescriptor))
except Exception as e:
self.logger.warning('Cannot load and describe plugin "' + plugin.getIdentifier() + '".')
self.logger.debug(e)
for key, extensions in supportedExtensions.items():
if key == 'r':
self._displayTitle('SUPPORTED INPUT FILE FORMATS')
elif key == 'w':
self._displayTitle('SUPPORTED OUTPUT FILE FORMATS')
puts(', '.join(sorted(set(extensions))))
开发者ID:EfestoLab,项目名称:TuttleOFX,代码行数:32,代码来源:sam_do.py
示例6: testBrowseIEPlugins
def testBrowseIEPlugins():
pluginCache = tuttle.core().getImageEffectPluginCache()
print([p.getDescriptor().getShortLabel() for p in pluginCache.getPlugins()])
print([p.getDescriptor().getLabel() for p in pluginCache.getPlugins()])
print([p.getDescriptor().getLongLabel() for p in pluginCache.getPlugins()])
print([p.getDescriptor().getPluginGrouping() for p in pluginCache.getPlugins()])
开发者ID:aoblet,项目名称:TuttleOFX,代码行数:7,代码来源:testBrowsePlugins.py
示例7: _displayPlugins
def _displayPlugins(self):
"""
Display all available plugins (in alphabetical order), with their versions (v[major].[minor]).
"""
plugins = []
for plugin in tuttle.core().getPlugins():
plugins.append(plugin.getIdentifier().ljust(30) + ' (v' + str(plugin.getVersionMajor()) + '.' + str(plugin.getVersionMinor()) + ')')
for plugin in sorted(set(plugins)):
puts(plugin)
开发者ID:EfestoLab,项目名称:TuttleOFX,代码行数:9,代码来源:sam_do.py
示例8: samDoCompleter
def samDoCompleter(prefix, parsed_args, **kwargs):
"""
Custom Completer to manage auto competion when looking for openFX nodes.
@warning The autocompletion works only for TuttleOFX plugins.
"""
# preload OFX plugins (to have auto completion of plugins name, their parameters...)
tuttle.core().preload(True)
# get plugins
pluginsId = tuttle.core().getImageEffectPluginCache().getPluginsByID()
pluginsStr = [str(id).replace('tuttle.', '') for id in pluginsId]
# check last input in command line
if len(parsed_args.inputs):
lastInput = parsed_args.inputs[-1]
# if last input is a plugin, return its parameters
if lastInput in pluginsStr:
graph = tuttle.Graph()
node = graph.createNode('tuttle.'+lastInput)
params = node.getParams()
paramsStr = [str(param.getScriptName()) for param in params]
return paramsStr
elif lastInput == '//':
return pluginsStr
else:
for input in reversed(parsed_args.inputs):
# if an input is a plugin, get its parameters
if input in pluginsStr:
graph = tuttle.Graph()
node = graph.createNode('tuttle.'+input)
params = node.getParams()
paramsStr = [str(param.getScriptName()) for param in params]
# if last input is one of its parameters, return its choices
if lastInput in paramsStr:
param = node.getParam(lastInput)
if param.getProperties().hasProperty('OfxParamPropChoiceOption'):
propChoiceOption = param.getProperties().fetchProperty('OfxParamPropChoiceOption')
choicesStr = samUtils.getListValues(propChoiceOption)
return choicesStr
# else, return its parameters
else:
return paramsStr
# else return available plugins
return pluginsStr
开发者ID:theomission,项目名称:TuttleOFX,代码行数:44,代码来源:samDoUtils.py
示例9: analyse
def analyse(pluginPath):
'''
Analyse the bundle an return a description for each plugin.
'''
pluginCache = tuttle.core().getPluginCache()
pluginCache.addDirectoryToPath(str(pluginPath))
tuttle.core().getFormatter().setLogLevel_int(5)
tuttle.core().preload(False)
plugins = pluginCache.getPlugins()
logging.warning('pluginCache: %s' % pluginCache)
logging.warning('Analyse plugins: %s' % pluginPath)
logging.warning('Nb plugins: %s' % len(plugins))
pluginsDescription = {'plugins':[], 'total': len(plugins)}
for currentPlugin in plugins:
logging.warning(currentPlugin.getRawIdentifier())
p = Plugin.Plugin(currentPlugin)
pluginsDescription['plugins'].append(p.__dict__)
return pluginsDescription
开发者ID:waffle-iron,项目名称:ShuttleOFX,代码行数:22,代码来源:Bundle.py
示例10: testPluginDescProps
def testPluginDescProps():
"""
Test the 'SupportedExtensions' and 'Evaluation' properties of plugins pluginTurboJpeg and pluginImageMagick.
"""
# test evaluation for pluginTurboJpeg
turboJpeg_plugin = tuttle.core().getImageEffectPluginCache().getPluginByLabel("TuttleTurboJpegReader")
turboJpeg_plugin.loadAndDescribeActions()
turboJpeg_desc = turboJpeg_plugin.getDescriptor()
assert turboJpeg_desc.getProperties().hasProperty("TuttleOfxImageEffectPropSupportedExtensions", True)
assert turboJpeg_desc.getProperties().hasProperty("TuttleOfxImageEffectPropEvaluation", True)
turboJpeg_evaluation = turboJpeg_desc.getProperties().getDoubleProperty("TuttleOfxImageEffectPropEvaluation")
assert_equal(turboJpeg_evaluation, 90)
# test evaluation for pluginImageMagick
imageMagick_plugin = tuttle.core().getImageEffectPluginCache().getPluginByLabel("TuttleImageMagickReader")
imageMagick_plugin.loadAndDescribeActions()
imageMagick_desc = imageMagick_plugin.getDescriptor()
assert imageMagick_desc.getProperties().hasProperty("TuttleOfxImageEffectPropSupportedExtensions", True)
assert imageMagick_desc.getProperties().hasProperty("TuttleOfxImageEffectPropEvaluation", True)
imageMagick_evaluation = imageMagick_desc.getProperties().getDoubleProperty("TuttleOfxImageEffectPropEvaluation")
assert_equal(imageMagick_evaluation, 0)
开发者ID:theomission,项目名称:TuttleOFX,代码行数:23,代码来源:testPluginDescription.py
示例11: getPluginName
def getPluginName(self, logger):
"""
Return complete node name from the pluginId and its arguments.
Plugin's arguments can be used to get best reader/writer.
@note Get best reader if the given name is 'r'.
@note Get best writer if the given name is 'w'.
@exception if cannot find the plugin name which corresponds to the plugin id
"""
if self.isGenericReader() or self.isGenericWriter():
if len(self._arguments) == 0:
logger.warning('Cannot guess the best reader/writer node without any filename specified.')
# get filename
filename = self._arguments[0][1]
# return best reader
if self.isGenericReader():
bestReader = tuttle.getBestReader(filename)
logger.info('Use "' + bestReader + '" to read "' + filename + '".')
return bestReader
# return best writer
elif self.isGenericWriter():
bestWriter = tuttle.getBestWriter(filename)
logger.info('Use "' + bestWriter + '" to write "' + filename + '".')
return bestWriter
else:
pluginsMap = tuttle.core().getImageEffectPluginCache().getPluginsByID()
# get plugins name which match with the given id
pluginNames = []
for pluginName in pluginsMap:
# if the given id exactly matches the plugin id
# plugin id = plugin name without its group
if self._pluginId == pluginName[pluginName.rfind('.') + 1:]:
return pluginName
# else if the given id is contains in the plugin name
elif self._pluginId in pluginName:
pluginNames.append(pluginName)
# one plugin matches
if len(pluginNames) == 1:
return pluginNames[0]
# more than one matches
elif len(pluginNames) > 1:
logger.warning('Cannot guess the best match for plugin name "' + self._pluginId +'".')
logger.warning('Possible choices are: "' + ', '.join(pluginNames) +'".')
# cannot find a best reader/writer or no plugin name matches with the id
raise RuntimeError('Plugin with id "' + self._pluginId + '" not found.')
开发者ID:aoblet,项目名称:TuttleOFX,代码行数:44,代码来源:samDoUtils.py
示例12: setUp
def setUp():
tuttle.core().preload(False)
开发者ID:buttleofx,项目名称:TuttleOFX,代码行数:2,代码来源:testGraphConnections.py
示例13: getImage
from pyTuttle import tuttle
import numpy
import Image
# This is called by Tuttle as an input of the graph
def getImage(time):
img = numpy.asarray( Image.open("data/input.jpg") )
img = numpy.flipud(img)
return (img.tostring(), img.shape[1], img.shape[0], img.strides[0])
tuttle.core().preload()
g = tuttle.Graph()
ib = g.createInputBuffer()
ib.setComponents( tuttle.InputBufferWrapper.ePixelComponentRGB );
ib.setBitDepth( tuttle.InputBufferWrapper.eBitDepthUByte );
ib.setOrientation( tuttle.InputBufferWrapper.eImageOrientationFromTopToBottom );
ib.setPyCallback( getImage )
w = g.createNode("tuttle.pngwriter", filename="foo.png")
g.connect( ib.getNode(), w )
g.compute( w )
开发者ID:NickGenArts,项目名称:TuttleOFX,代码行数:23,代码来源:numpyInputBufferCallback.py
示例14: setUp
def setUp():
print "testComputeTime setUp"
tuttle.core().preload(False)
开发者ID:Achammem,项目名称:TuttleOFX,代码行数:3,代码来源:testComputeTime.py
示例15: getPluginsIdentifiersAsDictionary
def getPluginsIdentifiersAsDictionary():
"""
Returns a dictionary of what we need to display the menu of the node creation.
For each level in the menu we need to have the list of items of the submenu
When the items are plugins, we need to know their label to display, and their identifier to be able to create the node.
So this dictionary returns a tuple :
- if it's a plugin, the tuple is : (pluginLabel, pluginIdentifier)
- if i's a category of plugins, the tuple is : (categoryLabel, "")
The keys of this dictionary are the "paths" of each element of the menu.
Example :
pluginsIdentifiersAsDictionary["buttle/tuttle/"] = ['image', 'param']
pluginsIdentifiersAsDictionary["buttle/tuttle/image/"] = ['io', 'process', 'generator', 'display', 'tool']
pluginsIdentifiersAsDictionary["buttle/tuttle/image/tool/"] = ['tuttle.dummy']
"""
# root label : parent of all plugins
buttleLabel = "buttle/"
# list of all Tuttle's plugins
pluginCache = tuttle.core().getImageEffectPluginCache()
plugins = pluginCache.getPlugins()
# Creation of the dictionary
pluginsIdentifiersAsDictionary = dict()
# if no plugin found we just add the "buttle" key with a message for the user
if len(plugins) == 0:
pluginsIdentifiersAsDictionary[buttleLabel] = []
pluginsIdentifiersAsDictionary[buttleLabel].append(('Error : no plugin found...', False))
return pluginsIdentifiersAsDictionary
for plugin in plugins:
pluginId = plugin.getIdentifier()
# All plugin labels in Tuttle are preceded by 'Tuttle', so we can delete 'Tuttle' from the beginning of the word. It doesn't affect other plugins, not preceded by 'Tuttle'.
pluginLabel = plugin.getDescriptor().getLabel().replace('Tuttle', '', 1)
# We take the path of the plugin's parents (ex: 'tuttle/image/process/')
fullPath = plugin.getDescriptor().getPluginGrouping()
# We split this path to have a list of parents
parentList = None
if fullPath.startswith(' '):
parentList = fullPath[1:].split(' ')
else:
parentList = fullPath.split('/')
# parentLabel is the parentPath of each element of this nex list of parents
parentLabel = buttleLabel
# We browse this list of parents. For each element, we want to create a new entry in the dictionary.
for i in range(len(parentList) + 1):
# only if this parentLabel is not yet in the dictionary, we create a new list for this entry in the dictionary.
if parentLabel not in pluginsIdentifiersAsDictionary:
# if we are not yet at the end of the parentList, then we append the next parent
if i < len(parentList):
pluginsIdentifiersAsDictionary[parentLabel] = []
pluginsIdentifiersAsDictionary[parentLabel].append((parentList[i], ""))
# but if we are at the end of the parentList, then the child is the plugin itself, so we add its identifier.
else:
pluginsIdentifiersAsDictionary[parentLabel] = []
pluginsIdentifiersAsDictionary[parentLabel].append((pluginLabel, pluginId))
# same reasoning, but here the parentLabel is already in the dictionary, we just append the child and not create a new list.
else:
if i < len(parentList):
if parentList[i] not in [p[0] for p in pluginsIdentifiersAsDictionary[parentLabel]]:
pluginsIdentifiersAsDictionary[parentLabel].append((parentList[i], ""))
else:
if pluginId not in [p[1] for p in pluginsIdentifiersAsDictionary[parentLabel]]:
pluginsIdentifiersAsDictionary[parentLabel].append((pluginLabel, pluginId))
# We have created the right entry for this element, and we want to create a new one at the next iteration. So we update the parentLabel for this entry.
if i < len(parentList):
parentLabel = parentLabel + parentList[i] + "/"
# Here we are !
return pluginsIdentifiersAsDictionary
开发者ID:Bazard,项目名称:ButtleOFX,代码行数:74,代码来源:tuttleTools.py
示例16:
from pyTuttle import tuttle
tuttle.core().preload()
pluginCache = tuttle.core().getPluginCache()
print [p for p in pluginCache.getPluginPath()]
print [p.getIdentifier() for p in pluginCache.getPlugins()]
开发者ID:NickGenArts,项目名称:TuttleOFX,代码行数:8,代码来源:browsePlugins.py
示例17: testBrowsePlugins
def testBrowsePlugins():
pluginCache = tuttle.core().getPluginCache()
print [p for p in pluginCache.getPluginPath()]
开发者ID:DIT-Tools,项目名称:TuttleOFX,代码行数:4,代码来源:testBrowsePlugins.py
示例18: start
#!/usr/bin/python
import os
from sys import argv
from pyTuttle import tuttle
tuttle.core().preload(False)
tuttle.core().getFormatter().setLogLevel(tuttle.eVerboseLevelError)
def start():
"""
A callback function
"""
print "One, two, three... Go!"
class ProgressHandle(tuttle.IProgressHandle):
"""
Progress handle that must inherit IProgressHandle
beginSequence(), setupAtTime(), processAtTime() and endSequence() have to
be overwritten
Do whatever you want do in these functions (print, increment var, call
another func...)
See example above
"""
def __init__(self, callback=None):
# Required
super(ProgressHandle, self).__init__()
# Test counter (optional)
self.callback = callback
开发者ID:aoblet,项目名称:TuttleOFX,代码行数:31,代码来源:demo_progress_handle.py
示例19: str
#!/usr/bin/python
from __future__ import print_function
from pyTuttle import tuttle
tuttle.core().preload(False)
for p in tuttle.core().getPlugins():
print(p.getIdentifier().ljust(30) + " (v" + str( p.getVersionMajor() ) + "." + str( p.getVersionMinor() ) + ")")
开发者ID:aoblet,项目名称:TuttleOFX,代码行数:8,代码来源:listPlugins.py
示例20: convertScenePatterns
def convertScenePatterns(scene):
'''
Replace PATTERNS with real filepaths.
:param scene: dict with nodes, params and connections.
:return: (scene, outputFilepaths)
'''
outputScene = copy.deepcopy(scene)
# Preload general plugins to use getBestReader/getBestWriter.
tuttle.core().getPluginCache().addDirectoryToPath(globalOfxPluginPath)
tuttle.core().preload(False)
logging.debug("outputScene: " + str(outputScene))
outputResources = []
for node in outputScene['nodes']:
if 'plugin' in node and node['plugin'] is not 'reader':
logging.debug("Retrieve bundleId from plugin: " + str(node['plugin']))
resp = requests.get(catalogRootUri + "/bundle/" + node['plugin'] + '/bundle')
if resp.status_code == 404:
logging.warning("Cannont retrieve bundleId for plugin: " + str(node['plugin']))
else:
respJson = resp.json()
node["bundleId"] = respJson['bundleId']
logging.debug("bundleId: " + str(respJson['bundleId']))
for parameter in node['parameters']:
logging.warning('param: %s %s', parameter['id'], parameter['value'])
if isinstance(parameter['value'], (str, unicode)):
if 'plugin' not in node and '{RESOURCES_DIR}' in parameter['value']:
parameter['value'] = parameter['value'].replace('{RESOURCES_DIR}', config.resourcesPath)
node['plugin'] = tuttle.getBestReader(str(parameter['value']))
if 'plugin' not in node and '{UNIQUE_OUTPUT_FILE}' in parameter['value']:
node['plugin'] = tuttle.getBestWriter(str(parameter['value']))
# Declare Bundles paths to TuttleOFX
bundleIds = []
for node in outputScene['nodes']:
if 'bundleId' in node:
bundleIds.append(node['bundleId'])
else:
logging.error("No bundle defined for node: " + str(node))
bundlePaths = [os.path.join(pluginsStorage, str(bundleId)) for bundleId in bundleIds]
logging.debug("bundlePaths: " + str(bundlePaths))
configLocalPluginPath(bundlePaths)
logging.debug("outputScene after conversion: " + str(outputScene))
# Create a Tuttle Graph to generate the UID for each node
tuttleGraphTmp = loadGraph(outputScene)
# logging.warning("tuttleGraphTemp" + str(tuttleGraphTmp))
# logging.warning("outputScene" + str(outputScene))
nodesHashMap = tuttle.NodeHashContainer()
tuttleGraphTmp.computeGlobalHashAtTime(nodesHashMap, 0.0)
for node in outputScene['nodes']:
for parameter in node['parameters']:
logging.warning('param: %s %s', parameter['id'], parameter['value'])
if isinstance(parameter['value'], (str, unicode)):
if '{UNIQUE_OUTPUT_FILE}' in parameter['value']:
prefix, suffix = parameter['value'].split('{UNIQUE_OUTPUT_FILE}')
nodeHash = str(nodesHashMap.getHash(node['name'], 0.0))
node['hash'] = nodeHash
filename = nodeHash + suffix
filepath = os.path.join(config.renderDirectory, cache.cachePathFromFile(filename))
outputResources.append(filename)
parameter['value'] = filepath
return (outputScene, outputResources)
开发者ID:waffle-iron,项目名称:ShuttleOFX,代码行数:71,代码来源:renderScene.py
注:本文中的pyTuttle.tuttle.core函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论