Jump to content

Fernando

Members
  • Posts

    33
  • Joined

  • Last visited

  • Days Won

    1

Posts posted by Fernando

  1. Hi Yas,

    Thanks for answering.
    I don't really see how I'm supposed to convert the 5 value to sec? Like I understand I can just do: 5*8*60*60=144000 sec, but that's still an integer.
    I've tried converting it to a float, but to no avail.
    In the ftrack documentation they are just using an int as well: https://ftrack-python-api.rtd.ftrack.com/en/2.3.0/working_with_entities.html?highlight=bid#updating-entities
    Maybe I'm misunderstanding and the task['bid'] does not correspond to the "Bid days" in the web UI?

    image.png.0f85413bc72180fb727f37688898e5f5.png

    Cheers,
    Fernando

  2. Hello,

    Using the following way to write the bid day number to a task does not seem to work, the bid days always remain 0.00 in the web UI:

    task['bid'] = 5

    Other attributes - such as the status - do update correctly, so I am sure that I am addressing the correct task.
    I don't receive any error, so I'm confused why this does not work.
    Any idea why this is not working?
    If I need to provide any additional information, I'll be more than happy to provide it

    Cheers,
    Fernando

  3. Hello,

    Previously, I had the following code when creating a new shot (and have similar code for creating an asset/sequence/task):

     

    new_shot = session.create('Shot', {
            'name': shot_code,
            'description': shot_description,
            'parent': ftrack_parent_folder
        })
    ftrack_parent_folder['children'].append(new_shot)
    session.commit()

    This has always worked in the past, but suddenly I have been starting to get the following error:
     

    ftrack_api.exception.DuplicateItemInCollectionError: Item <dynamic ftrack Shot object 139906143642576> already exists in collection <ftrack_api.collection.Collection object at 0x7f3e6fe8f950>

    When adding the shot to the parent folder, in this line:

    ftrack_parent_folder['children'].append(new_shot)


    Does it mean it is no longer necessary to add the shot to the children list of it's parent because it is already added automatically when creating the shot? I've always found it strange that I needed to specifically add the newly created object to its parent as well.

    Cheers,

    Fernando

     

  4. Hello,

    I've been trying to delete a (now empty) test project, but it fails every time.
    From the web ui I select a project and then go to "More" where I try to delete the project, but every time I try this the following message pops up:
    image.png.0f4f28eb98c0726735bf4058af669e39.png

    Additionally, when I tried to delete the root folders containing all the shots and assets within the project, the deletion would also fail.
    I've had to manually delete every asset/shot, because as soon as I tried to delete a few objects at once the process would fail.

    Any idea why this happens?

    Cheers,
    Fernando

  5. Hello,

    I am trying to figure out how I can create new task types through the api. It seems from this example that I should use:

    session.create('TaskTypeSchemaType', {
            'task_type_schema_id': task_schema['id'],
            'type_id': typ['id']
        }

    but in the example the types already exist, how would I create my own type with id? Also shouldn't I give in a name for the type? 
    Just to clarify I would like to create a new task type through the api just like the Create button allows you to do in the System Settings>Types section.

    image.png.1d69976cc1dbbe3629b6b27e1d9be920.png

  6. Hi ,

    I'm basing my code on this cascade status changes hook: https://bitbucket.org/ftrack/ftrack-recipes/src/master/python/events/cascade_status_changes/hook/status_listener_hook.py
    I have the following function that I use to update the status of an "Asset Configuration" entity automatically, it returns the status of the "from entity" of an incoming link:

    asset_configuration_states = ['IN_PROGRESS', 'NOT_STARTED', 'CANCELLED', 'DONE']
    def get_state_name_asset_configuration(link):
        '''Return the short name of *link*'s state, if valid, otherwise None.'''
        try:
            state = link['from']['status']['state']['short']
            print link['from']['name']
            print state
        except KeyError:
            logger.info(u'Child {} has no status'.format(
                ftrack_api.inspection.identity(link['from'])
            ))
            return
        if state not in asset_configuration_states:
            logger.warning(u'Unknown state returned: {}'.format(state))
            return
        return state

    If all the links return DONE then I also update the Asset Configuration to DONE. It seems however that sometimes this function returns the old state of these "from entities" and not the new updated one.

    An example:
    I have an "Asset Configuration" entity with 5 incoming links. 4 of these incoming links have as status DONE, and I change the status of the 5th incoming link from IN_PROGRESS to DONE as well. This triggers the call of the get_state_name_asset_configuration() function which should now only return DONE for all the incoming links, however the 5th link still has as its state IN_PROGRESS.

    I have a similar function for a Shot that checks the status of its sub-tasks just like in the status_listener_hook.py file, and that one works when checking the status of a task. Is the problem that I'm checking the status through a link, and this isn't updated yet at the time of checking? If so is there a way to force them to update before I call this function?

    Edit: after doing some testing it seems to me that Tasks do return their correct status, but entities like Folders/Shots/Sequences do not (they still return their old non updated Status)?

  7. Hello ,

    Is it possible to link a certain version of a folder to another entity?
    Currently I have a folder containing some tasks, and I link that folder to my custom entity. I am now creating versions for the task folder, and would like to 'pin' a certain version to my custom entity. When looking at the incoming links in my custom entity, I would like to know which version of the Task Folder was linked. Is this concept possible to do through the API?

     

×
×
  • Create New...