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

Author Topic: Problem creating new GUI in Editor  (Read 2876 times)

Amarak

  • General Accounts
  • *
  • Posts: 281
    • View Profile
Problem creating new GUI in Editor
« on: Sep 26, 14, 01:18:36 PM »

I was working on Thazager's tutorial https://community.heroengine.com/forums/index.php/topic,4364.0.html creating a DragNDrop system, but ran into a problem I've been trying to solve since last night.

When I get to this point:

In the DOM, create a new (clientside) class
name = TMP_ChestSlot
archtype = guicontrol
add a parent to the class, _GUIIcon
____________________________________________________________________________________

In the GUI editor create a new GUI,
name = TMP_Item
inherited from = _icon
class = TMP_Item

In the properties section of TMP_Item
set texture to    \GUI\tempIventoryIcons.dds
set size to 40, 40
set defaultStatePresentation  color to 1,1,1,1
         size to 96, 128
set allowmove to false

In the GUI editor create a new GUI,
name = TMP_ChestSlot
inherited from = _panel
class = TMP_ChestSlot


In the properties section of TMP_ChestSlot
set texture to    \GUI\inventory_v3.dds
set IgnoreMouseEvents to false
set size to 40, 40
set defaultStatePresentation  color to 1,1,1,1
         pos to 652, 138
         size to 56, 73


I create the TMP_ChestSlot as directed, but it doesn't show in the GUI Editor list. I tried making a couple of other GUI panels the same way with different names, and none of them are showing up in the Editor. I refreshed, closed down the world last night and tried again this morning, still no go. I can't Edit the control (as in the last block of the tutorial above) because it doesn't show up on the list, but I can delete the GUI XML file and try again with the same results.
Logged

Amarak

  • General Accounts
  • *
  • Posts: 281
    • View Profile
Re: Problem creating new GUI in Editor
« Reply #1 on: Sep 26, 14, 01:42:55 PM »

Script Error:
Client Script Error
SCRIPT ERROR: In function CopyClassFieldsOfNode: Destination node did not have requested class to copy in CopyClassFieldsOfNode()
Time:09/26/2014 11:37:50
Call trace:
  Script GUIeditor line 1754 me[0]
starting method/function DATAHASARRIVED
starting me[id=0 invalid]

Console:
11:39:03: SCRIPT:[GUIeditor]:genxml
11:39:03: SCRIPT:[GUIeditor]:No control to create XML for.

Logged

FI-ScottZ

  • General Accounts
  • *
  • Posts: 1407
    • View Profile
    • Forever Interactive, Inc.
Re: Problem creating new GUI in Editor
« Reply #2 on: Sep 26, 14, 03:36:35 PM »

Do you have both the TMP_ChestSlot and TMP_Item classes defined, both with GUIControl as the archetype?
Logged
Scott Zarnke
Lead Programmer, Visions of Zosimos
CTO, Forever Interactive, Inc.

Amarak

  • General Accounts
  • *
  • Posts: 281
    • View Profile
Re: Problem creating new GUI in Editor
« Reply #3 on: Sep 26, 14, 04:46:03 PM »

Yes I do. I've tried making other GUI elements inheriting from _panel and they too don't show up in the Editor.
Logged

Jrome90

  • General Accounts
  • *
  • Posts: 330
    • View Profile
Re: Problem creating new GUI in Editor
« Reply #4 on: Sep 26, 14, 06:34:41 PM »

The only thing I see that may be wrong is that the _GUIIcon has the parent "GUIMovePanel" while the GUI element you are creating is inheriting "_panel
Try editing the xml file and remove the "Inherit from" part

I personally would have the slot use a class that has the parent: "_GUIIconContainer" and inherit nothing when prompted.
Logged

Thazager

  • General Accounts
  • *
  • Posts: 1155
  • Never stop learning
    • View Profile
    • Heroes and Villains MMORPG
Re: Problem creating new GUI in Editor
« Reply #5 on: Sep 26, 14, 07:27:30 PM »

This tutorial most likely needs to be upgraded a bit, so that the GUIs can be copy pasted showing a working model.

This one has been upgraded Updated Icon system and is very similar in how the icons get moved.
Logged

FI-ScottZ

  • General Accounts
  • *
  • Posts: 1407
    • View Profile
    • Forever Interactive, Inc.
Re: Problem creating new GUI in Editor
« Reply #6 on: Sep 26, 14, 08:06:39 PM »

Yeah, the problem is that if you create a control which inherits from another gui prototype and you explicitly specify the class of your new prototype, then that class MUST be equal to or derived from the primary class of the inheritFrom prototype.

You can see this in the line that threw the error:
Code: [Select]
CopyClassFieldsOfNode(newProto, p, getPrimaryClass(p))Looking at the code that leads to that shows that 'p' is the inheritFrom prototype and newProto is the newly created prototype.  As such, the new prototype must have the primary class of the inheritFrom prototype.

As the tutorial is written, it has
Quote
name = TMP_ChestSlot
inherited from = _panel
class = TMP_ChestSlot

_panel is of primary class GUIPanel, and TMP_ChestSlot derives from _GUIIcon, which does not inherit from class GUIPanel.  Q.E.D.



As a side note to this, I find many times people new to the HeroEngine gui system having their controls inherit from _panel unnecessarily.  The _panel prototype has no real structure to contribute, so one would only be "inheriting" GUIPanel as a base class.  If you are going to be explicitly specifying a class for your prototype, you would be better not inheriting from any prototype rather than inheriting from _panel so as to avoid a possible class inheritance conflict like the above.
Logged
Scott Zarnke
Lead Programmer, Visions of Zosimos
CTO, Forever Interactive, Inc.

Amarak

  • General Accounts
  • *
  • Posts: 281
    • View Profile
Re: Problem creating new GUI in Editor
« Reply #7 on: Sep 26, 14, 09:17:25 PM »

Thanks guys, I'll try the Updated system. I was working with this and tried inheriting from _movepanel instead of _panel, and in the Editor it looks fine, but it still refuses to show up in the Editor list, and the GUI XML remains blank even after saving it to the Repository.

I'll try the new one and see how it goes. Thanks again!
Logged

Amarak

  • General Accounts
  • *
  • Posts: 281
    • View Profile
Re: Problem creating new GUI in Editor
« Reply #8 on: Sep 27, 14, 03:15:24 AM »

The updated tutorial works fine. :)
Logged

Thazager

  • General Accounts
  • *
  • Posts: 1155
  • Never stop learning
    • View Profile
    • Heroes and Villains MMORPG
Re: Problem creating new GUI in Editor
« Reply #9 on: Oct 02, 14, 08:19:16 PM »

Item tutorial updated.
Logged

Amarak

  • General Accounts
  • *
  • Posts: 281
    • View Profile
Re: Problem creating new GUI in Editor
« Reply #10 on: Oct 02, 14, 11:34:02 PM »

Thanks Thazager!
Logged