Getting to know my texture..


#1

With touch xpresso (and a breath of magic), is it possible to have a object look at it’s texture and adopt the textures resolution?


#2

there is a great plugin for cineversity members that imports PS layered files, Plane Smart,and sets up the projection of the textures on planes that are the correct size… It does more than this, but this is one of its features…

Lee


#3

Okay, good man. But is there any way of doing it without spending 300 bucks?


#4

If you’re looking at setting a texture to its aspect ratio,
you could check texiX/texiDRIVER from my sign.

If you want to make planes from textures, NiklasR posted a script here:
http://forums.cgsociety.org/showpost.php?p=7421195&postcount=70

or search for an old script, called: imageplane.

Cheers
Lennart


#5

thanks for the leads…

I just want to make a plane adopt the same x & y size as the bitmap it’s displaying…


#6

The bitmap node allows you to access width/height data, easy to transfer that to a parametric object


#7

brilliant, but what do i need to tag to the filename input node?


#8

Drag and drop the image thumbnail from the material channel into xpresso.
Create a bitmap node and link them up like shown.


#9

cheers for that mate, but i need it to adopt x & y size of the texture associated to it.

The bitmap node needs a file name and i cannot work out how to get that from the tag at the end of the object?!


#10

You don’t drag it from the material tag, you drag it from the attributes manager.
Dropping it in a blank area of the xpresso manager will create a new node.


#11

herin lies my problem. I need this to work on its own, as i need loads of them.

What i would like to be able to do is duplicate the plane, drop a new texture on the end and the dimensions of the plane change to the dimensions of the new texture…

Thanks for your help. I am quite savvy with xpresso, but i’ve never been down this avenue before…


#12

Gotcha.
I thought you must be dealing with a lot of them, I was imagining some big iteration setup.
No idea how to link it to the texture applied to an object however.


#13

me also not…


#14

Add this in a python expression tag.
Place the tag on a Plane Object and its
dimensions are set from the Color channel
of the material in the Texture tag placed at the Plane Object.


# Set Plane Object dimensions from Texturetags Material ColorChannel

import c4d
from c4d import bitmaps
#Welcome to the world of Python


def main():
    plane    = op.GetObject()
    if not plane.CheckType(c4d.Oplane):
        return False
    textag   = plane.GetTag(c4d.Ttexture)
    if not textag:
        return False
    mat      = textag[c4d.TEXTURETAG_MATERIAL]
    if not mat:
        return False
    try:
        filename = mat[c4d.MATERIAL_COLOR_SHADER][c4d.BITMAPSHADER_FILENAME]
    except:
        return False
    
    bm          = bitmaps.BaseBitmap()
    bm.InitWith(filename)
    getsize     = bm.GetSize()
    xpix        = getsize[0]
    ypix        = getsize[1]
    plane[c4d.PRIM_PLANE_WIDTH]  = xpix
    plane[c4d.PRIM_PLANE_HEIGHT] = ypix

Cheers
Lennart


#15

i just checked the (spanish) tutorial for picturesmart. That wouldn’t be perfect either…

Lennart, i’ll try that out. Thanks. I haven’t done anything with python yet, exciting…

Its for the automatic scaling of sprites for wallpapers i’m making every day. For a new page i made recently… http://www.facebook.com/hgutlwiwak


#16

Well i feel like i just cheated in my physics test, but wow.

My first experience with python, and i like it, a lot (maybe even too much).

Thank you so much Lennart, so many times you have come to my rescue. One day i hope to be able to repay the favour…


#17

That is a great little script… cheers…

Lee


#18

And here is the fruit of your loin Lennard…

Final fight characters perfectly scaled every time (with a small touch of xpresso to keep their feet on the floor)…

http://www.facebook.com/hgutlwiwak

Thank you again…


#19

I’m glad I could be of help.

Cheers
Lennart


#20

here is the main thread for this now…
http://forums.cgsociety.org/showthread.php?f=47&t=1086771