Add scripting for custom property types by dogboydog · Pull Request #3971 · mapeditor/tiled (original) (raw)

bjorn

dogboydog

bjorn

@dogboydog @bjorn

@dogboydog @bjorn

@dogboydog @bjorn

@dogboydog @bjorn

…ypes.all instead) and add getter for class property members. getting members of class types does not work though

@dogboydog @bjorn

…s a list of types and move the utility methods for custom types to tiled.project

@dogboydog @bjorn

@dogboydog @bjorn

@bjorn

@bjorn

@bjorn

This way, the type is kept alive by the ScriptPropertyType, which avoids crashes when accessing roaming pointers. Also, since it now has a non-const reference we can make the properties writable.

@dogboydog @bjorn

@dogboydog @bjorn

@dogboydog

…low removing members from a class

@bjorn

@bjorn

Like this it could be somewhat useful, since now the value is typed correctly.

@bjorn

@bjorn

@bjorn

With two overloads, one for raw integer values and one for PropertyValue, for convenience. The latter raises an error if it's not of the right type.

@bjorn

static_cast can be used to access the subclasses instead of storing more specifically typed shared pointers.

@dogboydog

@dogboydog

@dogboydog

@dogboydog

@dogboydog dogboydog marked this pull request as ready for review

March 8, 2025 17:49

@dogboydog

…tence of member setMember, removeMember

@bjorn

Also, convert EditableMapObject* values to ObjectRef when setting class members. I haven't done this when getting the members, because in that case the ObjectRef anyway can't be converted to a EditableMapObject* because there is no context for looking up the object.

@bjorn

1.11.x has been branched so next release from master will be 1.12.

@bjorn

@bjorn

@bjorn

bjorn

@bjorn bjorn mentioned this pull request

Mar 12, 2025

@dogboydog dogboydog deleted the 3419_scripting_custom_types branch

March 14, 2025 17:09

This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.Learn more about bidirectional Unicode characters

[ Show hidden characters]({{ revealButtonHref }})