Property Template - Description

edited September 27 in General

Hi,
Is it possible to see this property (PropTemplate.description - See first screenshot) as a field/tooltip in the object properties (see second screenshot)?


Borna_Molnar

Comments

  • edited September 28

    Another question/ feature request - It would be fantastic if I could make the values field an enumerated list so that the user can only select from allowed values. I´ve used enumerations in some custom addons that I´ve created before, but I've also hit a roadblock when it comes to dynamically generated enums ( see: https://developer.blender.org/T86803), perhaps someone can guide me in the right direction, i`d be happy to contribute ?

  • edited September 28

    This field is a StringProperty which then gets fed into the API there and written in the IFC file there

    I think if you modified this property to be an Attribute instead and dynamically convert to a string when calling the API this could work ?

    You'd have to add a special usecase / ui elements to choose the data type and populate the enum items though.

    Although since I don't think types other than string are supported, this would not work since the information would be lost when written to the ifc file. ie it would automatically convert to a string field when re-editing the field

  • edited September 28

    @Gorgious - Sorry my screenshot above was wrong. Below is what I meant by enumerations for the property values. According to this and this the types supported include more than just string types (or were you referring to Blender?). In any case, I´ll see whether or not I can´t butcher the code to make this happen ;) Thanks for the pointers.

  • Yeah supporting enums is something we definitely need to do. Currently, the API is hardcoded to only support P_SINGLEVALUES, whereas we need to support P_ENUMERATEDVALUE. Note there are other super fun data types like bounded values, lists, tables, and references. This stuff is hard. To start with, the IFC usecase needs to be fixed: https://github.com/IfcOpenShell/IfcOpenShell/blob/v0.7.0/src/ifcopenshell-python/ifcopenshell/api/pset_template/add_prop_template.py#L18 - then, the relevant Blender UI (with necessary switching from a string field to a collection or whatever) needs to be built.

    As for tooltips, I only recently learned about https://blenderartists.org/t/adding-tooltip-to-an-operator-button/607993/4 - basically we need dynamic tooltips, but for properties, not operators. If someone knows how to achieve this, then I've got a whole list of tooltips for everything (attributes, regular psets) just waiting to be wired up and provide a slick user experience :D

  • I think custom properties tooltips are hardcoded at registration, and the only way to change them dynamically is to hack a re-registration : https://docs.blender.org/api/current/bpy.types.Property.html#bpy.types.Property.description and https://blender.stackexchange.com/a/161533/86891

    Moult
  • Oh I wish I could work this out... Still way beyond my ablities; enumerated values would be really useful for the usecase I have right now...

  • One thing you could do is define your enumeration outside of the ifc file. For example, your list of allowed values for a specific parameter is stored in a file, so when you want to edit a property you could read from the external file to see which parameter is allowed..

  • I also see a lot of value in Enums for properties in property sets. I recently made a 'dynamic' type of Enum for the ifccityjson converter. This specific example checks all LODs available in a CityJSON file and limits the attribute options to these.
    See on Github: the property definition and how to fill the Enum.
    Maybe we can look at this together, how to best support P_ENUMERATEDVALUE in api/BlenderBIM?

    vpajic
  • Not to mention that I'd like to see complex properties soon too :) Support for more IfcProperty types #1422

Sign In or Register to comment.