Lorenzo Angeli

Administrators
  • Content Count

    219
  • Joined

  • Last visited

  • Days Won

    15

Reputation Activity

  1. Like
    Lorenzo Angeli reacted to Aaron Powell in Opening a file with a custom application action?   
    import logging import ftrack_api import sys import pprint import ftrack_connect.application class ApplicationStore(ftrack_connect.application.ApplicationStore): '''Store used to find and keep track of available applications.''' def _discoverApplications(self): '''Return a list of applications that can be launched from this host.''' applications = [] if sys.platform == 'darwin': prefix = ['/', 'Applications'] applications.extend(self._searchFilesystem( expression=prefix + [ 'Blender*', 'Blender.app' ], label='Blender {version}', applicationIdentifier='blender_{version}' )) elif sys.platform == 'win32': prefix = ['C:\\', 'Program Files.*'] applications.extend(self._searchFilesystem( expression=( prefix + ['Blender Foundation', 'Blender*', 'blender.exe'] ), label='Blender {version}', applicationIdentifier='blender_{version}' )) self.logger.debug( 'Discovered applications:\n{0}'.format( pprint.pformat(applications) ) ) return applications class BlenderAction(object): '''Launch Blender action.''' # Unique action identifier. identifier = 'blender-launch-action' def __debug(self, message): f = open("C:\\Users\\aaron\\Desktop\\output.txt", "a") f.write(pprint.pformat(message)) f.close() def __init__(self, applicationStore, launcher): '''Initialise action with *applicationStore*.''' super(BlenderAction, self).__init__() self.logger = logging.getLogger( __name__ + '.' + self.__class__.__name__ ) self.applicationStore = applicationStore self.launcher = launcher if self.identifier is None: raise ValueError('The action must be given an identifier.') def register(self, session): '''Register action.''' session.event_hub.subscribe( 'topic=ftrack.action.discover', self.discover ) session.event_hub.subscribe( 'topic=ftrack.action.launch and data.actionIdentifier={0}'.format( self.identifier ), self.launch ) self.session = session def is_component(self, selection): if ( len(selection) != 1 or selection[0]['entityType'] != 'Component' ): return False return True def discover(self, event): '''Return action based on *event*.''' launchArguments = [] selection = event['data'].get('selection', []) if self.is_component(selection): component = self.session.get('Component', selection[0]['entityId']) if component is not None: location = self.session.pick_location() url = location.get_filesystem_path(component) launchArguments.append(url) items = [] applications = self.applicationStore.applications applications = sorted( applications, key=lambda application: application['label'] ) for application in applications: applicationIdentifier = application['identifier'] label = application['label'] items.append({ 'actionIdentifier': self.identifier, 'label': label, 'icon': 'http://icons.iconarchive.com/icons/dakirby309/simply-styled/256/Blender-icon.png', 'applicationIdentifier': applicationIdentifier, 'launchArguments': ['c:\\Users\\aaron\\Desktop\\lookdev_addon.blend'] #launchArguments }) return { 'items': items } def launch(self, event): '''Callback method for Blender action.''' applicationIdentifier = ( event['data']['applicationIdentifier'] ) context = event['data'].copy() return self.launcher.launch( applicationIdentifier, context ) class ApplicationLauncher(ftrack_connect.application.ApplicationLauncher): '''Custom launcher to modify environment before launch.''' def __debug(self, message): f = open("C:\\Users\\aaron\\Desktop\\output.txt", "a") f.write(pprint.pformat(message)) f.close() def _getApplicationLaunchCommand(self, application, context=None): command = ftrack_connect.application.ApplicationLauncher._getApplicationLaunchCommand(self, application, context) self.__debug(command) return command def register(session, **kw): '''Register action in Connect.''' # Validate that session is an instance of ftrack_api.Session. If not, assume # that register is being called from an old or incompatible API and return # without doing anything. if not isinstance(session, ftrack_api.Session): return applicationStore = ApplicationStore() launcher = ApplicationLauncher( applicationStore ) action = BlenderAction(applicationStore, launcher) action.register(session) Here's the full hook. To be honest, it's not too much different from the Houdini example in the docs at the moment, which is why I'm not sure what's going on. Let me know if something sticks out.
  2. Like
    Lorenzo Angeli reacted to Mikhail Pasechnik in Golang api   
    Hi, I created ftrack-golang-api https://github.com/conducte/ftrack-golang-api !
    Inspired by ftrack-javascript-api
    Is anyone interested in it?
    Currently EventHub is not implemeted and Entity's represented throught golang map (dictionary) what is a little bit verbose.
    Basic usage of the api:
    package main import ( "flag" "github.com/conducte/ftrack-golang-api/ftrack" "log" ) func main() { apiKey := flag.String("api_key", "", "Ftrack Api Key from Settings -> Api Keys") apiUser := flag.String("api_user", "", "Ftrack Api User username from enabled user") serverUrl := flag.String("server_url", "", "Ftrack Server Url server url eg https://ftrack.com") flag.Parse() // Construct Session from command line arguments session, err := ftrack.NewSession(ftrack.SessionConfig{ ApiKey: *apiKey, ApiUser: *apiUser, ServerUrl: *serverUrl, }) if err != nil { log.Fatal(err) } // Query single Task from server result, err := session.Query("select name, parent.project from Task limit 1") if err != nil { log.Fatal(err) } task := result.Data[0] log.Println("Task: ", task) }
  3. Like
    Lorenzo Angeli reacted to PeterH in I made a class for building the query strings   
    I like the API but I'm not a huge fan of writing the queries as text, so I made something a while back using inspiration from SQLAlchemy.
    As a very quick example, if the original code is this:
    episode = session.query('Episode').first() task_link = session.query('select link from Task where (name not like "%task%" or name is "new") and parent.id is "{}" order by name descending'.format(episode['id'])).first() It would be constructed like this:
    task_link = session.Task.where( or_(~entity.name.like('%task%'), name='new'), parent=session.Episode.first(), ).select(entity.link).sort(entity.name.desc()).first() It's able to do everything I've come across so far, if anyone is interested in using it the github page is here.
  4. Thanks
    Lorenzo Angeli got a reaction from Andrea Perisano in Ftrack for Unity   
    @Andrea Perisano I've been checking an on the upcoming release we are already set to use Python for unity api 2.0 .
    Stay tuned for more info.
    L.
  5. Like
    Lorenzo Angeli reacted to John in Does deleting a ftrack.server component removes the files on server?   
    OK. Thanks @Lorenzo Angeli.
  6. Like
    Lorenzo Angeli got a reaction from jen_at_floyd in Py3K early access   
    @jen_at_floyd we are looking on adding your proposed fix (with few changes) to the api 2.0 branch.
    If you want you can test this before cloning the repo , changing branch and installing it into a virtualenv.

    This fix is likely to end up in the api 2.0 branch soon though, let us know in case you test.
    Cheers.
    L.
  7. Thanks
    Lorenzo Angeli got a reaction from Konstantin Maslyuk in build_ext   
    Glad to hear @Konstantin Maslyuk !
    The branch still requires some tweaks and details, but should soon get to master.
    More news and info on the branch itself
    L.
  8. Like
    Lorenzo Angeli got a reaction from jen_at_floyd in Bug: Multiple instances of ftrack-connect open on Windows   
    Hi @jen_at_floyd, there's a patch already merged in connect to mitigate this and it'll be available in an upcoming version of connect.
  9. Like
    Lorenzo Angeli got a reaction from Chandler in Switch between managed/unmanaged location   
    Hi @Chandler there no boilerplate at the moment, but I'll try to find time new year to come up with one.
    As you find out though, there was one once, and is the one I'll try to bring back to life or close to what that was at least.
    Hope it helps.
    L.
  10. Thanks
    Lorenzo Angeli got a reaction from Alican in Ftrack Review Submission, Resource not found error   
    Hi @Alican
    you cannot use the location.get_url(component) as path for the component as is relative to the server, path requires to be a local path to your file system.
    What you might be after, if I'm getting it right , is an event which collect the data which might have been manually uploaded and then transfer them first to you local disk , before being re uploaded as reviewable. For this to work , you need to have a listener running which will intercept the update event for components and use that to move the data from the ftrack.server to the local storage. Something along these lines should work (https://bitbucket.org/snippets/ftrack/ynxGp4) 

    Hope it helps.
    L.


     
  11. Thanks
    Lorenzo Angeli got a reaction from Alican in Nothing happens after clicking 'Actions'   
    HI @Alican just gave it a go with default connect and actions and I can see them appearing on both Chrome instances I've open (application launchers).
    May I ask where the actions are hosted ? On each ftrack-connect-package plugin folder (local to the user) , in a shared place and mapped through FTRACK_CONNECT_PLUGIN_PATH / FTRACK_EVENT_PLUGIN_PATH or are running as standalone event listeners ?
    Also, to help us investigate, removing custom events and actions does still trigger your issue ?
    Looking forward to hear more from you .
    L.
  12. Like
    Lorenzo Angeli got a reaction from Dan Tennant-Ralphs in 0.2.3   
    Download 0.2.3
    Originally written by Mike Datsik
    What's new
    * Ensure loads correctly under latest version of houdini (18.0)
    * Update to latest QtExt to Fix QStringListModel compatibility for PySide2 5.9+.
    * Update plugin built for pip 19+
    * Update icon path
    How to install
    stop ftrack-connect-package
    download and uncompress the new version in :
    <ftrack-connect-package>/resource/connect-standard-plugins/ 
    restart ftrack-connect-package
  13. Like
    Lorenzo Angeli reacted to TDArlt in Gantt Chart - export   
    A small update for everyone listening here:
    I've made the first steps for creating the Gantt-exporter.
    It's not finished, but might be sufficient for some of you already:
    https://github.com/TDArlt/ftrack/tree/master/ftrack-connect/export-gantt-chart
     
    I will keep you updated 🙂
  14. Thanks
    Lorenzo Angeli got a reaction from John in Fails to encode media   
    Hi @John Su,
    For what I can see it seems you don't have installed ffmpeg on the server, can you please double check ?
    On this subject you can find more information on our documentation: https://help.ftrack.com/en/articles/1040538-installing-ffmpeg-and-ffprobe
    Hope it helps!
    L.
  15. Thanks
    Lorenzo Angeli got a reaction from John in Component path shows up red   
    Hi @John Su, sure you can ! 
    just extract the given script (or download it directly from here ) and drop it in a folder mapped in a  FTRACK_EVENT_PLUGIN_PATH environment variable.
    When the session start will look into that variable to see if there's any plugin to be discovered and run.
    I'd suggest having one folder on a shared server folder mapped so you can simply drop events in there.
    Hope it helps.
    If you need any further help just let us know !
    L.
  16. Like
    Lorenzo Angeli got a reaction from Jason Zheng in Welcome to the Perforce tech preview   
    Welcome to the new integration forum for the Perforce plugin!
    This new plugin provides a seamless integration with Perforce Helix Core in the form of a new storage scenario, allowing artists to publish and retrieve versions straight from it.

    The new integration is packaged as a native ftrack plugin, ready to be dropped in to place.
    This forum will have a new thread published for each release and provide a download link for each build. 

    You can subscribe to this forum section to receive a notification when a new build is added.
    We recommend you use the latest build when available.

    Install
    To install, download the zipped file from the correct version and follow these instructions to get to the plugin folder, then decompress the zip in there.

    Build
    If you want to build from sources, clone the correct branch and run
    python setup.py build_plugin

    Bug report
    When reporting bugs to support, please remember to include:
    Log file Plugin version Connect version Any stack trace or error you are receiving.
  17. Like
    Lorenzo Angeli got a reaction from John in Component path shows up red   
    Hi @John Su, the path is resolved through an event available in ftrack_connect itself and called resolve.py
    If the path is red is possible that your structure cannot be properly initialised and hence not be resolved.
    You can try adding more logs into the resolve.py and see if anything is off.
    Please send us , either here or through support (depending on how sensible the information are) and we'll look further into it.
    Hope it helps.
    Cheers.
    L.
  18. Like
    Lorenzo Angeli got a reaction from cjarv in Py3K early access   
    Please note, the current development status is in Beta stage and is not suitable for production.
    Welcome to the ftrack-python-api tech preview for python 3.x compatibility.
    Here are some brief instructions on how to start testing the upcoming release of the new API.
    We strongly recommend sandboxing the testing environment using virtualenv.

    Prepare your sandbox
    Create a virtualenv with the Python 3 interpreter:
    $ virtualenv -p `which python3.6` ~/ftrack_python_api_py3k Activate virtualenv:
    $ source ~/ftrack_python_api_py3k/bin/activate Install
    Install from the development branch:
    $ pip install git+https://bitbucket.org/ftrack/ftrack-python-api.git@backlog/ftrack-python-api-compatibility-with-python-3 Test
    Run python from virtualenv and check that everything is in place:
    (ftrack_python_api_py3k) $ python -V (ftrack_python_api_py3k) $ Python 3.6.5
    You can now start the Python interpreter and start using the API as usual.
    >>> from ftrack_api import Session >>> session = Session() >>> projects = session.query('Project').all() >>> print(projects) If you need to use the Python3 and the ftrack module just run Python directly from the virtualenv using:
    $ ~/ftrack_python_api_py3k/bin/python3 -c "import ftrack_api;print(ftrack_api.__version__)"

    Bug reporting
    Please use this thread to report issues and bugs.
    When reporting bugs, please remember to include:
    * Operating system in use.
    * Python version in use (use: python -V).
    * Full stack trace or error.
  19. Like
    Lorenzo Angeli got a reaction from Justin Porter in 2D/3D Asset Library   
    Although not web based, one option I can think of would be :
    1) have a project to act as library,
    2) one action which allows to re migrate the assets to/from a given project .
    (could be a reworked version of this example: https://bitbucket.org/ftrack/ftrack-recipes/pull-requests/4)
    This could be extended to keep reference (as metadata or custom attribute) on where the asset originally comes from (as project when publishing back).
    3) a pyside based browser (so can be used as widget in maya, nuke and any other qt based application) to act as library browser.

    Although requires some work, seems doable.
    L.
  20. Like
    Lorenzo Angeli reacted to Martin Pengelly-Phillips in Component/Version/Asset from path   
    We wrote a convenience method for this in our extension of the ftrack API. Might be something we can contribute via pull request.
  21. Like
    Lorenzo Angeli got a reaction from Fredrik Limsater in ftrack connect version 1.1.0   
    Download ftrack-connect-package 1.1.0
    Windows Linux Osx
    What's new ? 
    With this minor release, we have started a long journey for a complete revamp of connect and connector plugins.
    This release mostly focuses on moving the hard-coded connector plugins to standalone connect plugins, so these can be customized and extended by the users as they see fit.
    This release also includes an improvement for the Nuke Studio integration.
     
    Changes:
    ftrack-connect-nuke-studio 2.1.0  Tokens to compose assets names as well as components. Support for multi-track export. Fix Hiero template parser.
      ftrack-connect-maya 1.2.0 converted to connect plugin
      ftrack-connect-nuke 1.2.0  converted to plugin
      ftrack-connect-3dsmax 0.4.0 converted to plugin
      ftrack-connect-hieroplayer 1.3.0 converted to plugin
      ftrack-connect-foundry 1.2.0 remove ftrack-connect from dependency links Known issue
    None reported atm
  22. Like
    Lorenzo Angeli got a reaction from Milad Entezami in 2D/3D Asset Library   
    Although not web based, one option I can think of would be :
    1) have a project to act as library,
    2) one action which allows to re migrate the assets to/from a given project .
    (could be a reworked version of this example: https://bitbucket.org/ftrack/ftrack-recipes/pull-requests/4)
    This could be extended to keep reference (as metadata or custom attribute) on where the asset originally comes from (as project when publishing back).
    3) a pyside based browser (so can be used as widget in maya, nuke and any other qt based application) to act as library browser.

    Although requires some work, seems doable.
    L.
  23. Like
    Lorenzo Angeli got a reaction from Remus Avram in CentOS 7 Connect No Qt Binding Were Found   
    Hi @hulmanen & @AnthonyM this is a good point.
    I'll make sure is going to be added somewhere sensible in the docs.
    Cheers.
    L.
    p.s
    Cheers @Remus Avram