Skip to content

Add compound support to addAttribute function.#628

Merged
miquelcampos merged 5 commits intomgear-dev:masterfrom
timothyliu3d:dev/addAttribute-float2
Mar 25, 2026
Merged

Add compound support to addAttribute function.#628
miquelcampos merged 5 commits intomgear-dev:masterfrom
timothyliu3d:dev/addAttribute-float2

Conversation

@timothyliu3d
Copy link
Copy Markdown
Contributor

Description of Changes

What?

Update mgear.core.attribute.addAttribute to work with compound attributes (float2, long3, etc).

Example usage:

from maya import cmds
import mgear.core.attribute as mca

cmds.file(new=True, force=True)
cube, _ = cmds.polyCube()

mca.addAttribute(cube, "myFloat3", "float3", (123, 45, 67))
mca.addAttribute(cube, "myDouble2", "double2", (123, 45))
mca.addAttribute(cube, "myLong3", "long3", (123, 45, 67))
mca.addAttribute(cube, "myLong2", "long2", (123, 45))
mca.addAttribute(cube, "myColor", "float3", (0.1, 0.5, 0.4), usedAsColor=True)

Why?

I needed "float2" attribute types when using ComponentGuide.addParam() for UV-related data. I figured extending addAttribute would be a better approach than making new addVec2Attribute and Vec2Param just for this purpose.

Testing Done

  • Maya 2026
  • Able to build/rebuild MetaHuaman Y-up template.
  • Attribute properly exports/imports with SGT file.

Related Issue(s)

N/A

@miquelcampos miquelcampos self-assigned this Mar 25, 2026
@miquelcampos
Copy link
Copy Markdown
Member

Hi @timothyliu3d Thanks for the PR!

@miquelcampos miquelcampos added the enhancement New feature or request label Mar 25, 2026
@github-project-automation github-project-automation bot moved this to To Do in mGear DEV Mar 25, 2026
@miquelcampos miquelcampos moved this from To Do to WIP in mGear DEV Mar 25, 2026
@miquelcampos miquelcampos merged commit 11c48af into mgear-dev:master Mar 25, 2026
0 of 3 checks passed
@github-project-automation github-project-automation bot moved this from WIP to 5.3.x in mGear DEV Mar 25, 2026
@timothyliu3d timothyliu3d deleted the dev/addAttribute-float2 branch March 25, 2026 20:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

Status: 5.3.x

Development

Successfully merging this pull request may close these issues.

2 participants