Jump to content
Developer Wiki and Function Reference Links ×

Get Texture Resource Size


AlHanson

Recommended Posts

I'm attempting to retrieve the size of a texture and the 'Get Texture Size' node seems to fit the bill, but I'm not able to figure out what input the node wants. I've tried the Get Texture node with both the string name and the integer id from this but neither seems to be what the vs.GetTextureSize() command in the node wants. The description and web info for this vectorscipt command are lacking. How do you interact with this node, or if not this node, how can i go about getting the size of a texture resource?

Link to comment

Get Texture Size wants a handle to a texture as the input. If you have a texture on an object in the drawing already, use Get Texture Reference to specify the object and part of the object that has the texture you want the size of.

 

You could also use Get Texture to show a drop down list of textures in the file to select one to get the size of.

 

HTH.

Link to comment

Thanks Pat. I'm still confused- what you described is exactly what I was trying and I'm still coming up with a 0 float value on the Texture Size via both the Get Texture Reference and Get Texture nodes. The iTexRef value both nodes provide the index location for the texture (at least I'm assuming that's what this integer value represents?), which presumably should function as the handle here? The texture is currently set for 1" in the resource, so something is not quite right here. I've attached a test file for reference. 

 

154315440_Annotation2020-08-27201458.thumb.jpg.4e640be627a71bf6350dd810955b67b9.jpg

628491849_Annotation2020-08-27202131.thumb.jpg.de6a61e4592d0f53d1c939606f75365b.jpg

TextureScaling.vwx

Link to comment
  • 2 weeks later...

I stumbled on the solution to this! Seems obvious it hindsight, but I didn't think the Name node would work on items in the Resource Library, only items in the drawing. Using the Name node and referencing the texture resource name will produce the handle you need for the Get Texture Size node to work. This is a bit clunky for scripting (at least as I'm trying to use it) but I made one minor tweak to the Get Texture Size node to pull the handle by name and the whole thing works the way it seems like it should now. I've attached a file with the modified node if it's of any use to anybody else. Enjoy!

 

2116419346_Annotation2020-09-07141602.thumb.jpg.5885c24b1a45a05620cfcc045a157e22.jpg

 

 

 

Get Texture Size v2.vwx

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