Jump to content

Problem with structs and inherited properties


photo

Recommended Posts

Hello:

  • I've created a new Unigine script project and opened Unigine Editor.
  • I've created three properties (attached in this topic).
  • The inheritance tree is as follows:
    • prop_a (struct_A)
      • prop_b (struct_B)
    • prop_c (struct_C)
  • All the properties defines its own structs.
  • prop_b is defined as manual.
  • I've restarted editor.

Now the problems:

  • If I inherit from prop_b (for example prop_b_0), and try to insert elements in its array, no struct instance is created, I can only see a 0 empty item is placed instead. This is becasuse Unigine isn't able to generate this struct.
  • If I try to reimport prop_a, Unigine Editor shows me in the console some warnings about unused arguments of prop_b(?!).
  • If I remove manual flag in prop_b.prop file and reimport, Unigine Editor allows me to create items in my array parameter. But if I restart Unigine Editor, and reimport prop_a, the warnings are shown again and the prop_b.prop file has been modified (struct_B becomes an empty struct).

This struct modification (or elimination) was done in the previous version (2.8) but we were able to avoid it using the manual flag. Now this is not possible and become a great problem. The only workaround for the moment is to define the child struct in the parent file, but this isn't acceptable for more complex properties trees.

Thanks,
Iván.

data.7z

Link to comment

Hello Iván,

Thank you for your report. I've added this issue to our internal bugtracker with highest priority, and it'll be fixed in upcoming stable release

Sorry for the inconvenience caused.

Link to comment

Hi Ivan,

I see a bug with your prop_b.prop file. The guid "7a54e670c77f470f04ac89229c2776196beee8a4" is incorrect. For the name "prop_b" it must be "6916d77c1f780f560d5ec10a77ea04730c836584" (SHA1). That's the reason some of your problems. Please don't write guids / parent guids when you use manual properties. I think when you open properties in a text editor it is more nice to see normal names like:

<property name="prop_b" parent_name="prop_a" manual="1">

instead of it:

<property name="prop_b" guid="704c6a2cc0e9df9b0d8a103e84f87a85f4db2a20" parent="1c613bbca0afd78c1ef165fc8e419352c5903d9e">


Why do you use usual (not manual) properties to define structures? It is better to use manuals for this. Inherited usual properties are useful for the declaration only (without unique parameters and adding something to it outside the Editor).

Best regards,
Alexander

Link to comment

Hi Alexander:

Thanks for the information.
I've reviewed documentation here and here, and you are right, it was my mistake defining the property.

Anyway, the worst thing it's the wasted time trying to understand what was happening because the warning messages were confusing. So to prevent this doesn't happens to others,  why not to define some rules like:

  • Don't allow struct definition in user properties.
  • Don't allow parent property GUID definition in manual properties.

In this way, I think Unigine could report about these errors easily and help the user to solve the problem quickly.

Best regards,
Iván.

Link to comment
×
×
  • Create New...