coloring rigs using color(rgbColor) not working?

coloring rigs using color(rgbColor) not working?

morten_bohne
Advocate Advocate
1,026 Views
3 Replies
Message 1 of 4

coloring rigs using color(rgbColor) not working?

morten_bohne
Advocate
Advocate

Hi, i’m having some trouble with the color() command using the rgbColor flag. When I reference more than one of the same file that uses it into a scene, save the scene and reopen, only the first reference seems to display correct, the rest displays as black.

 

Here’s some code that shows the error (be aware that it will create a new file without saving your work, and it creates 2 new files in a subfolder in your default workspace (circles.mb and tworefs.mb)):

from pymel.core import *
import os

out_dir = os.path.join(internalVar(uwd=True), 'color_command')


def makeCircleFile():
    """makes 3 circles, color them and saves the file"""
    newFile(f=1)
    # make 3 circles, space them out and color them
    circlergb = circle(name='rgbColor', constructionHistory=0)
    circlergb[0].translateX.set(3)
    # color circle using rgbColor
    color(circlergb[0], rgbColor=[1, 0, 0])
    circleud = circle(name='userDefined', constructionHistory=0)
    circleud[0].translateX.set(-3)
    # color circle using userDefined color
    color(circleud[0], userDefined=1)
    circledefault = circle(name='defaultColor', constructionHistory=0)
    group(
        circlergb[0], circleud[0], circledefault[0], world=True,
        name='circle_GRP')
    # save file
    if not os.path.exists(out_dir):
        os.makedirs(out_dir)
    filename = 'circles.mb'
    f = os.path.join(out_dir, filename)
    saveAs(f)
    return(f)


def referencecircles(f):
    """References rf twice, moves references apart"""
    newFile(f=1)
    ns = os.path.basename(rf).split('.')[0]
    ref1 = system.createReference(f, namespace=ns)
    PyNode(ns + ':circle_GRP').translateZ.set(3)
    ref2 = system.createReference(f, namespace=ns)
    filename = 'tworefs.mb'
    f2 = os.path.join(out_dir, filename)
    saveAs(f2)
    return(f2)


def makeConfirmWindow():
    """Make a window with a label and an Ok Button that runs okPushed"""
    if window('confirmOpen', exists=True):
        deleteUI('confirmOpen')
    w = window(
        'confirmOpen', title='Reopen File', w=100, h=400, mxb=False,
        sizeable=False)
    rcLayout = rowColumnLayout(nc=1)
    confirmtext = (
        "A file with 3 circles have been created; one green using " +
        "color(ud=1), one defaultColor, and one red using " +
        "color(rgbColor=[1,0,0]. This have been referenced twice into a new " +
        "scene and saved. The colors still look as expected. Click OK to " +
        "reOpen the scene. Notice the colors of circles1:rgbColor now appear" +
        "black.")
    windowtext = text(
        label=confirmtext, ww=True, align='center', w=250)
    spacer = text(label='')
    button(w=220, h=25, label='OK', c=okPushed)
    showWindow(w)
    window(w, edit=True, w=250, h=150)
    


def okPushed(*args):
    """opens the newly created file"""
    openFile(sf, force=True)
    try:
        deleteUI('confirmOpen')
    except:
        pass

rf = makeCircleFile()

sf = referencecircles(rf)

makeConfirmWindow()

 

 Note the rgb color flag was new to maya2015ext1, so it doesn't work in older verisons

 

 

How do people normally color controllers in their rigs etc? I would really like to stay away from drawingOverrides so the animators can play with those if needed, and I feel the userDefined(1-8) colors are waay too muddy for this purpose by default, and are user defined (duhSmiley Happy), so wouldn't always display the same.

-cheers

0 Likes
Accepted solutions (1)
1,027 Views
3 Replies
Replies (3)
Message 2 of 4

cornelh
Alumni
Alumni

@morten_bohne

 

Thank you for posting this via the Forum and supplying the python script.  I will be doing some testing and let you know if I can reproduce the same, if so, I will check our Bug data base to see if this issue has not already been reported.  If so I will update this forum post with the Bug ID.. If not, I will create a new internal ticket for our Maya Development Team to deal with this.  Thank you for bringing this to our attention.  I will keep you posted. 

0 Likes
Message 3 of 4

morten_bohne
Advocate
Advocate

Hi cornelh

sorry I forgot to mention that I already reported the bug.

the bug report is named:

BSPR-24738 color(rgbColor) not working on multiple references of same file

 

and they have created the case:

Case 11955520 - coloring rigs using color(rgbColor) not working?

 

Thanks for taking the time to test it, i'm eager to hear what you find

0 Likes
Message 4 of 4

cornelh
Alumni
Alumni
Accepted solution

@morten_bohne

 

Well I'm able to reproduce, and since there is already a case created, there is little I can do, as I was not able to figure out a workaround.  And yes many people just use the drawing overrides to color their rigs.  This is still set under "unresolved" and hopefully it can get addressed in a future service pack.  Thank you again for providing this information.  I will accept this as solution, as this will close my internal case yet keep this forum open to others.. Thank you for your patience and understanding as well deal with this internally.  Cheers

0 Likes