PDA

View Full Version : Surface texture layers from polyScan



regularfry
03-20-2006, 09:38 AM
Excuse the newbieage, but I'm having a little difficulty with this code:


LWSurfaceID *surf_id;
surf_id = get_Global()->surff->byName(object_filename, surf_name);
if(surf_id){
if(surf_id[0]){

object_filename and surf_name are both valid, and refer to an existing object and surface. get_Global() pulls back a struct with the usual globals in it. However, surf_id[0] is always null. This is... confusing. Anyone got any pointers?

If it helps, this is in a callback from a meshedit->polyScan. I get the feeling I've missed something obvious, but I can't get my head around where it might be.

daxter
03-22-2006, 06:40 AM
your parameters are in wrong order.

surf_id = get_Global()->surff->byName( surf_name, object_filename );
have a look in the sdk doc (http://www.newtek.com/lightwave/developer/LW80/8lwsdk/docs/globals/surface.html).

ColinCohen
03-22-2006, 07:55 AM
I'm not sure what you're doing in get_Global(), but make sure you initialize the surface function global:

surff = global( LWSURFACEFUNCS_GLOBAL, GFUSE_TRANSIENT );

regularfry
03-24-2006, 04:52 AM
your parameters are in wrong order.

surf_id = get_Global()->surff->byName( surf_name, object_filename );

That sound was the noise of palm against forehead. You've got no idea how many times I checked the SDK for what I might be doing wrong...

Thanks for that :-)

regularfry
03-24-2006, 05:02 AM
I'm not sure what you're doing in get_Global(), but make sure you initialize the surface function global:

surff = global( LWSURFACEFUNCS_GLOBAL, GFUSE_TRANSIENT );

It's just a call to a function that returns a pointer to a struct with all my globals in it :-) I do all my global() calls in an init_Global(global) at the entry point of the plugin, so I can barf out quickly if any of them fail.

daxter
03-27-2006, 06:38 AM
Glad I could help! ;)