Ability to use item preview images as textures

User avatar
MirceaKitsune
Member
 
Posts: 809
Joined: Sat May 21, 2011 22:31
GitHub: MirceaKitsune
IRC: Taoki
In-game: MirceaKitsune

Ability to use item preview images as textures

by MirceaKitsune » Sun Jun 15, 2014 19:28

Thread for issue #1378:

Minetest generates preview images for all items depending on their drawtype, such as an image of the furnace as a cube with its faces textured accordingly. Currently this is only used to show the item on the hotbar and in inventories. The ability to also use generated image previews as textures would be very useful for modding.

One thing this would make possible are 2D representations of the wielded item in player's hands, for mods such as stu's 3D-Armor. Currently, using a Lua entity with the real drawtype and texture of the item doesn't work, since apparently there are issues with attaching things to bones due to Irrlicht. Being able to use the inventory preview as an image in this case would be extremely helpful.

Another thing this would allow are picture frames that you can put items on, similar to those Minecraft recently added. A photo frame can be placed on a wall, then right-clicking it with any item in your hand causes the photo to turn into the inventory preview of that item. Disclaimer: This isn't intended as an instigation at copying Minecraft!
 

User avatar
Casimir
Member
 
Posts: 1101
Joined: Fri Aug 03, 2012 16:59

Re: Ability to use item preview images as textures

by Casimir » Sun Jun 15, 2014 20:01

minetest.inventorycube(img1, img2, img3)
^ Returns a string for making an image of a cube (useful as an item image)

https://github.com/minetest/minetest/bl ... .txt#L1477
 

User avatar
ExeterDad
Member
 
Posts: 1121
Joined: Sun Jun 01, 2014 20:00
In-game: ExeterDad

Re: Ability to use item preview images as textures

by ExeterDad » Sun Jun 15, 2014 20:08

that is a useful find! Thanks!
٩(̾●̮̮̃̾•̃̾)۶

Kibbie and I have a beautiful public server now! HOMETOWN
 

User avatar
webdesigner97
Member
 
Posts: 1307
Joined: Mon Jul 30, 2012 19:16
GitHub: webD97
IRC: webdesigner97
In-game: webdesigner97

Re: Ability to use item preview images as textures

by webdesigner97 » Sun Jun 15, 2014 20:27

Casimir wrote:
minetest.inventorycube(img1, img2, img3)
^ Returns a string for making an image of a cube (useful as an item image)

https://github.com/minetest/minetest/bl ... .txt#L1477

Which only works for drawtype "normal" AFAIK. Nodeboxes and other drawtypes won't work.
 

User avatar
MirceaKitsune
Member
 
Posts: 809
Joined: Sat May 21, 2011 22:31
GitHub: MirceaKitsune
IRC: Taoki
In-game: MirceaKitsune

Re: Ability to use item preview images as textures

by MirceaKitsune » Sun Jun 15, 2014 20:45

webdesigner97 wrote:
Casimir wrote:
minetest.inventorycube(img1, img2, img3)
^ Returns a string for making an image of a cube (useful as an item image)

https://github.com/minetest/minetest/bl ... .txt#L1477

Which only works for drawtype "normal" AFAIK. Nodeboxes and other drawtypes won't work.


I saw that function in the API, but eventually got the impression it's a convenience function to return the textures of a block in a table. If it generates the preview image in realtime this is a good thing, and allows this to be done somewhat!

But like webdesigner97 said, it only works for drawtype_normal from the looks of it, not nodeboxes... so yeah.
 

Sokomine
Member
 
Posts: 2980
Joined: Sun Sep 09, 2012 17:31

Re: Ability to use item preview images as textures

by Sokomine » Mon Jun 16, 2014 02:25

MirceaKitsune wrote:Another thing this would allow are picture frames that you can put items on, similar to those Minecraft recently added. A photo frame can be placed on a wall, then right-clicking it with any item in your hand causes the photo to turn into the inventory preview of that item.

There is an itemframe mod that places entities into a frame. It can be seen in action on VanessaEs servers.

Formspec menus can display inventory images as well. They are not limited to inventory slots. Are you looking for those kind of images?

Regarding textures, it would be great to be able to change a texture to a new one upon a server command. That way, changing seasons like in the 4seasons mod would be a lot easier to handle for the server. Instead of having to change each single dirt and leaf node, it could just tell the client to apply another texture to that node.
A list of my mods can be found here.
 

User avatar
MirceaKitsune
Member
 
Posts: 809
Joined: Sat May 21, 2011 22:31
GitHub: MirceaKitsune
IRC: Taoki
In-game: MirceaKitsune

Re: Ability to use item preview images as textures

by MirceaKitsune » Mon Jun 16, 2014 10:45

Sokomine wrote:There is an itemframe mod that places entities into a frame. It can be seen in action on VanessaEs servers.

Formspec menus can display inventory images as well. They are not limited to inventory slots. Are you looking for those kind of images?

Regarding textures, it would be great to be able to change a texture to a new one upon a server command. That way, changing seasons like in the 4seasons mod would be a lot easier to handle for the server. Instead of having to change each single dirt and leaf node, it could just tell the client to apply another texture to that node.


Didn't know that, need to check it out then! Question is if said itemframe uses pre-made preview images for each item, or if it fetches the generated inventory icons. I'll look at the code since I'm curious myself now.

And yes, I'd like to know how formspecs can display the item icons outside of inventory slots, as images for instance. My curiosity otherwise is if a mesh material (player / Lua entity) can be textured to use it, for things like wielditem support.

[EDIT] Not surprisingly, the Item Frames mod uses a Lua entity of type "wielditem", which I already know about and doesn't involve using the inventory image. So it doesn't tell me anything, although it's a cool mod otherwise!
 

Sokomine
Member
 
Posts: 2980
Joined: Sun Sep 09, 2012 17:31

Re: Ability to use item preview images as textures

by Sokomine » Mon Jun 16, 2014 11:53

MirceaKitsune wrote:And yes, I'd like to know how formspecs can display the item icons outside of inventory slots, as images for instance. My curiosity otherwise is if a mesh material (player / Lua entity) can be textured to use it, for things like wielditem support.

In formspecs, item_image[..] and item_image_button[..] display such an image. Those formspec functions get the item name as a parameter. Making those images available elsewhere sounds like what you're looking for.

MirceaKitsune wrote:[EDIT] Not surprisingly, the Item Frames mod uses a Lua entity of type "wielditem", which I already know about and doesn't involve using the inventory image. So it doesn't tell me anything, although it's a cool mod otherwise!

That's right. It's a very nice mod. The drawback is that each run of clearallobjects requries updating each item frame manually.
A list of my mods can be found here.
 

User avatar
MirceaKitsune
Member
 
Posts: 809
Joined: Sat May 21, 2011 22:31
GitHub: MirceaKitsune
IRC: Taoki
In-game: MirceaKitsune

Re: Ability to use item preview images as textures

by MirceaKitsune » Mon Jun 16, 2014 12:30

Sokomine wrote:In formspecs, item_image[..] and item_image_button[..] display such an image. Those formspec functions get the item name as a parameter. Making those images available elsewhere sounds like what you're looking for.


Aha, good to know. And yes, that's indeed what I was thinking about.
 

prestidigitator
Member
 
Posts: 632
Joined: Thu Feb 21, 2013 23:54

Re: Ability to use item preview images as textures

by prestidigitator » Thu Jul 03, 2014 09:31

I started the texture wiki page after inspecting some of the source code. I THINK the syntax can be used anywhere you can specify a texture, but I can't remember for sure now.
 

User avatar
webdesigner97
Member
 
Posts: 1307
Joined: Mon Jul 30, 2012 19:16
GitHub: webD97
IRC: webdesigner97
In-game: webdesigner97

Re: Ability to use item preview images as textures

by webdesigner97 » Thu Jul 03, 2014 15:02

prestidigitator wrote:I started the texture wiki page after inspecting some of the source code. I THINK the syntax can be used anywhere you can specify a texture, but I can't remember for sure now.

"^" is not an ampersand. This is an ampersand: &
 

prestidigitator
Member
 
Posts: 632
Joined: Thu Feb 21, 2013 23:54

Re: Ability to use item preview images as textures

by prestidigitator » Fri Jul 04, 2014 08:01

webdesigner97 wrote:"^" is not an ampersand. This is an ampersand: &

Right you are. Good catch. Fixed in the wiki ("caret").
 

User avatar
webdesigner97
Member
 
Posts: 1307
Joined: Mon Jul 30, 2012 19:16
GitHub: webD97
IRC: webdesigner97
In-game: webdesigner97

Re: Ability to use item preview images as textures

by webdesigner97 » Fri Jul 04, 2014 09:54

prestidigitator wrote:
webdesigner97 wrote:"^" is not an ampersand. This is an ampersand: &

Right you are. Good catch. Fixed in the wiki ("caret").

Just saw that while reading ;) But the article is interesting! It contains stuff I didn't know about yet...
 


Return to Minetest Features

Who is online

Users browsing this forum: No registered users and 6 guests

cron