Problem with my child paint function?

Blitz3D Forums/Blitz3D Programming/Problem with my child paint function?

Guy Fawkes(Posted 2012) [#1]
Hi all. I've run into a problem with the way my mesh looks. Unfortunately, my mesh comes with 2 textures, as opposed to 1. One for the body, and the other for the head. Now what I want to do is paint the correct texture on to the correct part of the model..

Problem is, this code is only painting the 1 texture on to the model, I simply need it to paint the head texture where the head child is, and the body texture where the body is.

Here's the code:



Any help would be greatly appreciated!

Thanks! :)


Yasha(Posted 2012) [#2]
Any reason you're not just applying the texture in your preferred modelling/animation app? Blitz3D can easily handle sub-mesh textures in the LoadAnimMesh command, very little need to do this at runtime.


Guy Fawkes(Posted 2012) [#3]
Because I bought the models.


Matty(Posted 2012) [#4]
Without seeing the model hard to tell but...

If you bought the model does it come with a single texture and you've tried applying two? Or does it already have two textures one for head and one for body?

Have you tried the paint surface command? - Apply a brush to the correct surface...you may need to find out which texture is applied first with the relevant command (look up the texture commands I can't remember what it is called..or maybe it is under surfaces?)


Guy Fawkes(Posted 2012) [#5]
It's a model that comes with 2 textures. One for the head, and one for the body.


PowerPC603(Posted 2012) [#6]
If you know the names of the head-mesh and body-mesh, it should be easy.
You could use FindChild with the name of the head-mesh, this should return the handle to that mesh.
Then you could use entitytexture or paintmesh to apply another texture to the head.
If that works, you can do the same with the body.

If you need the surface of the mesh, you can use CountSurfaces and GetSurface. Then you can use PaintSurface to paint a texture onto the surface of the head.

But since it comes with 2 textures already, can't you just replace those texture-files with your own textures?
Or to do it in-game:
- free the character entity
- rename the original textures to something else
- rename your textures to the filename used by the mesh you bought
- reload the character
Then the character should be loaded with the new textures already applied.


Guy Fawkes(Posted 2012) [#7]
Well that's essentially what I'm trying to do. I get the handle of the child, but i simply don't know how to paint a child... o.o


K(Posted 2012) [#8]
Open command reference. Read "GetChild".


GfK(Posted 2012) [#9]
i simply don't know how to paint a child
Parental consent, some money, and a large brush normally does the trick.


Guy Fawkes(Posted 2012) [#10]
@K, yes, I'm aware of that. but how do I know which child is which?

Gfk, ur not funny. not one bit.


Ginger Tea(Posted 2012) [#11]
I had a similar thought to GFK, it is funny, not PMSL levels mind, you just need a sence of humour thats all.


Guy Fawkes(Posted 2012) [#12]
I have a sense of humor. im just tired of smart mouths -.-


Guy Fawkes(Posted 2012) [#13]
ANYway. Can we PLEASE get back on topic.... Thank you


H&K(Posted 2012) [#14]
If you have the handle of an object, just paint it


Guy Fawkes(Posted 2012) [#15]
Its not the object I want to paint. its actually the face of the model. I have 2 different textures. 1 for the head, and the other for the rest of the body.


H&K(Posted 2012) [#16]
I get the handle of the child



Guy Fawkes(Posted 2012) [#17]
So getchild will be the handle of the object as opposed to obj% = loadanimmesh(objdir$) ?


Kryzon(Posted 2012) [#18]
For things loaded with LoadAnimMesh, instead of calling them 'meshes', call them 'scenes'.

A scene that was loaded with LoadAnimMesh can contain several objects structured in a hierarchy.
These objects are Pivots, Meshes or Bones.

So the handle you get from LoadAnimMesh is the top-level node. Keep it stored in a variable and don't lose it.
If you want a lower node, you need to use FindChild (= by node name) or GetChild (= by node hierarchy index):
complexCharacter = LoadAnimMesh("complexCharacter.B3D")

head = FindChild(complexCharacter, "head")
leftArm = FindChild(complexCharacter, "leftArm")

PaintEntity head, headBrush
PaintEntity leftArm, leftArmBrush

leftHand = FindChild(leftArm, "hand") ;Getting a child of a child.

PaintEntity leftHand, leftHandBrush

;[...]


Last edited 2012


Guy Fawkes(Posted 2012) [#19]
Thank you Kryzon! This will do PERFECTLY! :D Case Solved! Thank You all for your help! :)


K(Posted 2012) [#20]
im just tired of smart mouths -.-

My mouth is pretty smart. Smarter than my head.
If ever in doubt as to which is which, just do as Gfk suggested and paint them... run yer code, see which one is red or whatever.
Oh, too...
Ahahhahahahahahaaahhhoooho.


Guy Fawkes(Posted 2012) [#21]
Either get on topic, or leave.


LineOf7s(Posted 2012) [#22]
Oooh, who's the tough guy once he's managed to get what he needs out of people?


Guy Fawkes(Posted 2012) [#23]
As ive said MANY times before, i have NOTHING to say to u.


K(Posted 2012) [#24]
My name's K, not U.


Guy Fawkes(Posted 2012) [#25]
i wasnt talking to "K". i was talking to lineof7s... -.-


Guy Fawkes(Posted 2012) [#26]
Problem solved. Please dont post anymore.


LineOf7s(Posted 2012) [#27]
Okay.