MCPcopy Create free account
hub / github.com/TimMcCool/scratchattach / link_arguments

Method link_arguments

scratchattach/editor/mutation.py:361–388  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

359 return _json
360
361 def link_arguments(self):
362 if self.arguments is None:
363 return
364
365 # You only need to fetch argument data if you actually have arguments
366 if len(self.arguments) > 0:
367 if self.arguments[0].name is None:
368 # This requires linking
369 _proc_uses = self.sprite.find_block(self.argument_ids, "argument ids", True)
370 # Note: Sometimes there may not be any argument ids provided. There will be no way to find out the names
371 # Technically, defaults can be found by using the proc code
372 for _use in _proc_uses:
373 if _use.mutation.argument_settings > self.argument_settings:
374 self.arguments = _use.mutation.arguments
375 if int(self.argument_settings) == 3:
376 # If all of our argument data is filled, we can stop early
377 return
378
379 # We can still work out argument defaults from parsing the proc code
380 if self.arguments[0].default is None:
381 _parsed = self.parsed_proc_code
382 _arg_phs: Iterable[ArgumentType] = filter(lambda tkn: isinstance(tkn, ArgumentType), _parsed)
383 for i, _arg_ph in enumerate(_arg_phs):
384 self.arguments[i].default = _arg_ph.default
385
386 for _argument in self.arguments:
387 _argument.mutation = self
388 _argument.link_using_mutation()

Callers 2

set_mutationMethod · 0.80
link_using_spriteMethod · 0.80

Calls 3

filterFunction · 0.85
find_blockMethod · 0.80
link_using_mutationMethod · 0.80

Tested by

no test coverage detected