J. Miller Posted April 25, 2009 Share Posted April 25, 2009 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 Quote Link to comment
MullinRJ Posted April 25, 2009 Share Posted April 25, 2009 I've not tested this, but if you know the name of the texture beforehand, GetObject() should return a handle to the resource. Raymond Quote Link to comment
Pat Stanford Posted April 25, 2009 Share Posted April 25, 2009 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? Quote Link to comment
J. Miller Posted April 26, 2009 Author Share Posted April 26, 2009 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 Quote Link to comment
C. Andrew Dunning Posted April 27, 2009 Share Posted April 27, 2009 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? Quote Link to comment
J. Miller Posted May 3, 2009 Author Share Posted May 3, 2009 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 Quote Link to comment
J. Miller Posted May 3, 2009 Author Share Posted May 3, 2009 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 Quote Link to comment
Pat Stanford Posted May 4, 2009 Share Posted May 4, 2009 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. Quote Link to comment
C. Andrew Dunning Posted May 4, 2009 Share Posted May 4, 2009 (edited) 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 May 4, 2009 by C. Andrew Dunning Quote Link to comment
J. Miller Posted May 10, 2009 Author Share Posted May 10, 2009 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 Quote Link to comment
J. Miller Posted May 10, 2009 Author Share Posted May 10, 2009 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 Quote Link to comment
C. Andrew Dunning Posted May 11, 2009 Share Posted May 11, 2009 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 - Quote Link to comment
J. Miller Posted May 12, 2009 Author Share Posted May 12, 2009 Is there a list of Events that the vso call or use and their associated numbers posted somewhere? Thanks in Advance Jeff Quote Link to comment
C. Andrew Dunning Posted May 15, 2009 Share Posted May 15, 2009 Jeff - Regarding event numbers, I've never seen an actual list. The ones I use I've just picked up along the way. You might want to check out http://www.vectorlab.info/index.php?title=Events for a few. Regards - Quote Link to comment
_c_ Posted May 16, 2009 Share Posted May 16, 2009 (edited) 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 May 16, 2009 by _c_ Quote Link to comment
_c_ Posted May 16, 2009 Share Posted May 16, 2009 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 Quote Link to comment
J. Miller Posted May 17, 2009 Author Share Posted May 17, 2009 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 Quote Link to comment
_c_ Posted May 17, 2009 Share Posted May 17, 2009 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: Quote Link to comment
C. Andrew Dunning Posted May 18, 2009 Share Posted May 18, 2009 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... Quote Link to comment
C. Andrew Dunning Posted May 18, 2009 Share Posted May 18, 2009 Orso - Thanks for posting the file names. Quote Link to comment
_c_ Posted May 18, 2009 Share Posted May 18, 2009 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 Quote Link to comment
C. Andrew Dunning Posted May 19, 2009 Share Posted May 19, 2009 Orso - Ya know it's bad when you're aging your kids in "Script Years." "This is my son. He's two scripts old..." ;-) Quote Link to comment
Recommended Posts
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.