Problem with my child paint function?
Blitz3D Forums/Blitz3D Programming/Problem with my child paint function?
| ||
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! :) |
| ||
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. |
| ||
Because I bought the models. |
| ||
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?) |
| ||
It's a model that comes with 2 textures. One for the head, and one for the body. |
| ||
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. |
| ||
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 |
| ||
Open command reference. Read "GetChild". |
| ||
i simply don't know how to paint a child Parental consent, some money, and a large brush normally does the trick. |
| ||
@K, yes, I'm aware of that. but how do I know which child is which? Gfk, ur not funny. not one bit. |
| ||
I had a similar thought to GFK, it is funny, not PMSL levels mind, you just need a sence of humour thats all. |
| ||
I have a sense of humor. im just tired of smart mouths -.- |
| ||
ANYway. Can we PLEASE get back on topic.... Thank you |
| ||
If you have the handle of an object, just paint it |
| ||
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. |
| ||
I get the handle of the child |
| ||
So getchild will be the handle of the object as opposed to obj% = loadanimmesh(objdir$) ? |
| ||
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 |
| ||
Thank you Kryzon! This will do PERFECTLY! :D Case Solved! Thank You all for your help! :) |
| ||
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. |
| ||
Either get on topic, or leave. |
| ||
Oooh, who's the tough guy once he's managed to get what he needs out of people? |
| ||
As ive said MANY times before, i have NOTHING to say to u. |
| ||
My name's K, not U. |
| ||
i wasnt talking to "K". i was talking to lineof7s... -.- |
| ||
Problem solved. Please dont post anymore. |
| ||
Okay. |