Beispiel #1
0
 def __init__(self, args_str):
     self.args = propertyparse.args_string_to_args_dict(args_str)
     self.track = None  # set in creator loops
     self.clip_index = None  # set in creator loops
     self.name = None  # mlt property name. set by extending classes
     self._set_input_range()
     self._set_output_range()
Beispiel #2
0
def get_transition_editable_properties(compositor):
    """
    Creates AbstractProperty extending wrappers for all property tuples in
    mlttransitions.CompositorTransition.
    """
    transition = compositor.transition
    editable_properties = []
    for i in range(0, len(transition.properties)):
        p_name, p_value, p_type = transition.properties[i]
        args_str = transition.info.property_args[p_name]
        params = (compositor, (p_name, p_value, p_type), i, args_str)

        if p_type == mltfilters.PROP_EXPRESSION:
            """
            For expressions we can't do straight input output numerical
            conversion so we need a extending class for expression type.
            """
            args = propertyparse.args_string_to_args_dict(args_str)
            exp_type = args[EXPRESSION_TYPE] # 'exptype' arg missing?. if this fails, it's a bug in compositors.xml
            creator_func = EDITABLE_PROPERTY_CREATORS[exp_type]
            ep = creator_func(params)
        else:
            ep = TransitionEditableProperty(params)
        ep.track = None
        ep.clip_index = None
        editable_properties.append(ep)
    
    return editable_properties
Beispiel #3
0
def get_transition_editable_properties(compositor):
    """
    Creates AbstractProperty extending wrappers for all property tuples in
    mlttransitions.CompositorTransition.
    """
    transition = compositor.transition
    editable_properties = []
    for i in range(0, len(transition.properties)):
        p_name, p_value, p_type = transition.properties[i]
        args_str = transition.info.property_args[p_name]
        params = (compositor, (p_name, p_value, p_type), i, args_str)

        if p_type == mltfilters.PROP_EXPRESSION:
            """
            For expressions we can't do straight input output numerical
            conversion so we need a extending class for expression type.
            """
            args = propertyparse.args_string_to_args_dict(args_str)
            exp_type = args[
                EXPRESSION_TYPE]  # 'exptype' arg missing?. if this fails, it's a bug in compositors.xml
            creator_func = EDITABLE_PROPERTY_CREATORS[exp_type]
            ep = creator_func(params)
        else:
            ep = TransitionEditableProperty(params)
        ep.track = None
        ep.clip_index = None
        editable_properties.append(ep)

    return editable_properties
Beispiel #4
0
 def __init__(self, args_str):
     self.args = propertyparse.args_string_to_args_dict(args_str)
     self.track = None # set in creator loops
     self.clip_index = None # set in creator loops
     self.name = None # mlt property name. set by extending classes
     self._set_input_range()
     self._set_output_range()
Beispiel #5
0
def _create_editable_property(p_type, args_str, params):

    args = propertyparse.args_string_to_args_dict(args_str)

    try:
        exp_type = args[EXPRESSION_TYPE]
    except:
        # This fails for PROP_INT and PROP_FLOAT properties that are edited as keyframe properties.
        # The given exp_type is irrelevant when set for PROP_INT and PROP_FLOAT but causes crashes/undetermined behaviour if exp_type not set correctly in filters.xml
        # when required.
        exp_type = SINGLE_KEYFRAME

    if p_type == appconsts.PROP_EXPRESSION:
        """
        For expressions we can't do straight input output numerical
        conversion so we need an extending class for expression type.
        """
        creator_func = EDITABLE_PROPERTY_CREATORS[exp_type]
        ep = creator_func(params)
    elif exp_type == AFFINE_SCALE:
        ep = AffineScaleProperty(
            params
        )  # This needs special casing because slider input is a number and output value is inverse of input, not a linear range conversion.
    else:
        """
        Properties with single numerical values (int or float) can be handled with objects of EditableProperty class.
        """
        ep = EditableProperty(params)

    return ep
Beispiel #6
0
def _create_editable_property(p_type, args_str, params):
    
    if p_type == appconsts.PROP_EXPRESSION:
        """
        For expressions we can't do straight input output numerical
        conversion so we need a extending class for expression type.
        """
        args = propertyparse.args_string_to_args_dict(args_str)
        
        try:
            exp_type = args[EXPRESSION_TYPE] 
        except:
            # This fails PROP_INT and PROP_FLOAT properties that are edited as keyframe properties and 
            # they will be treated as exptype = SINGLE_KEYFRAME properties.
            # This will now hide 'exptype' args in filters.xml, so they must be there set correctly.
            exp_type = SINGLE_KEYFRAME
        
        creator_func = EDITABLE_PROPERTY_CREATORS[exp_type]
        ep = creator_func(params)
    else:
        """
        Properties with single numerical values (int or float) can be handled with objects of EditableProperty class.
        """
        ep = EditableProperty(params)

    return ep
Beispiel #7
0
    def __init__(self, anim_node):
        self.name = anim_node.getElementsByTagName(NAME_NODE).item(0).firstChild.nodeValue
        self.group = anim_node.getElementsByTagName(GROUP_NODE).item(0).firstChild.nodeValue
        self.project_file = anim_node.getElementsByTagName(NATRON_PROJECT_FILE_NODE).item(0).firstChild.nodeValue
                
        self.property_node_list = anim_node.getElementsByTagName(PROPERTY)
        self.interpretation_node_list = anim_node.getElementsByTagName(INTERPRETATION)

        self.properties = propertyparse.node_list_to_properties_array(self.property_node_list)
        self.property_args = propertyparse.node_list_to_args_dict(self.property_node_list)

        self.length = anim_node.getElementsByTagName(LENGTH_NODE).item(0).firstChild.nodeValue

        # Create dict for interpretations for each property: property name -> (natron_node, natron_property, interpretation, args)
        self.interpretations = {}
        for i_node in self.interpretation_node_list:
            natron_node = i_node.getAttribute(NATRON_NODE_NAME_ATTR)
            natron_property = i_node.getAttribute(NATRON_PROPERTY_NAME_ATTR)
            args_str = i_node.getAttribute(ARGS_ATTR)
            if len(args_str) == 0:
                args = None
            else:
                args = propertyparse.args_string_to_args_dict(args_str)
             
            interpretation = i_node.firstChild.nodeValue
            
            self.interpretations[i_node.getAttribute(NAME_ATTR)] = (natron_node, natron_property, interpretation, args)
    def __init__(self, anim_node):
        self.name = anim_node.getElementsByTagName(NAME_NODE).item(
            0).firstChild.nodeValue
        self.group = anim_node.getElementsByTagName(GROUP_NODE).item(
            0).firstChild.nodeValue
        self.project_file = anim_node.getElementsByTagName(
            NATRON_PROJECT_FILE_NODE).item(0).firstChild.nodeValue

        self.property_node_list = anim_node.getElementsByTagName(PROPERTY)
        self.interpretation_node_list = anim_node.getElementsByTagName(
            INTERPRETATION)

        self.properties = propertyparse.node_list_to_properties_array(
            self.property_node_list)
        self.property_args = propertyparse.node_list_to_args_dict(
            self.property_node_list)

        self.length = anim_node.getElementsByTagName(LENGTH_NODE).item(
            0).firstChild.nodeValue

        # Create dict for interpretations for each property: property name -> (natron_node, natron_property, interpretation, args)
        self.interpretations = {}
        for i_node in self.interpretation_node_list:
            natron_node = i_node.getAttribute(NATRON_NODE_NAME_ATTR)
            natron_property = i_node.getAttribute(NATRON_PROPERTY_NAME_ATTR)
            args_str = i_node.getAttribute(ARGS_ATTR)
            if len(args_str) == 0:
                args = None
            else:
                args = propertyparse.args_string_to_args_dict(args_str)

            interpretation = i_node.firstChild.nodeValue

            self.interpretations[i_node.getAttribute(NAME_ATTR)] = (
                natron_node, natron_property, interpretation, args)
Beispiel #9
0
def _create_editable_property(p_type, args_str, params):
    
    if p_type == appconsts.PROP_EXPRESSION:
        """
        For expressions we can't do straight input output numerical
        conversion so we need a extending class for expression type.
        """
        args = propertyparse.args_string_to_args_dict(args_str)
        exp_type = args[EXPRESSION_TYPE] # 'exptype' arg missing?. if this fails, it's a bug in filters.xml
        creator_func = EDITABLE_PROPERTY_CREATORS[exp_type]
        ep = creator_func(params)
    else:
        ep = EditableProperty(params)

    return ep
Beispiel #10
0
def _create_editable_property(p_type, args_str, params):

    if p_type == appconsts.PROP_EXPRESSION:
        """
        For expressions we can't do straight input output numerical
        conversion so we need a extending class for expression type.
        """
        args = propertyparse.args_string_to_args_dict(args_str)
        exp_type = args[
            EXPRESSION_TYPE]  # 'exptype' arg missing?. if this fails, it's a bug in filters.xml
        creator_func = EDITABLE_PROPERTY_CREATORS[exp_type]
        ep = creator_func(params)
    else:
        ep = EditableProperty(params)

    return ep