View unanswered posts | View active topics It is currently Tue Sep 23, 2014 6:22 pm

Forum rules


Hi All,

Please post your comments, question and thoughts about Mari Python here.
If you think Mari Python has something missing or a feature that other Mari Python users might like, please raise it here.
If you have encountered a bug in Mari Python or have a feature that you think is needed, please forward this to our dedicated Support team.
support at thefoundry dot co dot uk.

Please note that these forums are not officially monitored by The Foundry staff or Support team.



Reply to topic  [ 7 posts ] 
Resize a patch from Python 
Author Message

Joined: Fri Nov 25, 2011 1:09 pm
Posts: 31
Location: Cinesite
Post Resize a patch from Python
Hi!

I cannot find a way to resize a patch from the console, any help?

Thanks


Thu Jan 31, 2013 3:57 pm
Profile

Joined: Thu Jul 12, 2012 10:21 am
Posts: 20
Location: London
Post Re: Resize a patch from Python
You just need to grab the images for the channel and then resize the image corresponding to the patch you wish to resize. For example:

geo = mari.geo.current()
patches = geo.channelList()[0]
patches.imageList()[0].resize(PythonQt.Qt.QSize(2048,2048))

Will resize the first patch of the first channel of the currently selected object in your scene.

Tim


Sun Feb 03, 2013 4:09 pm
Profile WWW

Joined: Fri Nov 25, 2011 1:09 pm
Posts: 31
Location: Cinesite
Post Re: Resize a patch from Python
Hey Tim
Sorry for not being more clear! I meant I wish to set the size of the object UV patch in Mari, not resizing the image.
By default it's always set to 1K after loading an .obj


Mon Feb 11, 2013 3:46 pm
Profile

Joined: Thu Jul 12, 2012 10:21 am
Posts: 20
Location: London
Post Re: Resize a patch from Python
Sorry Johan. I'm not really sure what you're asking? The UV patch size is the image resolution of the image that corresponds to that patch. You can specify the patch/channel resolution when creating a new project if that's what you want? Perhaps you could give an example of what you want to achieve.


Mon Feb 25, 2013 3:59 pm
Profile WWW

Joined: Fri Nov 25, 2011 1:09 pm
Posts: 31
Location: Cinesite
Post Re: Resize a patch from Python
I'm creating channels and importing several 4K images, after import the sizes listed in the "Patches" tab are still 1K. I would like to update this to match the size of imported textures. Because when baking the image(chan.image().saveAs) output size is taken from the size found in Patches tab?


Wed Feb 27, 2013 11:09 am
Profile

Joined: Thu Oct 28, 2010 10:02 am
Posts: 19
Post Re: Resize a patch from Python
Hi Johan,

I'm afraid that it's still not clear what the problem is. So I'm going to list a few more hints in the hope that they'll help us pin point the problem.
  • The Image.saveAs() method will save the texture to disk with the resolution reported by Image.width() and Image.height().
  • There are a couple of options you can pass to Channel.importImages via the scale_choice argument: SCALE_THE_PATCH will resize the patch so that it matches the size of the image on disk. SCALE_THE_IMAGE will scale the imported image to fit that of the original patch.
  • A common gotcha when dealing with images in Channels is that the ordering of the images is non-intuitive. You'll need to look up the right texture index by using Image.uvIndex/ices, or alternatively use Channel.uvImageList to get them in a more intuitive order. So basically you need to cross-check that you're resizing the right image.
  • In Mari 1.6v1, using Image.resize or Channel.importImages will both update the patch size reported on the UV view and Patches palette. In earlier versions, there were a few corner cases where API calls did not update corresponding parts in the UI. We're constantly improving the API & fixing bugs, so if you're on an earlier version of Mari, it may be that there is an API or UI bug that's tripping you up.

Let me know if that helps.

Best,
Rob


Wed Feb 27, 2013 2:51 pm
Profile WWW

Joined: Fri Nov 25, 2011 1:09 pm
Posts: 31
Location: Cinesite
Post Re: Resize a patch from Python
Ah thanks Rob, seems like SCALE_THE_PATCH was the one I was looking for.


Fri Mar 15, 2013 9:55 am
Profile
Display posts from previous:  Sort by  
Reply to topic   [ 7 posts ] 

Who is online

Users browsing this forum: No registered users and 1 guest


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group.
Designed by ST Software.