HeroEngine Forums
Welcome, Guest. Please login or Register for HeroCloud Account.

Author Topic: (Resolved) GUIXML - Adding a class  (Read 1821 times)

Mr_Conflicts

  • General Accounts
  • *
  • Posts: 32
  • Client Programmer
    • View Profile
    • Daniel J. Burkhart
(Resolved) GUIXML - Adding a class
« on: Mar 20, 16, 06:31:53 PM »

Hello, I have recently been working with the basics behind GUI and have run into a problem. Whenever I create a new GUI within the GUI Editor and go back and edit it in the Hero Script Editor I get a problem, but only when I add this to the code:

Code: [Select]
class='Something'
When I add this line of code into the proper place, it makes the GUI prototype issue a "Not Found" error when I go to edit it in the visual editor.

NOTE: I have noticed that glomClass='Something' dose not cause this problem, should I use this instead of class='Something'?
« Last Edit: Mar 23, 16, 02:51:58 PM by AR-Burkhart »
Logged
Anvil of Honor - Client Programmer

Thazager

  • General Accounts
  • *
  • Posts: 1125
  • Never stop learning
    • View Profile
    • Heroes and Villains MMORPG
Re: GUIXML - Adding a class
« Reply #1 on: Mar 20, 16, 07:10:28 PM »

Usually in the GUI (xml file), the class will be the same as the type. When the class is created, any inherited values will continue over to the GUI of the same class as well. If the class assigned to the GUI has any differences or something that is not compatible from the class in the Dom, this will keep the GUI from being created, and give a Not Found.
Logged

ToY-Krun

  • General Accounts
  • *
  • Posts: 677
  • Support Volunteer
    • View Profile
Re: GUIXML - Adding a class
« Reply #2 on: Mar 20, 16, 09:52:51 PM »

daniel, can you post a copy of the xml as well as the class you wish to add to it?

Thanks

FI-ScottZ

  • General Accounts
  • *
  • Posts: 1404
    • View Profile
    • Forever Interactive, Inc.
Re: GUIXML - Adding a class
« Reply #3 on: Mar 20, 16, 10:40:58 PM »

I would say these are the most like culprits:
  • The class was not created with the GUICONTROL archetype.  If that is the case, the class must be deleted and recreated.
  • If the prototype inherits from another gui prototype, the the class of the derived prototype must either be the same class as the inherited type, or derived from that inherited type's class.
Logged
Scott Zarnke
Lead Programmer, Visions of Zosimos
CTO, Forever Interactive, Inc.

Mr_Conflicts

  • General Accounts
  • *
  • Posts: 32
  • Client Programmer
    • View Profile
    • Daniel J. Burkhart
Re: GUIXML - Adding a class
« Reply #4 on: Mar 21, 16, 02:40:30 PM »

Usually in the GUI (xml file), the class will be the same as the type. When the class is created, any inherited values will continue over to the GUI of the same class as well. If the class assigned to the GUI has any differences or something that is not compatible from the class in the Dom, this will keep the GUI from being created, and give a Not Found.

Ah OK, this is good to know, thanks for the information.



daniel, can you post a copy of the xml as well as the class you wish to add to it?

Thanks

Here is the code:

Code: [Select]
<createControlType inheritFrom='_button' type='Forge_Button' description='Forge Online default button.'
 treePath='CleanEngine' name="Forge_Button" texture="\GUI\BasicGUIElements_v1.dds" glomClass='Forge_Button'>
  <position x="428" y="252.727264404"/>
  <size x="237.272720337" y="50.909088135"/>
  <defaultStatePresentation>
    <color r="0.200000003" g="0.200000003" b="0.200000003"/>
    <position x="502" y="237"/>
    <size x="200" y="30"/>
  </defaultStatePresentation>
  <disabledStatePresentation>
    <color r="0.200000003" g="0.200000003" b="0.200000003"/>
    <position x="502" y="237"/>
    <size x="200" y="30"/>
  </disabledStatePresentation>
  <hoverStatePresentation>
    <color r="0.200000003" g="0.200000003" b="0.200000003"/>
    <position x="502" y="237"/>
    <size x="200" y="30"/>
  </hoverStatePresentation>
  <selectedStatePresentation>
    <color r="0.200000003" g="0.200000003" b="0.200000003"/>
    <position x="502" y="237"/>
    <size x="200" y="30"/>
  </selectedStatePresentation>
  <selectedDisabledStatePresentation>
    <color r="0.200000003" g="0.200000003" b="0.200000003"/>
    <position x="502" y="237"/>
    <size x="200" y="30"/>
  </selectedDisabledStatePresentation>
  <selectedHoverStatePresentation>
    <color r="0.200000003" g="0.200000003" b="0.200000003"/>
    <position x="502" y="237"/>
    <size x="200" y="30"/>
  </selectedHoverStatePresentation>
  <set name="Forge_Button.borderTop">
    <size x="237.272720337" y="3.636363506"/>
    <set name='Forge_Button.borderTop' attribute='texture' value="\GUI\BasicGUIElements_v1.dds"/>
    <defaultStatePresentation>
      <position x="499.999969482" y="228.888870239"/>
      <size x="203" y="9"/>
    </defaultStatePresentation>
  </set>
  <set name="Forge_Button.borderTop.topLeft">
    <size x="3.636363506" y="3.636363506"/>
    <set name='Forge_Button.borderTop.topLeft' attribute='texture' value="\GUI\BasicGUIElements_v1.dds"/>
    <defaultStatePresentation>
      <position x="493.703674316" y="228.888885498"/>
      <size x="8.185185432" y="8.259259224"/>
    </defaultStatePresentation>
  </set>
  <set name="Forge_Button.borderTop.topRight">
    <size x="3.636363506" y="3.636363506"/>
    <set name='Forge_Button.borderTop.topRight' attribute='texture' value="\GUI\BasicGUIElements_v1.dds"/>
    <defaultStatePresentation>
      <position x="701" y="237"/>
      <size x="9" y="-8"/>
    </defaultStatePresentation>
  </set>
  <set name="Forge_Button.borderBottom">
    <size x="237.272720337" y="3.636363506"/>
    <set name='Forge_Button.borderBottom' attribute='texture' value="\GUI\BasicGUIElements_v1.dds"/>
    <defaultStatePresentation>
      <position x="500" y="267"/>
      <size x="205" y="8"/>
    </defaultStatePresentation>
  </set>
  <set name="Forge_Button.borderBottom.bottomLeft">
    <size x="3.636363506" y="3.636363506"/>
    <set name='Forge_Button.borderBottom.bottomLeft' attribute='texture' value="\GUI\BasicGUIElements_v1.dds"/>
    <defaultStatePresentation>
      <position x="493.944854736" y="268.773956299"/>
      <size x="6.434760571" y="6.211154938"/>
    </defaultStatePresentation>
  </set>
  <set name="Forge_Button.borderBottom.bottomRight">
    <size x="3.636363506" y="3.636363506"/>
    <set name='Forge_Button.borderBottom.bottomRight' attribute='texture' value="\GUI\BasicGUIElements_v1.dds"/>
    <defaultStatePresentation>
      <position x="703.987976074" y="268.880493164"/>
      <size x="6" y="6.13760519"/>
    </defaultStatePresentation>
  </set>
  <set name="Forge_Button.borderLeft">
    <size x="3.636363506" y="43.636360168"/>
    <set name='Forge_Button.borderLeft' attribute='texture' value="\GUI\BasicGUIElements_v1.dds"/>
    <defaultStatePresentation>
      <position x="493" y="235"/>
      <size x="7" y="34"/>
    </defaultStatePresentation>
  </set>
  <set name="Forge_Button.borderRight">
    <size x="3.636363506" y="43.636360168"/>
    <set name='Forge_Button.borderRight' attribute='texture' value="\GUI\BasicGUIElements_v1.dds"/>
    <defaultStatePresentation>
      <position x="703.913085938" y="235.217407227"/>
      <size x="6.565217018" y="33.260871887"/>
    </defaultStatePresentation>
  </set>
  <set name="Forge_Button.text">
    <defaultStatePresentation>
      <color r="1" g="1" b="1"/>
      <size x="0" y="0"/>
    </defaultStatePresentation>
    <disabledStatePresentation>
      <color r="1" g="1" b="1"/>
      <size x="0" y="0"/>
    </disabledStatePresentation>
    <hoverStatePresentation>
      <size x="0" y="0"/>
    </hoverStatePresentation>
    <selectedStatePresentation>
      <size x="0" y="0"/>
    </selectedStatePresentation>
    <selectedDisabledStatePresentation>
      <size x="0" y="0"/>
    </selectedDisabledStatePresentation>
    <set name='Forge_Button.text' attribute='text' value="Button Text"/>
    <selectedHoverStatePresentation>
      <size x="0" y="0"/>
    </selectedHoverStatePresentation>
  </set>
</createControlType>

And the Forge_ButtonClassMethodsScript (The archetype is guicontrol and it's parent is _GUIButton):

Code: [Select]
// change when the button is clicked on
method OnMouseDown(args references Class GUIMouseEvent)
  target as NodeRef of Class _GUIButton = args.source
  if target <> None
    target.defaultStatePresentation.position.y = 299  // GUI location of pic
    target.hoverStatePresentation.position.y = 237
  .
.

// after click on button
// cant set up in GUI itself as the gui then flickers
// change when the button is clicked on
method OnMouseUp(args references Class GUIMouseEvent)
  target as NodeRef of Class _GUIButton = args.source
  if target <> None
    target.defaultStatePresentation.position.y = 237  // GUI location of pic
    target.hoverStatePresentation.position.y = 299
  .
.

the glomClass='Forge_Button' was added after I created the GUI, I have no idea what its doing.



I would say these are the most like culprits:
  • The class was not created with the GUICONTROL archetype.  If that is the case, the class must be deleted and recreated.
  • If the prototype inherits from another gui prototype, the the class of the derived prototype must either be the same class as the inherited type, or derived from that inherited type's class.

  • I am using the archetype GUIControl.
  • I think this could possibly be it, but I am not sure.
Logged
Anvil of Honor - Client Programmer

ToY-Krun

  • General Accounts
  • *
  • Posts: 677
  • Support Volunteer
    • View Profile
Re: GUIXML - Adding a class
« Reply #5 on: Mar 21, 16, 02:48:08 PM »

try the following.  your custom class should use the same class the control , but give it a try.

I noticed you used _button as the control class which iirc also uses GUIButton.

At any rate if that doesnt work let me know, it can always be changed via xml.

Code: [Select]
<createControlType class='Forge_Button' type='Forge_Button' description='Forge Online default button.'
 treePath='CleanEngine' name="Forge_Button" texture="\GUI\BasicGUIElements_v1.dds" glomClass='Forge_Button'>
  <position x="428" y="252.727264404"/>
  <size x="237.272720337" y="50.909088135"/>
  <defaultStatePresentation>
    <color r="0.200000003" g="0.200000003" b="0.200000003"/>
    <position x="502" y="237"/>
    <size x="200" y="30"/>
  </defaultStatePresentation>
  <disabledStatePresentation>
    <color r="0.200000003" g="0.200000003" b="0.200000003"/>
    <position x="502" y="237"/>
    <size x="200" y="30"/>
  </disabledStatePresentation>
  <hoverStatePresentation>
    <color r="0.200000003" g="0.200000003" b="0.200000003"/>
    <position x="502" y="237"/>
    <size x="200" y="30"/>
  </hoverStatePresentation>
  <selectedStatePresentation>
    <color r="0.200000003" g="0.200000003" b="0.200000003"/>
    <position x="502" y="237"/>
    <size x="200" y="30"/>
  </selectedStatePresentation>
  <selectedDisabledStatePresentation>
    <color r="0.200000003" g="0.200000003" b="0.200000003"/>
    <position x="502" y="237"/>
    <size x="200" y="30"/>
  </selectedDisabledStatePresentation>
  <selectedHoverStatePresentation>
    <color r="0.200000003" g="0.200000003" b="0.200000003"/>
    <position x="502" y="237"/>
    <size x="200" y="30"/>
  </selectedHoverStatePresentation>
  <set name="Forge_Button.borderTop">
    <size x="237.272720337" y="3.636363506"/>
    <set name='Forge_Button.borderTop' attribute='texture' value="\GUI\BasicGUIElements_v1.dds"/>
    <defaultStatePresentation>
      <position x="499.999969482" y="228.888870239"/>
      <size x="203" y="9"/>
    </defaultStatePresentation>
  </set>
  <set name="Forge_Button.borderTop.topLeft">
    <size x="3.636363506" y="3.636363506"/>
    <set name='Forge_Button.borderTop.topLeft' attribute='texture' value="\GUI\BasicGUIElements_v1.dds"/>
    <defaultStatePresentation>
      <position x="493.703674316" y="228.888885498"/>
      <size x="8.185185432" y="8.259259224"/>
    </defaultStatePresentation>
  </set>
  <set name="Forge_Button.borderTop.topRight">
    <size x="3.636363506" y="3.636363506"/>
    <set name='Forge_Button.borderTop.topRight' attribute='texture' value="\GUI\BasicGUIElements_v1.dds"/>
    <defaultStatePresentation>
      <position x="701" y="237"/>
      <size x="9" y="-8"/>
    </defaultStatePresentation>
  </set>
  <set name="Forge_Button.borderBottom">
    <size x="237.272720337" y="3.636363506"/>
    <set name='Forge_Button.borderBottom' attribute='texture' value="\GUI\BasicGUIElements_v1.dds"/>
    <defaultStatePresentation>
      <position x="500" y="267"/>
      <size x="205" y="8"/>
    </defaultStatePresentation>
  </set>
  <set name="Forge_Button.borderBottom.bottomLeft">
    <size x="3.636363506" y="3.636363506"/>
    <set name='Forge_Button.borderBottom.bottomLeft' attribute='texture' value="\GUI\BasicGUIElements_v1.dds"/>
    <defaultStatePresentation>
      <position x="493.944854736" y="268.773956299"/>
      <size x="6.434760571" y="6.211154938"/>
    </defaultStatePresentation>
  </set>
  <set name="Forge_Button.borderBottom.bottomRight">
    <size x="3.636363506" y="3.636363506"/>
    <set name='Forge_Button.borderBottom.bottomRight' attribute='texture' value="\GUI\BasicGUIElements_v1.dds"/>
    <defaultStatePresentation>
      <position x="703.987976074" y="268.880493164"/>
      <size x="6" y="6.13760519"/>
    </defaultStatePresentation>
  </set>
  <set name="Forge_Button.borderLeft">
    <size x="3.636363506" y="43.636360168"/>
    <set name='Forge_Button.borderLeft' attribute='texture' value="\GUI\BasicGUIElements_v1.dds"/>
    <defaultStatePresentation>
      <position x="493" y="235"/>
      <size x="7" y="34"/>
    </defaultStatePresentation>
  </set>
  <set name="Forge_Button.borderRight">
    <size x="3.636363506" y="43.636360168"/>
    <set name='Forge_Button.borderRight' attribute='texture' value="\GUI\BasicGUIElements_v1.dds"/>
    <defaultStatePresentation>
      <position x="703.913085938" y="235.217407227"/>
      <size x="6.565217018" y="33.260871887"/>
    </defaultStatePresentation>
  </set>
  <set name="Forge_Button.text">
    <defaultStatePresentation>
      <color r="1" g="1" b="1"/>
      <size x="0" y="0"/>
    </defaultStatePresentation>
    <disabledStatePresentation>
      <color r="1" g="1" b="1"/>
      <size x="0" y="0"/>
    </disabledStatePresentation>
    <hoverStatePresentation>
      <size x="0" y="0"/>
    </hoverStatePresentation>
    <selectedStatePresentation>
      <size x="0" y="0"/>
    </selectedStatePresentation>
    <selectedDisabledStatePresentation>
      <size x="0" y="0"/>
    </selectedDisabledStatePresentation>
    <set name='Forge_Button.text' attribute='text' value="Button Text"/>
    <selectedHoverStatePresentation>
      <size x="0" y="0"/>
    </selectedHoverStatePresentation>
  </set>
</createControlType>

FI-ScottZ

  • General Accounts
  • *
  • Posts: 1404
    • View Profile
    • Forever Interactive, Inc.
Re: GUIXML - Adding a class
« Reply #6 on: Mar 21, 16, 03:03:24 PM »

Can you show the details of your "Forge_Button" class?
Logged
Scott Zarnke
Lead Programmer, Visions of Zosimos
CTO, Forever Interactive, Inc.

Mr_Conflicts

  • General Accounts
  • *
  • Posts: 32
  • Client Programmer
    • View Profile
    • Daniel J. Burkhart
Re: GUIXML - Adding a class
« Reply #7 on: Mar 21, 16, 03:18:06 PM »

try the following.  your custom class should use the same class the control , but give it a try.

I noticed you used _button as the control class which iirc also uses GUIButton.

At any rate if that doesnt work let me know, it can always be changed via xml.

Code: [Select]
<createControlType class='Forge_Button' type='Forge_Button' description='Forge Online default button.'
 treePath='CleanEngine' name="Forge_Button" texture="\GUI\BasicGUIElements_v1.dds" glomClass='Forge_Button'>
  <position x="428" y="252.727264404"/>
  <size x="237.272720337" y="50.909088135"/>
  <defaultStatePresentation>
    <color r="0.200000003" g="0.200000003" b="0.200000003"/>
    <position x="502" y="237"/>
    <size x="200" y="30"/>
  </defaultStatePresentation>
  <disabledStatePresentation>
    <color r="0.200000003" g="0.200000003" b="0.200000003"/>
    <position x="502" y="237"/>
    <size x="200" y="30"/>
  </disabledStatePresentation>
  <hoverStatePresentation>
    <color r="0.200000003" g="0.200000003" b="0.200000003"/>
    <position x="502" y="237"/>
    <size x="200" y="30"/>
  </hoverStatePresentation>
  <selectedStatePresentation>
    <color r="0.200000003" g="0.200000003" b="0.200000003"/>
    <position x="502" y="237"/>
    <size x="200" y="30"/>
  </selectedStatePresentation>
  <selectedDisabledStatePresentation>
    <color r="0.200000003" g="0.200000003" b="0.200000003"/>
    <position x="502" y="237"/>
    <size x="200" y="30"/>
  </selectedDisabledStatePresentation>
  <selectedHoverStatePresentation>
    <color r="0.200000003" g="0.200000003" b="0.200000003"/>
    <position x="502" y="237"/>
    <size x="200" y="30"/>
  </selectedHoverStatePresentation>
  <set name="Forge_Button.borderTop">
    <size x="237.272720337" y="3.636363506"/>
    <set name='Forge_Button.borderTop' attribute='texture' value="\GUI\BasicGUIElements_v1.dds"/>
    <defaultStatePresentation>
      <position x="499.999969482" y="228.888870239"/>
      <size x="203" y="9"/>
    </defaultStatePresentation>
  </set>
  <set name="Forge_Button.borderTop.topLeft">
    <size x="3.636363506" y="3.636363506"/>
    <set name='Forge_Button.borderTop.topLeft' attribute='texture' value="\GUI\BasicGUIElements_v1.dds"/>
    <defaultStatePresentation>
      <position x="493.703674316" y="228.888885498"/>
      <size x="8.185185432" y="8.259259224"/>
    </defaultStatePresentation>
  </set>
  <set name="Forge_Button.borderTop.topRight">
    <size x="3.636363506" y="3.636363506"/>
    <set name='Forge_Button.borderTop.topRight' attribute='texture' value="\GUI\BasicGUIElements_v1.dds"/>
    <defaultStatePresentation>
      <position x="701" y="237"/>
      <size x="9" y="-8"/>
    </defaultStatePresentation>
  </set>
  <set name="Forge_Button.borderBottom">
    <size x="237.272720337" y="3.636363506"/>
    <set name='Forge_Button.borderBottom' attribute='texture' value="\GUI\BasicGUIElements_v1.dds"/>
    <defaultStatePresentation>
      <position x="500" y="267"/>
      <size x="205" y="8"/>
    </defaultStatePresentation>
  </set>
  <set name="Forge_Button.borderBottom.bottomLeft">
    <size x="3.636363506" y="3.636363506"/>
    <set name='Forge_Button.borderBottom.bottomLeft' attribute='texture' value="\GUI\BasicGUIElements_v1.dds"/>
    <defaultStatePresentation>
      <position x="493.944854736" y="268.773956299"/>
      <size x="6.434760571" y="6.211154938"/>
    </defaultStatePresentation>
  </set>
  <set name="Forge_Button.borderBottom.bottomRight">
    <size x="3.636363506" y="3.636363506"/>
    <set name='Forge_Button.borderBottom.bottomRight' attribute='texture' value="\GUI\BasicGUIElements_v1.dds"/>
    <defaultStatePresentation>
      <position x="703.987976074" y="268.880493164"/>
      <size x="6" y="6.13760519"/>
    </defaultStatePresentation>
  </set>
  <set name="Forge_Button.borderLeft">
    <size x="3.636363506" y="43.636360168"/>
    <set name='Forge_Button.borderLeft' attribute='texture' value="\GUI\BasicGUIElements_v1.dds"/>
    <defaultStatePresentation>
      <position x="493" y="235"/>
      <size x="7" y="34"/>
    </defaultStatePresentation>
  </set>
  <set name="Forge_Button.borderRight">
    <size x="3.636363506" y="43.636360168"/>
    <set name='Forge_Button.borderRight' attribute='texture' value="\GUI\BasicGUIElements_v1.dds"/>
    <defaultStatePresentation>
      <position x="703.913085938" y="235.217407227"/>
      <size x="6.565217018" y="33.260871887"/>
    </defaultStatePresentation>
  </set>
  <set name="Forge_Button.text">
    <defaultStatePresentation>
      <color r="1" g="1" b="1"/>
      <size x="0" y="0"/>
    </defaultStatePresentation>
    <disabledStatePresentation>
      <color r="1" g="1" b="1"/>
      <size x="0" y="0"/>
    </disabledStatePresentation>
    <hoverStatePresentation>
      <size x="0" y="0"/>
    </hoverStatePresentation>
    <selectedStatePresentation>
      <size x="0" y="0"/>
    </selectedStatePresentation>
    <selectedDisabledStatePresentation>
      <size x="0" y="0"/>
    </selectedDisabledStatePresentation>
    <set name='Forge_Button.text' attribute='text' value="Button Text"/>
    <selectedHoverStatePresentation>
      <size x="0" y="0"/>
    </selectedHoverStatePresentation>
  </set>
</createControlType>

this worked, thanks!



Can you show the details of your "Forge_Button" class?

Sure thing:

Name: Forge_Button
Archetype: guicontrol
Description: Forge Online button gui controls.
Parent Class: _GUIButton
Logged
Anvil of Honor - Client Programmer

Thazager

  • General Accounts
  • *
  • Posts: 1125
  • Never stop learning
    • View Profile
    • Heroes and Villains MMORPG
Re: GUIXML - Adding a class
« Reply #8 on: Mar 21, 16, 07:22:05 PM »

When a new class is created class='Forge_Button' and the class inherits from the _guibutton, it does Not have to inherit from the gui also.

Inheriting from the class allows the methods of the class to be used in your class methods with overrides.

Inheriting from the GUI means that the _button gui is copied into your gui as a based structure. You do not have to use this base structure for your base.
Logged

FI-ScottZ

  • General Accounts
  • *
  • Posts: 1404
    • View Profile
    • Forever Interactive, Inc.
Re: GUIXML - Adding a class
« Reply #9 on: Mar 22, 16, 06:06:58 PM »

One thing I see is that you have the base class as 'Forge_Button', and then it is also trying to glom that same class on.  That could be the problem. Try it with the glomClass part removed.
Logged
Scott Zarnke
Lead Programmer, Visions of Zosimos
CTO, Forever Interactive, Inc.

Mr_Conflicts

  • General Accounts
  • *
  • Posts: 32
  • Client Programmer
    • View Profile
    • Daniel J. Burkhart
Re: GUIXML - Adding a class
« Reply #10 on: Mar 23, 16, 02:51:18 PM »

One thing I see is that you have the base class as 'Forge_Button', and then it is also trying to glom that same class on.  That could be the problem. Try it with the glomClass part removed.

I have it worked out now, what Krun suggested worked.
Logged
Anvil of Honor - Client Programmer