-
Notifications
You must be signed in to change notification settings - Fork 12
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
houdini: port to use stubgenlib #13
base: master
Are you sure you want to change the base?
Conversation
Previously this used an alternative approach, mostly focused on docstrings. In the new approach we rely heavily on the C++ types embedded in the annotations
We'll need to do a bit of revision here. I can't load the diff to make comments on specific lines of the hou.pyi, so I'll just leave comments in here with the things I notice. |
Enumerated values have gotten lost: class parmBakeChop:
thisown: Any = ...
@staticmethod
def __init__(*args, **kwargs) -> None: ...
__swig_destroy__: Any = ...
CreateDeleteChop: EnumValue = ... ## Added by typing stub update
DisableExportFlag: EnumValue = ... ## Added by typing stub update
KeepExportFlag: EnumValue = ... ## Added by typing stub update
Off: EnumValue = ... ## Added by typing stub update new: class parmBakeChop:
"""
hou.parmBakeChop
Enumeration of Bake Chop modes.
See hou.Parm.keyframesRefit.
VALUES
Off
KeepExportFlag
DisableExportFlag
CreateDeleteChop
"""
thisown: Incomplete
def __init__(self, *args, **kwargs) -> None: ...
__swig_destroy__: Incomplete |
Houdini's hou module has a lot of namespace classes that have class/static methods, but this change has converted them into instance methods: class hda:
thisown: Any = ...
@staticmethod
def __init__(*args, **kwargs) -> None: ...
__swig_destroy__: Any = ...
@staticmethod
def installFile(file_path: str, oplibraries_file: Optional[str]=None, change_oplibraries_file: bool=True, force_use_assets: bool=False) -> None: ...
```
new:
```python
class hda:
"""
hou.hda
Module containing functions related to Houdini Digital Assets.
"""
thisown: Incomplete
def __init__(self, *args, **kwargs) -> None: ...
__swig_destroy__: Incomplete
@staticmethod
def installFile(self, file_path: str, oplibraries_file: Optional[str] = None, change_oplibraries_file: bool = True, force_use_assets: bool = False) -> None: As you can see, the |
There are some methods that are not represented or documented in class hda:
@staticmethod
def reloadHDAModule(hda_module: HDAModule) -> None: ... ## Added by typing stub update and this function is missing entirely from the replacement. You can see the list of methods I've added by hand in Some of those functions are not actually missing, but the docstrings were incorrect, so I redefined them, but each replacement will have a comment like "Redefine" or "Backwards compatibility" or "Missing". I think the ones we care about specifically are the "Missing", but we should do an audit of the backwards compatibility and redefine ones as well. Any of the functions that have been touched in this way will have a comment of |
I think the handling of optional types may have been compromised as well. Example: old: def node(path: str) -> Optional[Node]: ... new: def node(path: str) -> Node:
'''
hou.node
Given a path string, return a Node object. Return None if the path does
not refer to a node.
USAGE
node(path) -> hou.OpNode or None
""" |
I think it would also be good if the docstrings trimmed their whitespace, if possible. It's pretty excessive :-) def simulationEnabled() -> bool:
"""
hou.simulationEnabled
USAGE
simulationEnabled() -> bool
Returns True if Houdini is currently set to update simulations. The user
can choose to disable simulation updates to improve interactivity using
the simulation menu in the bottom right corner of the main window. Use
hou.setSimulationEnabled to enable or disable simulation updates
programmatically.
RELATED
* hou.setSimulationEnabled
""" |
This should be easy to transfer over. I'll take care of that on my flight home. |
Previously this used an alternative approach, mostly focused on docstrings. In the new approach we rely heavily on the C++ types embedded in the annotations.