Skip to content

Commit

Permalink
add support for kwargs in instance init
Browse files Browse the repository at this point in the history
now instance() and context.create_instance are interchangable, before it would error out since only some kwars were shared.
  • Loading branch information
hannesdelbeke committed Oct 8, 2021
1 parent aaec8a8 commit c33447b
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions pyblish/plugin.py
Original file line number Diff line number Diff line change
Expand Up @@ -770,8 +770,7 @@ def create_instance(self, name, **kwargs):
"""

instance = Instance(name, parent=self)
instance.data.update(kwargs)
instance = Instance(name, parent=self, **kwargs)
return instance

def __getitem__(self, item):
Expand Down Expand Up @@ -820,10 +819,11 @@ class Instance(AbstractEntity):
"""

def __init__(self, name, parent=None):
def __init__(self, name, parent=None, **kwargs):
super(Instance, self).__init__(name, parent)
self._data["family"] = "default"
self._data["name"] = name
self._data.update(kwargs)

def __eq__(self, other):
return self._id == getattr(other, "id", None)
Expand Down

0 comments on commit c33447b

Please sign in to comment.