Game Development Community

ShapeBaseImages & guiObjectView MeshHiding

by CSMP · in Torque 3D Professional · 06/29/2011 (5:15 am) · 8 replies

I've been trying to setup weapons with meshHiding and ran into two problems:

First, I've setup a GuiObjectView control and some RadioButtons for enabling/disabling meshes however the weapon is showing up with all of the meshes visible making for one funky looking gun, lol.

Because of the above problem I thought about the Shape Editor Tool and tried to add it instead of the GuiObjectControl but I get this error:
EditTSCtrl::onadd - gizmoProfile was not assigned, cannot create control!
1: Register object failed for object (null) of class GuiShapeEdPreview.


Second, When I mount a weapon on the player its shows up fine with the preset meshes visible though when I try to unhide a mesh the following error appears:
scripts/server/commands.cs (137): Unknown command setMeshHidden.
  Object AK47Image(144) AK47Image -> WeaponImage -> ShapeBaseImageData -> GameBaseData -> SimDataBlock -> SimObject
I'm not sure if anyone else has tried meshHiding on weapons but it seems like a good idea to ask as I'm very tired and about done with this for now.



P.S. MeshHiding needs to be addressed in the documentation.

#1
06/29/2011 (7:37 am)
Can't hide a mesh on a ShapeBaseImage because it doesn't have that
capability. SetMeshHidden is a ShapeBase function, so won't work.

DefineEngineMethod( ShapeBase, setMeshHidden, void, ( const char* name, bool hide )

ShapeBase inherits this way:
class ShapeBase : public GameBase, public ISceneLight

Where as your weapon is a :
struct ShapeBaseImageData: public GameBaseData

Thus it doesn't have the functionality.

To be able to use that feature, you would have to mount the weapon
as an Object -> mountObject(..) and give up the functionality
that the weaponImage system provides :)
#2
06/29/2011 (5:55 pm)
Sadly I expected that, thank you for the explanation and possible workaround... I have existing ways of accomplishing what i need, I was just hoping that setMeshHidden could be used in a wider scope to simplify things. :P
#3
06/30/2011 (1:04 am)
(Note: the following applies to TGE. Still haven't gotten too familiar with T3D's codebase.) That'd be the case if all shapes were shapes. All shapes, in fact, are not shapes... ShapeBase shapes are different from ShapeBaseImages are different (still, I assume) from TSStatics are different from replicated shapes. At some point they probably all boil down to the TSShape class, but different high-level functionality is layered on top of this class.

Adding mesh hiding to ShapeBaseImage shouldn't be too difficult - aside from networking, which is already problematic for Images.
#4
06/30/2011 (3:31 am)
Daniel: Actually, since the mesh hiding was not working for the ShapeBaseImages I was trying to get your "Mount images on images" resource working... as that was my workaround with TGE, though I've been having problems porting it over to T3D.

Truthfully though I would prefer having the MeshHiding capabilities in the ShapeBaseImage class but looking into the code and without a shapeImage.h I dont even know how I would copy/paste the functionality in.(even if it did work that simple)
#5
06/30/2011 (5:22 am)
Its a bit tricky, but all you really want is to display a correct
image (Dts shape) to the player and other players.
The ShapebaseImage basically holds data (including the dts object)
to display during rendering.

Its during the render pass that it actually looks at what Dts object
to display, and that would be the spot to look at. PrepRender area.
Perhaps adding details to the image data to tell it what NOT to display.

#6
06/30/2011 (5:43 am)
Also, I forgot to mention - even were ShapeBaseImage to have a mesh hiding feature, calling it on the datablock object probably wouldn't have any effect ;P.

Quote:Perhaps adding details to the image data to tell it what NOT to display.
If you mean the datablock, then you're still stuck with the problem of making realtime changes to mounted items.

CSMP - are there any key reasons, aside from the state system, that you would use images instead of objects for weapons? I've found that transplanting ShapeBaseImage's state system into the Item class works a treat for weapons. Shoot me an email if you'd like access to my working repository; I don't think I'll have a resource ready in any reasonable amount of time :P. (Although all my work so far is in TGE... not so helpful for the T3D side of things :P. I'm going to port to T3D, hopefully sooner rather than later.)
#7
06/30/2011 (8:30 am)
Thats true about locking it into the DataBlock, but you could treat it
Just like it does firing states and have the option to Select
different bits to display.. Anything is possible, just have to
decide what you want and then write some code to do it.

Of course thats always the fun part, code that works correctly :)
The problem with Mounting Objects with T3D is there seems to be a
problem with the mounting system..
(See an earlier post I did).

It doesn't do any error checking on mounted items properly and
doesn't correctly position on the mount point for some things.
Lights are working semi-correctly, but I've mounted other objects
and ran into problems.
#8
06/30/2011 (10:07 pm)
OK, considering the current situation I've been working on porting the GUI(guiObjectView) aspect of the weapon system that I have already incorporated into TGE View, Now I've run into a problem with guiObjectView not being able to mount multiple objects onto the model, which severely affects "setting up" the custom weapons.

Daniel: Thank you, I'm not completely sure of the pros and cons of transferring classes, but given the weapon works as intended I have no reservation towards one or the other.

John: I have seen your post on mounted objects and does not look promising for the weapon system, I have only started to work on porting this system and I have not gotten far enough for any problems or successes in this area.

My main question now is why wasnt Mesh Hiding included in the ShapeBaseImage class and harnessed in the guiObjectView control?