Jump to content

"float 3" attribute & python


AndrewVK

Recommended Posts

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?

Link to comment
Share on other sites

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 by AndrewVK
Link to comment
Share on other sites

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

Но блин спрайт процедурал его не хавает...рендерит точки.

Чичаз попробую тоже покрутить

Link to comment
Share on other sites

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 :lol:

Edited by hoknamahn
Link to comment
Share on other sites

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.   Paste as plain text instead

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