AndrewVK Posted December 25, 2008 Share Posted December 25, 2008 I am trying to change (if exist) or create (if not exist) "spritescale" point attribute from python sop There is no problem with changing... and it looks like i can create something similar to spritescale. But... if geo.findPointAttrib('spritescale'): for point in geo.points(): # Works Fine # point.setAttribValue('spritescale',(2,2,2)) else: # Looks like everything Ok but it is NOT "spritescale" attribute # recognized by mantra geo.addAttrib(hou.attribType.Point,'spritescale',(1,1,1)) for point in geo.points(): #!!!ERROR!!! No attribute with this name, type and size exist point.setAttribValue('spritescale',(2,2,2)) How to create "float 3" attribute from python? Quote Link to comment Share on other sites More sharing options...
hoknamahn Posted December 26, 2008 Share Posted December 26, 2008 (edited) attr = geo.addAttrib(hou.attribType.Point,'spritescale',(2,2,2)) for point in geo.points(): point.setAttribValue(attr,(1,2,3)) Edited December 26, 2008 by hoknamahn Quote Link to comment Share on other sites More sharing options...
AndrewVK Posted December 27, 2008 Author Share Posted December 27, 2008 (edited) Does not work... Same problem here...i have 'spritescale' attribute...but sprite procedural can not recognize it. //Sorry...russian here// Хок проблема не в этом. Если спрайтскейл создан стандартными средствами (в попах или атрибкриейтом) то я могу рулить им просто по имени point.setAttribValue('spritescale',(2,2,2)) Это работает. Если же я пытаюсь создать спрайтскейл питоном то он его создает без проблем и выглядит он в спредшите точно так же...типа float3... Но блин спрайт процедурал его не хавает...рендерит точки. Edited December 27, 2008 by AndrewVK Quote Link to comment Share on other sites More sharing options...
hoknamahn Posted December 27, 2008 Share Posted December 27, 2008 Does not work... Same problem here...i have 'spritescale' attribute...but sprite procedural can not recognize it. //Sorry...russian here// Хок проблема не в этом. Если спрайтскейл создан стандартными средствами (в попах или атрибкриейтом) то я могу рулить им просто по имени point.setAttribValue('spritescale',(2,2,2)) Это работает. Если же я пытаюсь создать спрайтскейл питоном то он его создает без проблем и выглядит он в спредшите точно так же...типа float3... Но блин спрайт процедурал его не хавает...рендерит точки. Чичаз попробую тоже покрутить Quote Link to comment Share on other sites More sharing options...
hoknamahn Posted December 27, 2008 Share Posted December 27, 2008 (edited) The problem is in the definition of "3 floats". When you set an attribute as (1, 1, 1) Python creates the tuple of integers instead of floats. So you have to give a hint "those numbers are really floats" as (1.0, 1.0, 1.0) which is also good from the readability point of view. Also check any variable which supposed to be used in such "3 floats" attribute. This won't work: a = 1 ... point.setAttribValue(attr,(a, a, a)) But this should: a = 1.0 ... point.setAttribValue(attr,(a, a, a)) So be careful using "weak" type systems Edited December 27, 2008 by hoknamahn Quote Link to comment Share on other sites More sharing options...
AndrewVK Posted December 27, 2008 Author Share Posted December 27, 2008 Thanks!!! It works now :stupid: Quote Link to comment Share on other sites More sharing options...
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.