本文整理汇总了Python中FxStudio类的典型用法代码示例。如果您正苦于以下问题:Python FxStudio类的具体用法?Python FxStudio怎么用?Python FxStudio使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了FxStudio类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: OnEditButtonClicked
def OnEditButtonClicked(self, event):
currentAnimation = Animation(FxStudio.getSelectedAnimGroupName(),
FxStudio.getSelectedAnimName())
audiopath = currentAnimation.absoluteAudioAssetPath
if audiopath.rfind(".") > 0:
textpath = audiopath[:audiopath.rfind(".")] + ".txt"
subprocess.Popen('Notepad {0}'.format(textpath))
示例2: __init__
def __init__(self, animGroupName, animName):
""" Initialize the object by pulling the data from Studio. """
PhonemeList.__init__(self, animGroupName, animName)
wordTuplesFromStudio = FxStudio.getWordList(animGroupName, animName)
self.words = [
Word(w, FxStudio.getPhonemesInWord(animGroupName, animName, i))
for i, w in enumerate(wordTuplesFromStudio)]
示例3: anim_exists
def anim_exists(animpath):
""" Returns true if the animation exists in the actor. """
try:
FxStudio.getAnimationProperties(*split_animpath(animpath))
return True
except RuntimeError:
return False
示例4: render_asset_only_import
def render_asset_only_import(fbx_path):
"A simple import of the FBX as the render asset, without tracking files."
_fail_if_no_ogrefbx()
try:
with FxHelperLibrary.Progress("Importing FBX...") as progress:
progress.update(0.05)
# Convert the base FBX to a render asset. If this fails, the
# exception we will caught before any work is done from the calls
# below. The goal is to warn about the failure without changing
# anything.
import_render_asset(fbx_path, progress)
progress.update(0.7)
# Set the render asset in the actor.
update_render_asset(fbx_path)
progress.update(1.0)
# set the fbx_export_input_file console variable
FxStudio.setConsoleVariable('fbx_export_input_file', fbx_path)
# Make sure we aren't tracking files.
options = PluginOptions()
options.clear()
except (RuntimeError, FBXImportError) as e:
FxStudio.warn(': '.join(['FBXImporter', str(e)]))
示例5: on_drop
def on_drop(files):
"""Handles files dropped on the viewport. """
try:
# If there is not an .fbx file present in the file list, ignore it.
if len([x for x in files if path_has_extension(x, '.fbx')]) == 0:
return
fbx_file = _get_fbx_file(files)
betf_file = _get_betf_file(files)
if not FxStudio.isActorLoaded():
FBXImporter.full_import_fbx(fbx_file, betf_file)
else:
if len(FxStudio.getFaceGraphNodeNames()) > 0:
msg = "Dragging an FBX file onto an empty actor will set up the "
msg += "character for you. Dragging an fbx file onto an actor "
msg += "with an existing face graph will update the render asset. "
msg += "No auto updating will occur. Do you want to continue?"
if FxStudio.displayYesNoBox(msg) == "yes":
FBXImporter.render_asset_only_import(fbx_file)
else:
FBXImporter.full_import_fbx(fbx_file, betf_file)
except FBXImportError as e:
FxStudio.warn(': '.join(['FBXImporter', str(e)]))
示例6: __init__
def __init__(self, parent, id, title):
wx.Window.__init__(self, parent, id, style=wx.NO_BORDER, name=title)
self._sizer = wx.BoxSizer(wx.VERTICAL)
self.shell = IPShellWidget(self, intro='Welcome to the FaceFX IPython Shell.\n\n')
# Turn on STC completion and turn off threading.
self.shell.options['completion']['value'] = 'STC'
self.shell.options['threading']['value'] = 'False'
self.shell.reloadOptions(self.shell.options)
# Turn off the annoying 80 column vertical line.
self.shell.text_ctrl.SetEdgeMode(wx.stc.STC_EDGE_NONE)
self.color_palette = FxStudio.getColorPalette()
self.shell.text_ctrl.StyleSetBackground(wx.stc.STC_STYLE_DEFAULT, self.color_palette['BaseColour1'])
for style in self.shell.text_ctrl.ANSI_STYLES.values():
self.shell.text_ctrl.StyleSetBackground(style[0], self.color_palette['BaseColour1'])
self.shell.text_ctrl.SetCaretForeground('WHITE')
self.shell.text_ctrl.SetWindowStyle(self.shell.text_ctrl.GetWindowStyle() | wx.NO_BORDER)
self.shell.text_ctrl.Refresh()
ip = IPython.ipapi.get()
ip.ex('from FxStudio import *')
self._sizer.Add(self.shell, 1, wx.EXPAND)
self.SetSizer(self._sizer)
self.Bind(wx.EVT_SIZE, self.onSize)
# Hook into the underlying STC and add in the missing mouse capture lost event handler
# to prevent C++ wxWidgets code from asserting. Note that there's not much we can
# do about the selection weirdness that happens if this state is triggered.
self.shell.text_ctrl.Bind(wx.EVT_MOUSE_CAPTURE_LOST, self.onMouseCaptureLost)
self.SetAutoLayout(1)
self.output = FaceFXOnDemandOutputWindow(title="output")
sys.stdout = self.output
sys.stderr = self.output
FxStudio.dockInMainWindowNotebook(self, "Python")
示例7: __init__
def __init__(self, parent, errorAreas):
self.errorIndex = -1
self._init_ctrls(parent)
self.errorAreas = errorAreas
# Define FxStudio signals here.
# Clean up the plugin
FxStudio.connectSignal('appshutdown', self.OnAppShutdown)
示例8: _ensure_exists_actor
def _ensure_exists_actor():
"""Ensure an actor is loaded in Studio. Create one if necessary. """
try:
FxStudio.getActorName()
except RuntimeError:
actor_name = FxStudio.getTextFromUser('Enter new actor name: ',
'Create Actor', 'NewActor')
FxStudio.createNewActor(actor_name)
示例9: get_bone_pose_nodes
def get_bone_pose_nodes():
""" Returns a string with all bone pose node names in the actor separated by '|'
"""
bone_pose_names = ""
for node in FxStudio.getFaceGraphNodeNames():
if FxStudio.getFaceGraphNodeProperties(node)[0] == 'FxBonePoseNode':
bone_pose_names = bone_pose_names + node + '|'
return bone_pose_names
示例10: customizeFaceFX
def customizeFaceFX():
try:
# Note: PEP8 will list the following line as imported but unused but
# this is intentional due to what this code is trying to do. Do not
# remove this line.
import facefxcustomize
except ImportError:
pass # Ignore if facefxcustomize.py wasn't found.
except Exception as e:
FxStudio.error('Caught an exception while trying to import facefxcustomize.py: {0}'.format(str(e)))
示例11: group_to_word
def group_to_word(start_index, end_index, word_text):
""" Issues a FaceFX Studio command to group the phonemes to a word. """
try:
ascii_text = word_text.decode('ascii')
except UnicodeDecodeError:
encodedWord = b64encode(word_text.encode('utf-8'))
word_command = '-wordTextUnicode "{0}"'.format(encodedWord)
else:
word_command = '-wordText "{0}"'.format(ascii_text)
FxStudio.issueCommand('phonList -group -startIndex "{0}" -endIndex "{1}" '
'{2}'.format(start_index, end_index, word_command))
示例12: load
def load():
""" Load the plugin.
"""
if not FxStudio.isCommandLineMode():
# Use this code to add one menu item.
PluginManagerUI.add_export_menu_item(collapsedxmlexporter.MENU_EXPORT_ID,
'Export Collapsed XML Actor...',
collapsedxmlexporter.on_menu_export)
if FxStudio.isNoSave():
PluginManagerUI.disable_export_menu_item(collapsedxmlexporter.MENU_EXPORT_ID)
示例13: OnRemoveBone
def OnRemoveBone(self, event):
posename = self.choice1.GetString(self.choice1.GetSelection())
boneselections = self.listBox1.GetSelections()
boneposecommand = 'bonepose '
if posename == REST_BONE_LABEL:
boneposecommand += '-restpose '
else:
boneposecommand += '-name "' + posename + '" '
boneposecommand += '-removebones "'
for selindex in boneselections:
boneposecommand += self.listBox1.GetString(selindex) + "|"
boneposecommand += '"'
FxStudio.issueCommand(boneposecommand)
self.OnRefresh()
示例14: _export_collapsed_xml
def _export_collapsed_xml(actor_path, xml_file):
""" Exports collapsed XML file.
"""
with Unattended():
with Progress("Collapsing Actor...") as progress:
progress.update(.05)
collapsed_actor = tempfile.gettempdir() + '\\' + os.path.basename(re.sub('\.facefx', '-FG_Collapsed.facefx', actor_path))
bone_pose_names = get_bone_pose_nodes();
# Export a collapsed version of the file.
FxStudio.issueCommand('fgcollapse -file "{0}" -output "{1}" -fn "{2}"'.format(actor_path, collapsed_actor, bone_pose_names))
progress.update(1)
if not os.path.exists(collapsed_actor):
message = 'Could not load collapsed actor! Make sure you have '
message += 'write permsission to the directory: "{0}"'.format(os.path.dirname(collapsed_actor))
raise FxStudio.FaceFXError(message)
# Load the collapsed actor.
FxStudio.issueCommand('loadActor -file "{0}"'.format(collapsed_actor))
FxStudio.issueCommand('actorxml -file "{0}"'.format(xml_file))
# Load the original actor back up.
FxStudio.issueCommand('loadActor -file "{0}"'.format(actor_path))
# Delete the temporary collapsed actor file.
os.remove(collapsed_actor)
示例15: __init__
def __init__(self, parent):
from PluginManager import PLUGIN_MANAGER
self.plugin_manager = PLUGIN_MANAGER
wx.Dialog.__init__(self, parent, wx.ID_ANY, _WINDOW_TITLE,
size=(300, 600))
self.colors = FxStudio.getColorPalette()
self.SetBackgroundColour(self.colors['UIFaceColour'])
self.SetForegroundColour(self.colors['BaseColour8'])
ib = wx.IconBundle()
ib.AddIconFromFile(FxStudio.getAppIconPath(), wx.BITMAP_TYPE_ANY)
self.SetIcons(ib)
self.create_controls()