Commit Graph
6 Commits
Author SHA1 Message Date
Stefan Crooijmans 224b5be09e #15008 Python: Look past abstract classes for an inherited add_folder() override
The generator skipped the typed override only when the direct super
class reported the same return type, and an abstract super class such
as RimPolygonContainer is never instantiated, so the check was skipped
there. It now walks up from the direct super class to the class the
method is registered on and stops at the nearest instantiable ancestor
whose type narrows; the override is skipped when that ancestor already
declares the same type.

The ancestor's type is taken from its dummy object, not from
classMethodsGenerated: the sort of the dummy objects does not order a
class before a subclass whose keyword sorts first (SurfaceCollection and
EnsembleSurface compare equal there), so the ancestor's override may not
be generated yet.

cafPdmScripting_UnitTests: a mock folder hierarchy with an abstract
class between a typed class and a subclass of the same type; the
subclass gets no second override.
2026-11-05 08:50:36 +01:00
Stefan Crooijmans c0dcb78824 #15008 Python: Typed add_folder() and collection_name() for nested collections
The Python generator emits add_folder() again on a concrete collection
class when the folder type narrows: SurfaceCollection.add_folder()
returns SurfaceCollection and PolygonCollection.add_folder() returns
PolygonCollection, while PdmNestedCollectionBase keeps the declared type.
PdmObjectMethod::classKeywordReturnedTypeForSelf() reports the narrowed
type, and the super class method check in the generator accepts such an
override (same arguments, subclass return type).

PdmNestedCollectionBase: subCollectionClassKeyword() names the folder
type without creating one, addNewSubCollection() is a template method
over createSubCollection() and returns PdmNestedCollectionBase*, and the
base virtuals are pure. The leaf polygon containers only override
canAddSubCollection().

collection_name() in rips returns the folder name for every nested
collection; the class specific name attributes are kept.
2026-11-05 08:50:36 +01:00
Kristian Bendiksen 43b63ac4bf #14912 Reject enum names that conflict with module symbols 2026-10-23 15:21:23 +02:00
Kristian Bendiksen 5b229cdf32 #14912 Reject duplicate generated Python enum names 2026-10-23 15:21:23 +02:00
Kristian Bendiksen fb0b05958f Python: Reject ambiguous generated enum names 2026-08-21 11:42:34 +02:00
Magne Sjaastad 2573c17aed #13545 Add Python support for std::pair
- add test for Python generator
- add Python support for std::pair<bool, float/double>
2026-02-04 20:30:45 +01:00