Jump to content
Developer Wiki and Function Reference Links ×

setting texture bitmaps


Recommended Posts

Hello,

I would like to set the horizontal & vertical repeat to "false" of a texture located in an open file. How does on go about getting a handle to that texture? I assume once i have a handle to the texture i can use the texture edits of

SetTexBitRepHoriz(textureBitmap :HANDLE;repeatHoriz:BOOLEAN);

SetTexBitRepVert (textureBitmap :HANDLE;repeatVert :BOOLEAN);

or maybe i am wrong???

I just can't get a handle to the texture located in the file.

I can get the ID of the texture and its name (when applied to PIO, but I would like to set the texture repeat before applying it to the PIO.

thanks in Advance

Jeff Miller

Link to comment

Check out the Document List Handling section of the Vectorscript Function Reference.

You should be able to use the BuildResourceList to get a list of all the textures in the file. GetResourceFromList will give you a handle.

GetNameFromResourceList (and GetActualName) will let you show the name of the object.

Since you want to do this before the texture is applied, how are you planning to know what texture to do the changes to?

Link to comment

Thanks, I will try these suggestions.

The problem I am having is when I select a texture (in this case an image) from the OIP it applies to the entire PIO. When I ask to add the image thru a bol parameter then I can control the image(scale and offset)of where I actually want to place it, but it still applies to the entire object.I have discovered that if i set the image to NOT repeat horz. & vert. it works better. I don't see the texture anywhere but where i want it to go.

I would like to change the texture when a user 1st applies it to the PIO (not sure hoe to test for this event) prior to actually adding it thru the bol parameter. I just don't seem to be getting a valid handle to the actual texture image.

Jeff

Link to comment

Jeff -

A few comments that may or may not help:

In working w. textures you'll need to be able to get a given texture's index (via Name2Index) and its handle (via GetObject).

Working another way, you get the index of a texture applied to the PIO via GetTextureRef and then the name via Index2Name. Your test to see if a texture has been assigned is to check for an index value >0.

As to setting the repeat, have a look @ SetTexMapBool. This is a VW09 or newer call that allows you to set horizontal or vertical repeat. You'll need the handle of the 3D object onto which you're mapping the texture and the ID of the part of that element being textured.

Make sense? Enough to get you going again?

Link to comment

Not an easy thing to do and maybe not possible.

This is the reason that you still have to use the classes named Style-1 to Style-15 to change the attributes of the parts of the door and window PIOs.

You might be able to get a dialog box to open when you double click the object and use a Modern Dialog Box to pick the texture, but I don't think there is a way to do in directly in the OIP.

Hopefully someone with more direct experience will chime in.

Link to comment

Here are some things that might help you. They are a collection of things that have been shared with me recently by individuals much wiser than myself, so I take very little credit for anything useful below...

First, what you're wanting to do is quite doable.

Second, you'll want to do a little reading. See Shape Pane Page and the calls under "Document List Handling" @ Main Developer Page . The first link includes a link to an example file that may prove to be quite helpful. (It was to me.)

Third, some particulars:

The following will clear the popup you want to populate:

vsoWidgetPopupClear([Widget/Parameter Number]);

The following will fill the popup w. the list of textures you have generated:

[Resource List ID] := BuildResourceList(97,[Folder Index for Resources],[sub-Folder for Resources],[Number of Resources found]);

If [Number of Resources found] <> 0 then

Begin

For [Count] := 0 to [Number of Resources found] DO

BEGIN

vsoWidgetPopupAdd([Widget/Parameter Number],GetNameFromResourceList([Resource List ID],[Count]+1), GetNameFromResourceList([Resource List ID],[Count]+1) );

END;

End;

Re-read the first link, paying attention to the details.

Let us know how things turn out.

Edited by C. Andrew Dunning
Link to comment

Andrew,

That rocks!

I'm not a brain scientist or rocket surgeon, but I did get my pop up to populate. Took a lot of trail and error with all the new vso calls, but i do believe it's going to work the way i want it to.

Now it's just going back to clean it up and and add the user traps to it. Thanks so much for the insight on the vso calls.

I see a lot of potential to them, but they do seem to also open up a very LARGE can (more like a 55 gallon drum) of worms.

Jeff Miller

Link to comment

For most sensible changes you need a handler to the texture space:

GetTextureSpace(object, partID);

Object can be a wall or whatever texturable obj.

partID is:

0 for generic 3D objects

0, 1 for roofs, where: 0=Top, 1=dormer

0, 1, 2 for walls, where: 0=Right, 1=Left, 2=Center

aaah sorry, I see you need the texture bitmap. But that won't bring you much further in editing the texture on object basis.

You cannot load that on the fly in the OIP, that's fix.

You can hard-code the names, how nice would that be.

orso

Edited by _c_
Link to comment

Thank you (esp Andrew) for all who help with this little project that turned into a 4+ weekend project. I have my PIO working to a point that is satisfactory (for now). I need to continue refinement on it especially with the vso calls, but i feel that is going to take a LOT more homework and study.

I never did find the event list in the SDK.

The vso call are quite powerful, but as i was warned they can be very complex.

Funny how a small idea can CONSUME so much time, but heck isn't that why we create scripts anyway... to save time.

I do believe that working with textures is probably the toughest thing I have done with vector script.

Thanks Again

Jeff Miller

I'm sure i will be back for more assistance in the near future

Link to comment

Indeed textures are tough.

You find the events and other useful properties in MiniCadHookIntf.h and ExtendedProperties.h

PS

I have a script which doesn't see its end since 5 years, but every day I believe to be almost finished... It sickens me. :crazy:

Link to comment

Jeff -

You are quite welcome!

I think you have discovered what many have come to accept: things ALWAYS take more time than anticipated. My wife translates "I'll be in my office for a few minutes tinkering with a script idea" to be "I'll see you in a week."

Do you want to share a little about your project? I'm now pretty curious...

Link to comment
My wife translates "I'll be in my office for a few minutes tinkering with a script idea" to be "I'll see you in a week."

I suddenly realized that my son is about to be 9 years old. It didn't even take the time of two scripts!!! :grin:

LOL

orso

Link to comment

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...