Jump to content
Developer Wiki and Function Reference Links Read more... ×
Sign in to follow this  
J. Miller

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

Share this post


Link to post

I've not tested this, but if you know the name of the texture beforehand, GetObject() should return a handle to the resource.

Raymond

Share this post


Link to post

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?

Share this post


Link to post

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

Share this post


Link to post

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?

Share this post


Link to post

thanks for the input.

I will give those a try. Sorry my response took so long, but I am only a weekend code warrior.

Jeff

Share this post


Link to post

Okay I'm getting closer. I have the resource list of textures... now i would like to add these items to a popup in my PIO.

Any suggestions?

Thanks in Advance

Jeff

Share this post


Link to post

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.

Share this post


Link to post

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

Share this post


Link to post

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

Share this post


Link to post

One More Time....

Is there a way to re-populate the pop-up upon Selection of the PIO if there have been name changes or additions to the resource list?

Jeff

Share this post


Link to post

Jeff -

You are right: quite a can of worms. Once things are working, though, a very useful can.

As to your question, do you have your vsoWidgetPopupClear and vsoWidgetPopuoAdd calls in a "41" event? Someone may correct me if I'm wrong, but I believe that doing that will do what you want.

Regards -

Share this post


Link to post

Is there a list of Events that the vso call or use and their associated numbers posted somewhere?

Thanks in Advance

Jeff

Share this post


Link to post

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 orso b. schmid

Share this post


Link to post
Regarding event numbers, I've never seen an actual list

you find the event list in the SDK. Sign up and download it.

Every vectorscripter can have only much advantage in studying that carefully.

orso

Share this post


Link to post

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

Share this post


Link to post

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:

Share this post


Link to post

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...

Share this post


Link to post
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

Share this post


Link to post

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

 

7150 Riverwood Drive, Columbia, Maryland 21046, USA   |   Contact Us:   410-290-5114

 

© 2018 Vectorworks, Inc. All Rights Reserved. Vectorworks, Inc. is part of the Nemetschek Group.

×