def list_actual_nonhidden_params(parms): ''' Return a list of strings for actual non-hidden params. Such a list can subsequently be substituted in macros, or comma separated. ''' ''' For call to wrapped plugin, make a string of actual parameter values. Where author-user, at creation time: - entered values, so constant at runtime (no dialog to wrapping-user.) - chose "Use current" for ephemeral types, so actual parameter is a reference to stack - did NOT chose "Use current" for ephemeral types, generate a runtime lookup of a constant name ''' actual_params = [] for parm in parameters.get_parms_nonhidden(parms): if parm.is_deferred: # deferred. Could be ephemeral # wrapping will have this name as formal parameter. # wrapping will have a dialog to enter actual parameter. # wrapping will assign to this name at runtime. # wrapped will refer to this name in its actual parameters. actual = parm.unique_name # !!!! unique elif parameters.is_ephemeral_type(parm.type): # not deferred but emphemeral actual = make_lookup(parm.type, parm.get_evaluable_value() ) else: # not deferred and not ephemeral, a constant actual = parm.get_evaluable_value() # convert object to evaluable assert actual is not None, str(parm) actual_params.append(actual) return actual_params
def list_actual_nonhidden_params(parms): ''' Return a list of strings for actual non-hidden params. Such a list can subsequently be substituted in macros, or comma separated. ''' ''' For call to wrapped plugin, make a string of actual parameter values. Where author-user, at creation time: - entered values, so constant at runtime (no dialog to wrapping-user.) - chose "Use current" for ephemeral types, so actual parameter is a reference to stack - did NOT chose "Use current" for ephemeral types, generate a runtime lookup of a constant name ''' actual_params = [] for parm in parameters.get_parms_nonhidden(parms): if parm.is_deferred: # deferred. Could be ephemeral # wrapping will have this name as formal parameter. # wrapping will have a dialog to enter actual parameter. # wrapping will assign to this name at runtime. # wrapped will refer to this name in its actual parameters. actual = parm.unique_name # !!!! unique elif parameters.is_ephemeral_type(parm.type): # not deferred but emphemeral actual = make_lookup(parm.type, parm.get_evaluable_value()) else: # not deferred and not ephemeral, a constant actual = parm.get_evaluable_value() # convert object to evaluable assert actual is not None, str(parm) actual_params.append(actual) return actual_params
def make_paramdef_default(parm): ''' Returns a string (for use in generated code) that is a default value for a paramdef. For most types of parameters, author-user enters a value of same type e.g. integer. But for ephemeral types, author-user enters a value of a different type e.g. string. For ephemerals, make a None value, which is a value of all types. That forces wrapping-user to make another choice at wrapping plugin runtime i.e. it is intial value, but not really a default in the sense that it is acceptable. ''' if parameters.is_ephemeral_type(parm.type): return "None" # TODO should it be -1 since PyGimp translates -1 to None? else: return parm.get_evaluable_value() # repr() so a string type is quoted
def make_paramdef_default(parm): ''' Returns a string (for use in generated code) that is a default value for a paramdef. For most types of parameters, author-user enters a value of same type e.g. integer. But for ephemeral types, author-user enters a value of a different type e.g. string. For ephemerals, make a None value, which is a value of all types. That forces wrapping-user to make another choice at wrapping plugin runtime i.e. it is intial value, but not really a default in the sense that it is acceptable. ''' if parameters.is_ephemeral_type(parm.type): return "None" # TODO should it be -1 since PyGimp translates -1 to None? else: return parm.get_evaluable_value() # repr() so a string type is quoted