5
$\begingroup$

In the 3d-view workspace, we can use a random color to give our separated object a distinct look.

What if I don't like the result and I want to randomize the color again?

Swapping the setting doesn't change the random seed in color.

enter image description here

(Blender 2.80.64.)

$\endgroup$
7
$\begingroup$

There is non as far as I know, at least currently though it would definitely be a very desirable feature, along with customizing the color ramp used to color them.

It does seem to use the same technique employed by the Random output socket of the Object Info shader node uses, which is uses object name as unique identifier.

So while you can't just randomize the global solution easily, or on several objects at once, it does seem to respond directly to object name changes, like the shader tree version.

That means if you rename your object it will change colors. It is trial and error process, since you don't have direct control over which color is assigned, but as a workaround you can iteratively change names until a color that pleases you is assigned.

enter image description here

If you like to keep your scene organized or dislike random names, you can still keep your names descriptive by appending some random string or number at the end to force change the assigned hash like my object 001 or my object #afhpo.

$\endgroup$
1
  • 1
    $\begingroup$ What a pity. Didn't know that the name will change the color. It seems to use some hash function on the object name for unique and stable color (and super fast). I'll go into the code for it and add some information in another answer, thanks for the knowledge. $\endgroup$ – HikariTW Jun 21 '19 at 17:31
3
$\begingroup$

If you want, paste this in a .py file and install it as addon :

import bpy;

bl_info = {
    "name": "Reset Selection Seed",
    "category": "Object",
    "blender": (2, 80, 0),
}

class ResetSeed(bpy.types.Operator):
    """Reset name to reset seed and change random colors"""
    bl_idname = "object.reset_seed"
    bl_label = "Color Seed Reset"
    bl_options = {'REGISTER', 'UNDO'}

    def execute(self, context):
        for obj in bpy.context.selected_objects:
            temp = obj.name;
            id = temp.find('.');
            if(id >= 0):
                nom = temp[:id];
                id += 1;
                chiffre = int(temp[id:]);
                chiffre += 1;
                obj.name = nom + '.' + str(chiffre);
            else:
                obj.name = obj.name + '.' + '1';
        return {'FINISHED'}

def register():
    bpy.utils.register_class(ResetSeed)


def unregister():
    bpy.utils.unregister_class(ResetSeed)


if __name__ == "__main__":
    register()
$\endgroup$
4
  • $\begingroup$ Why this 'temp' magic? I think appending one additional character should be enough right? $\endgroup$ – brockmann Jul 22 '19 at 16:59
  • $\begingroup$ No because if you wanna reroll several times, add a new char each time will quickly become a chaos. There, the.[number] is each time re-processed $\endgroup$ – Henri B. Jul 22 '19 at 17:04
  • $\begingroup$ Ok, thanks for the explanation @HenriB. However, what if there is no number? The operator will rename it anyway right? Python nitpicking: you can remove the semicolons and I'd suggest using rsplit() instead of find(). $\endgroup$ – brockmann Jul 22 '19 at 17:12
  • $\begingroup$ @brockmann If there is no number, the find() will return -1 and a ".1" will be appended at the end of the name (the else statement) $\endgroup$ – Henri B. Jul 22 '19 at 17:14
1
$\begingroup$

It seems the color is somehow depending on the number you're adding. As in, when only adding a .1 to your object name, the color will change only slightly, while with an added .5 there is a change from (in this instance) green shading to purple. Seems to me these changes are replicable; at least when I tried this three times, I always got the same shades of colors. (Would add this as a comment, but do not have enough reputation).

$\endgroup$
1
  • $\begingroup$ Yes in code algorithm Hash Function, adding a little change may lead to a closed result, which depend on algorithm. Thanks for the reporting $\endgroup$ – HikariTW Aug 7 '19 at 12:04

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.