text:
Play a sound, then another when the first is finished?
I want to play an intro sound, then when the intro is finished, play the full looped song.
What is the best strategy/tactic? Delay the playing of the loop by the lenght of the intro? Detect when the intro actuator has finished its job?

Play this audio file first: A "always" sensor connected to a "And" with use_priority connected to a "play_end" sound actuator
Then, connected to the same always sensor but with a regular AND python module connected to a "Loop_end" sound actuator :

.
def menuMusic(cont):
    loop = cont.owner.actuators["Loop"]
    time.sleep(0.5) # delays for 5 seconds
    cont.activate(loop)

But both my files are playing (in perfect sync, I must say)...

How do you now that the intro has finnished ? or it has a fixed time

Here's what I ended up doing: there's a property time that I did not know about: Timer. I then set a property sensor to track this "Timer" value, but the "equal" eval type did not work, I had to use "interval" and set my interval using the right n.000000 notation. By precisely tuning the Minimum value, I managed to get a sample-perfect intro+loop sequence.


text:
Move video clips in one place
I just finished editing a video, and I realized that some video clip files used are still in the client's USB flash drive :( Is there a way (like a python script) to tell Blender "gather all the material used in this .blend file in this directory"?
How can I give him his drive back, without risking coming back to this .blend file later to find files missing?

Related: http://blender.stackexchange.com/a/41750/2843

Close Blender. Copy the files to your local hard drive. Unplug the USB drive. Open your file in Blender. Hit File -> External Data -> Find missing files. Select folder containing local files. Hit Find missing files.

Perfick. I had just found it out thanks to Samoth's link, but you basically nailed it.

source: Stack Exchange

license: Creative Commons - Attribution Share-Alike - https://creativecommons.org/licenses/by-sa/3.0/

authors: Сергей Жильцов

sort: votes


text:
Access to actuators in external object.blend file
I'm loading scenes via logic.getBlendFileList and that's fine, I can access objects in it, set sensors and properties, and wire them with python modules. But I can't seem to access their animations: When I create an action actuator and select an animation (this object is an armature, appended in the scene, I can include the individual .blend file if needed) that this object has in the list menu, when I launch the game I get a rather laconic Failed to load action: MyAnimation.
On the other hand, I tried to create a "Property" actuator to toggle a boolean with a "pulse" sensor and it worked..?
Is it a limitation of logic.getBlendFileList, or are actions simply not available in python? Please excuse me if this is documented somewhere, in witch case can somebody please z-orient me to it?

did you load the action as well it seems to be considered separate see this DOC

Hey, this should be an answer, as it actually solved my problem; Thanks!

But it does not work for complex actions ;(

all_licenses: Creative Commons - Attribution Share-Alike - https://creativecommons.org/licenses/by-sa/3.0/


text:
How to update a damped track bone constraint?
I'm implementing a bone constraint for a racing game, to make the characters in the audience look in the direction of the leading car. I have it working in the character file (the character's head is following the empty target position) and when I lilbload/add the characters (and parent the targets to the car)  the heads are correctly oriented. But as the game progresses, the bones never update, the characters heads stay in the same place as I move the target around...? And no error or warning in the console output...?
I made sure my target is correctly libloaded and parented to the real moving object (the car) with:
for people in logic.getCurrentScene().objects['People'].childrenRecursive:
    render.drawLine(people.worldPosition, target.worldPosition, [1,0,0])

And sure enough, a line is connecting each character to the moving object. The target works.
What I tried :

An "always" sensor (w/ or w/o "pulse") to an "armature" actuator, running either "run armature" (?) or "set target" or both
An "always" sensor (w/ or w/o "pulse") to a python module running logic.getCurrentScene().objects.get('Armature').update() at every single tick
Replace the "Damped Track" bone constraint with a "track to"
Removing all animations in the character file in case a keyframe is preventing the bone from moving

But nope, the characters head do-not-move as I move (applyForce) the car. Is there something like applyConstraint that I must use?

why not just use track to logic brick? it's simpler than python (I my mind)

I forgot to mention this in the numerous things that I tried...

so.. you tried [edit object]>[track to] ? and what was the result?

Well, right now it does not work, which confuses me because last time I tried it rotated the whole armature... The thing about bones and logic bricks, is that the whole skeleton seem to share the bricks..? I mean, When I select the belly bone (in "Pose" mode) I can see the bricks connected to the head bone..? Another thing: If I want to do anything with my character (like set its worldOrientation to this of its "position" target) I have to wire it to an action actuator, even an empty (0 keys) one.

Obviously I'm doing it wrong. Do you know an exemple of a Mesh+Armature libloaded in a scene, with a "track to" that works and updates in realtime? I'm really lost here, it's been days!

@xaccrocheur it could be that other logic bricks are messing this up since there is no logic brick for each bone it is for the whole armature object !  , also try parenting an object to the bone (not the armature) to see if the bone is following (it could deformation problem ),

But I made numerous tests, sometimes with just a 10 faces polygon with only 2 bones, and no "other logic bricks"! No, I'm missing something big about libloading an object and its armature with a damped track constraint.

@Monster can you please take a look at this

@chebhou Monster already provided guidance on that (but thanks for the attention, really nice of you) he had bad news (no constraints on libloaded objects) but also a workaround (that I did not have the time to test yet).


text:
Is there an easy way in python to find the bpy.data.images that are used in a node?
I know a couple of ways to get images in the node_tree, the simplest is:
image_list=[]
for n in bpy.data.materials['My Mat'].node_tree.nodes:
    if n.type == 'TEX_IMAGE':
        if n.image:
            if n.image not in image_list:
                image_list.append(n.image)

Clearly, it is the fastest way if group type nodes are not used. Alternatively you can build a function that iterates over groups, subgroups etc. It's not a problem. technically I can get to all the images in any sub-group
So basically I can currently get to all the data images. but I was wondering, is there a python api that allows you to see directly which images bpy.data.images are related to bpy.data.materials['My Mat'] ?
Note:
The main purpose is, to keep track in real time in the panel, of how many images there are in that node tree.
So that method (which I proposed in the example) is wasteful of resources if the materials are very complex. It would run too many times when the cursor is touched on the panel.

Since all materials are node based, I guess there is no other way to determine whether an image is in use, also I can not find anything related in the docs.

So... if the answer is not in Python code... the answer is just "no"?

Not sure it will be quicker.  Could play around with users. ie make a list of all users [im.users for im in D.images] copy a material, recreate list. Any that have incremented  user count are in use by the material. Then remove dupe.  Similarly with materials using  node groups using images.

@batFINGER but im.users is just user count I think and is a simple integer. are there any other ways to get users?

@NoobCat. A direct api does not exist for that. And even if it exists, that won't solve what you say (wasteful when used in draw). So could you provide more informaton about the context of your question? (the idea may be to avoid doing it in draw)

@lemon Keep track of how many images are in use in a Material (Or node_tree) in real time, printed on the UI, without having to press buttons or the like. Obviously it is very expensive not having a direct API. I can't even count the D. images, because even if an image is deleted from the node tree, it will always remain in memory, because it could have User, or simply be in Orphan Data. So I can't even do something like if len (D.image)! = Len (my_prop.my_last_data_images_list) where, my_prop, could be a scene property, which is only updated when the 2 lists are different

@NoobCat if you could provide a test case for evaluation?

@lemon I don't have any tests at the moment, it doesn't make any sense, mine is just a hypothesis, but at the moment it lacks any foundation. It was just a food for thought.

@lemon both an excellent answer, and source of a test file https://blender.stackexchange.com/a/161371/15543  Are you too young to be lucky enough to program  (ie plug the wires into) analogue computers too?  (as with other recursion excursions in python, could be quicker with iterative approach)

@batFINGER, thanks. Tested it on 1k times on 'Logic Node Libary' for around 0.8s here.

Recurse the tree.
In question code, the major rate determining step will be checking the list for dupe to append, often quicker to add them all and use a set if only unique members are of interest.
Suggest can use list comprehension, or recursively walk the tree.
Here is an example, pass a node tree to a method and walk its nodes, if it has an image property yield it, if it has a node tree yield from it.
Personally I like the simplicity of yield syntax usage for traversing a tree, and the low memory hogging nature of generators, however they need a little tweaking to optimize for speed, see below
import bpy

def images_in_tree(node_tree):
    for node in node_tree.nodes:
        if hasattr(node, "image"):
            yield node.image
        if hasattr(node, "node_tree"):
            yield from images_in_tree(node.node_tree)

for mat in bpy.data.materials:
    if mat.use_nodes:
        print(set(filter(None, images_in_tree(mat.node_tree))))

Note could yield above getattr(node, "image", None) to avoid testing and filter out the Nones, however it may be a better idea to yield the node_tree, and the node.  The ID data of the node_tree node_tree.id_data will be a material or a node group.
Just the number of unique images in tree.
In answer to

Keep track of how many images are in use in a Material (Or node_tree)
in real time, printed on the UI, without having to press buttons or
the like

Instead of yielding the images returns only a count.
Used a boolean default dictionary to tag items. Any item is given the default value false
In response to

fyi, you can't use tag here. Or any optimization like caching.

Have tagged both the nodegroups and images with one dict to  make the method directly usable in a draw method, instead of using say a getter of a material property,
bpy.types.Material.image_users = IntProperty(get=num_images)

In which case could lay it out with
layout.prop(mat, "image_users")

and using the collection.tag(False) would be Ok in this context, and removes the need for the default dictionary.
As noted yielding and recursion can be slow in python, however using functools.lru_cache seriously fixes this see similar gain here https://blender.stackexchange.com/a/199075/15543 as well as other optimizations used. See lru_cache link re expiring or clearing cache on some interval
Basically it is caching the result of a call to memory.
import bpy
from collections import defaultdict
from functools import lru_cache

@lru_cache(16) # play with this
def num_images(mat):
    tag = defaultdict(bool)

    def unique(node):
        img = getattr(node, "image", None)
        if tag[img]:
            return False
        tag[img] = True
        return img is not None

    def images_in_tree(node_trees):
        for node_tree in node_trees:
            if tag[node_tree]:
                continue
            tag[node_tree] = True
            yield sum(unique(n) for n in node_tree.nodes)
            yield from images_in_tree((n.node_tree  for n in node_tree.nodes if hasattr(n, "node_tree")))
    return sum(images_in_tree((mat.node_tree,)))

# make an int material property
bpy.types.Material.image_users = bpy.props.IntProperty(get=num_images.__wrapped__)
# tack a draw method to text editor footer to test
from random import random
def draw(self, context):
    mat = context.object.active_material
    if mat:
        self.layout.prop(mat, "image_users")
        if random() <= 0.5:
            num_images.cache_clear()
        self.layout.label(text=f"{num_images(mat)}")

bpy.types.TEXT_HT_footer.prepend(draw)

The material property uses an uncached version of the method above, num_images.__wrapped__ the label uses the cached method.  The cache is cleared each time a random is below a threshold. The expectation above is that it is only calculated approximately every 2nd time.
Other methods to consider would be using a counter on the UI class, clearing in a draw, poll or __init__ method of classes in different regions, a draw call back.. (Or as mentioned prior expire the cache) or simply not use it at all.

Extra image tacked into test file, showing 8 images in material, removed shows 7, undo back to 8

It looks good, I'll have to test it! Let's see how it behaves with 800+ Nodes. (I'm not kidding XD)

Cool. Even it slows things down, might be useful to check whether an image node is connected at all.

Would be tricky. Know I often leave unconnected "thinking about using" nodes littered around.  Testing for nodes with  valid paths to output could be something to look at.

If you group.tag before the loop it won't count images per node tree.

fyi, you can't use tag here. Or any optimization like caching.

So... it seems quite confirmed that there is no api to do that. And even if this api exist it would be called as often in the context.
You can either recurse into, or iterate over, subnodes that are groups.
But in both case there is no need to go through the same groups several times (as we may find the same images and their users property won't change for that).
To collect the images without duplicates or to test if a group is already parsed, we can use a set().
Recursive way
def search_images_recursive4(material):
    node_trees = set()
    if material.use_nodes:
        def search_trees(trees):
            for tree in trees:
                if not tree in node_trees:
                    node_trees.add(tree)
                    search_trees((n.node_tree for n in tree.nodes if hasattr(n, "node_tree")))
        search_trees((material.node_tree,))

    return set(n.image for t in node_trees for n in t.nodes if hasattr(n,"image") and n.image)

Iterative way
def search_images_iterative3(material):
    result = set()
    if material.use_nodes:
        encountered = set()
        trees = set((material.node_tree,))
        while trees:
            encountered.update(trees)
            result.update(n.image for t in trees for n in t.nodes if hasattr(n, "image"))
            trees = set(n.node_tree for t in trees for n in t.nodes if hasattr(n, "node_tree")).difference(encountered)

    return result

Test case: the file from this question.
The test is a 1000 times loop call each function over all the materials of the file.
Run it 10  times and took the average.
import time

n = 1000
start = time.time()
for i in range(n):
    for mat in [m for m in bpy.data.materials if m.use_nodes]:
        pass #call the function to test here instead of pass
end = time.time()
print(end-start)

Results:
New @batFINGER solution num_images: 4.4 seconds.
search_images_recursive4: 3.17 seconds
search_images_iterative3: 3.26 seconds

Note
What I've finally discovered (and learned) is using
hasattr(n, "node_tree")

is the key point as it is much faster than
n.type == 'GROUP'

For your information, @batFINGER, with tags, quite similar in runtime.

would still avoid if x in y if possible.

in counterpart, yield is just very slow...  @batFINGER

Here it is really difficult, to assign the Bounty, guys, I ask you, in your opinion which of the 2 answers is the best. Really hard for me to decide.

Well, NoobCat, you want something fast. As I said above, yield is slow (around 7x slower in my test cases)... but @batFINGER may also answer you about that. I've tested several ways and search_images_recursive2above is the best one I've found.

And additionally, using taghas a counterpart: looping for tagging, which is slow also, so that it brings no better performance.

@NoobCat. I think the best way for you to choose is to test and compare. This is your question and so your responsability in some way : )

Can't see any DV's, you can click on the number to verify. Btw: Nice answer!

@brockmann, thanks... it has been retracted, it seems.

license: Creative Commons - Attribution Share-Alike - https://creativecommons.org/licenses/by-sa/4.0/


text:
How to make a growing unique index (IntProperty) of the objects?
I would like to assign a unique Immutable index of the objects that are added in the scene.
I want this unique index to be stored in an object type property (Relative to the object)
Obviously the object can be deleted and I would like the index to always grow regardless of whether the object is deleted (keeping it stored somewhere)
So assuming you have 10 objects in the scene, they will have an index, from 1 to 10
Assuming deleting all 10 objects, I would like that by adding a new object, the index continues to grow, i.e. in this case the index should be 11, Obviously the index could be very high even if there are few objects in the scene, but it is very important that it remains so, and that it is always growing.
I suppose I should create a list that contains all the previous indexes or something similar.
This situation is making me difficult.
This is how we declare an object-type property:
I don't really know how to build a function that assigns correctly only when the len(bpy.data.objects[:]) changes, I can also think of a function called by bpy.app.handlers.depsgraph_update_post(), but I'm not sure
class ObjectProperties(bpy.types.PropertyGroup):
    obj_index = bpy.props.IntProperty()

def register():
    bpy.types.Object.obj_prop = bpy.props.PointerProperty(type=ObjectProperties)

My question is inherent in this answer , I was thinking of indexing all the objects present in the bpy.data.objects with a unique index.
I want to try replacing the "Object Info" node with a driver, which is driven by the object's IntProperty Like this:

An additional problem is when copying the object (Without instance)
I have done various tests, but there seems to be some problem with updating the integer value in the Driver.
Based on @batFINGER 's answer, the indexing method seems to be right for me. But I can't understand where I am wrong with the driver, when I assign sefl.scene_object_index to the driver, the driver never changes and always remains on 0 Although in this case C.object.scene_object_index is 6 (As seen in the console)

I had already noticed this problem, when I tried to make an index in my own way, I noticed that the driver was assuming wrong values

Could you provide some context? Why do you need this?

I need to drive a material driver, but I need the indexing never to change.

I think it would make sense for you to edit the question and provide more context, tell more about what you want to do and why. It would help to avoid miscommunication and would also probably encourage people to provide some answers. See http://xyproblem.info/ . I think some people might hesitate answering such a question without more context because of that issue.

A collection of pointers
Can set up a collection on the scene with pointers to objects.
On an object set up a property to populate the collection and return the objects index in that collection.
Feel it's a little hacky to use context to get the scene within the getter method.
Example of setting up the props.
import bpy
from bpy.props import PointerProperty, CollectionProperty, IntProperty
from bpy.types import PropertyGroup, Object

class SceneObject(PropertyGroup):
    object : PointerProperty(type=Object)

def get_scene_object_index(self):
    from bpy import context
    scene = context.scene
    obs = [o.object for o in scene.scene_objects]
    for ob in set(scene.objects) - set(obs):
        o = scene.scene_objects.add()
        o.name = ob.name
        o.object = ob
        obs.append(ob)
        ob["scene_object_index"] = len(obs)

    return self["scene_object_index"]

bpy.utils.register_class(SceneObject)

bpy.types.Scene.scene_objects = CollectionProperty(type=SceneObject)
Object.scene_object_index = IntProperty(get=get_scene_object_index)

def draw(self, context):
    layout = self.layout
    scene = context.scene
    ob = context.object
    self.layout.prop(ob, "scene_object_index")
    for o in context.scene.scene_objects:
        layout.label(text=f"{o.object.name}")

bpy.types.OBJECT_PT_context_object.prepend(draw)

Added a little draw method to object props panel
Drive the pass_index
A driver using this prop can be added to the pass index of an object.  Adding a value input driver to a material node will require targeting a different object per material.
EDIT
Have edited to give each object a custom property. Needs a rethink re property name to have a unique value per scene.  It appears the driver "auto updates" better from the custom property rather than the read (getter) only property.
Will revisit and clean up if I have time, thinking a prop on scene with an update method.

Note at issue here is the collection property of the scene is giving the object a user. Deleting objects using operator will only unlink them from the scene, not remove them from the data.   Requires an edit to remove objects if they are only used by the collection.
If an object that is assigned to a pointer is removed from data the pointer will return None

I admit that I was amazed at how few lines it is possible to do this, the index seems to remain intact as I asked. It looks amazing. Aside from the fact that the driver (in my case) doesn't seem to update with the self.scene_object_index, it always returns 0, even if the object is actually correctly indexed

I tried to insert self.scene_object_index in the driver, but the driver always remains 0, then I tried to insert bpy.data.objects['My Object'].scene_object_index and it works (The driver obviously reports many warnings) I can't understand why this happens

Have indexed from zero, so for one scene object the value will be zero.  Add one in the getter method return to index from 1. If there are further error messages edit them into the question.

Great answer, everything works correctly now. One question: Why did you choose set(context.scene.objects) and not set(bpy.data.objects)

One is all objects linked to the scene, the other is all objects in the blend file.   As mentioned in answer, will find deleting objects will only unlink from scene, but will still exist in  bpy.data.objects.  For the most part we are interested in scene objects not all, that may or may not be linked to any all or no scenes in the blend file.

all_licenses: Creative Commons - Attribution Share-Alike - https://creativecommons.org/licenses/by-sa/4.0/


text:
Transparency of object in 2.91
My mesh is transparent in front view, both in object and edit mode but it shows in side view, what to do to get it visible also in front view?
Here is a screenshot.

hello, could you please show some screenshots?

or even better show us your blend file if possible

Try pressing the numeric / key (a few times) in the front facing window , to see if mesh object is visible in Local Mode.  Know that Blender has multiple ways of controlling visibility.  Groups and Single Objects.  It only takes one stray keystroke or mouse click to create problems.

Is the image in front of the object?

Yes the mesh object is visibly in local mode but still transparent in the same way off local mode

No, the ref pics is behind the mesh

@GordonBrinkmann ... I think your shocking idea is on the Brink of a solution Mann


text:
How to change the interface color?
I was wondering if it is possible to change Blender's interface color?  The dark version is the default  Are there setting that would allow you to change to something lighter?

Please don't write in all caps, it is the online equivalent of shouting and is considered rude.

https://blender.stackexchange.com/questions/52030


text:
Texture Colors Not Working
I made this 3x3 pixel png to use for the colors of this tree, but when I put the mapping on the colors, nothing happens. I made the image the base color, why is nothing happening?
My tree in the UV mapping screen

Tree now with color

it seems your 3d view is in solid mode: enlarge the 3d view and look at the buttons on its top right.

I see the colors now, but they are all weird shades, not solid color like in the picture

Could that just be a mapping issue or something else?

Consider uploading your file: the screenshot does not provide enough details. Please use this site to do it: http://blend-exchange.giantcowfilms.com/

I've reloaded the page multiple times but it seems like the file isn't going through

You should obtain a link once uploaded. Paste it here

cool

Seems to be ok here https://i.sstatic.net/3OFfN.png But as the texture was not packed in the file i've created another one (similar to yours above)

So it worked for you? Idk what I should do then.

Same version of Blender and on Windows too... so? Is it the only issue on this kind? Give a try with some base shapes

waiit I was messing with the options and I fixed it, I had "Smart" on instead of "Closest"

Okie I fixed it thx for helping, I'm very new to blender and I'm making my first 3D game so I've been trying to get used to the software XD

ok, good if it works. But that should not be the reason in this case. Here the result is the same whatever the image mode is

Huh that is odd. Whatever if it's good it's fine by me.

I UV unwrapped my mesh, but the image texture doesn't show in my object


text:
When I open my project all shadows have gone
I am using blender 2.9 am creating a room with chocofur model manager for furniture, etc, it looked nice with all the shadows and lighting but I have saved it every step of the way, but now when I open it all shadows have gone and nothing happens when I try to add the process again. I have watched tutorial again and again and everything is right.

Any chance you are in material preview mode, and not rendered preview? To be sure, press Z in  the 3D viewport and select "rendered" from the pie menu.

I don't have enough reputation to comment, sorry.
In addition to Christopher Bennet's comment (making sure you are in the rendered viewport, Z -> Rendered) I will suggest another possible cause for future readers.
In Eevee, one can turn off shadows manually for each light source. You can click on a light source in the outliner, go to object data properties (the light bulb). There you can select two checkboxes: Shadow and Contact shadows. Check if these have not been accidentally turned off.


text:
I get a weird visual glitch when using the shading tab on Blender. How can I solve this?
The Shading preview stoped showing what it should. Instead it shows a weird reflexion of the background as you can see in the following pictures:
The first one shows the model using the solid preview

The second one shows what it looks like when I try to see the material preview

The third one shows what i see when I move the camera a little (pressing the middle mouse button and dragging)

This issue is not exclusive to this project, but happens on every other project too. This also happens if I open a new project that only contains a cube. I have let a friend of mine run the foosball model and it worked on his computer, so it has to be a problem with my PC or any blender files on my PC. It used to work on it perfectly, but after some time, it didn't anymore.
I've tried the following:
Uninstalled Blender.
Cleaned temporary and registry files with CCleaner
Updated my graphics card's software to the newest version (AMD Radeon R9 380X, version 20.12.1)
Restarted my PC
Reinstalled Blender.
It didn't solve the problem. Can anyone help me out?
Thank you in advance.

Is this your problem? https://blender.stackexchange.com/questions/204297/amd-gpu-material-in-material-preview-mode-and-rendered-mode-is-entirely-gra

You could try to go into to edit mode and recalculate the normals by pressing Shift + N.


text:
Why is this happening with blender now?
Blender 2.81 screen upon loading

so, all of a sudden i'm having issues now with blender. i uninstalled and reinstalled blender 2.81 and 2.9, and they are both having the same issue upon initial loading. NONE of the preferances has been changed or anything. this is a picture of the stock cube that is given everytime. and as you can see in the screenshot, the viewport shading is set on wireframe, so i should be able to see it all, but i don't. i've checked all the settings and everything and nothing helps. i installed it on a seperate computer, on the off chance that it was my desktop going bad, but alas, on my laptop it is having the very same issue, new install and everything. if anyone else is having this problem and has fixed it, please let me know!!! i am in the middle of developing a video game and now i can't use blender to 3d model anything anymore.

AMD GPU by any chance?

yes, actually. working on getting a new gpu. currently i have the radeon 570rx

https://blender.stackexchange.com/questions/204297/amd-gpu-material-in-material-preview-mode-and-rendered-mode-is-entirely-gra

but the problem also persists on my laptop, which has an AMD Radeon HD 7650M, driver version 15.20.. and blender was working.. now it's not. i even tried installing older versions, and still nothing

and also, blender 2.81 does not have the high quality normals option as displayed in the answer provided above

2.90 does, but still doesnt solve the issue of when i put it into wireframe mode, i still just get the outline as seen in the screenshot i provided in my initial question.

ok, i DID in fact read that part, but that would only solve the issue for my pc, and not the laptop, as the amd driver on my laptop has not been updated in a couple years, and blender has been working on it fine till recently. i'm no NOOB, but also understand that there may be more to the issue than a simple driver problem. if that was the case, it would be working fine on my laptop. but the current driver for my laptop was from back in 2015, and have had absolutely NO issues at all till now.


text:
How to update and get the property node.dimensions with python?
For those interested in the answer, I invite you to test the function below:
import bpy

def create_tex_image_nodes(mat):
    node_tree = mat.node_tree

    # Create nodes "TEX_IMAGE"
    image_nodes = []
    for i in range(5):
        node = node_tree.nodes.new(type='ShaderNodeTexImage')
        image_nodes.append(node)

    bpy.ops.wm.redraw_timer(type='DRAW_WIN_SWAP', iterations=1) # Work only if the Shader Editor is open

    for i, node in enumerate(image_nodes):
        node.update() # Not Work
        print(node.dimensions[:])

    return image_nodes

mat = bpy.context.object.active_material
tex_image_nodes = create_tex_image_nodes(mat)

I want to get the "Y" dimension of the nodes, but I can't update the dimensions, because as soon as the nodes are created, it always seems to be 0 so node.dimensions[:] is (0.0, 0.0)
Now I also tried using bpy.ops.wm.redraw_timer(type='DRAW_WIN_SWAP', iterations=1) but this only updates if the Shader Editor window is open on the affected material and node tree, in this case the dimensions[:] are (240.0, 202.0) and it is right.
Also node.update() does not update.
I also tried updating the node_tree or node_tree.nodes, but nothing works.
Any Idea about How to update the node.dimensions?
Please test this code, I've pasted it here just to make it easier.
Do 2 tests:

With shader editor in interface
Without Shader editor in interface

You immediately understand the difference.
Note
The developers themselves say it is expected behavior

"The dimensions of the node are found by drawing it, since they're
influenced by the size of UI buttons"

try node.width and node.height

node.dimensions is a read-only property, you can't edit it

@Karan node.height is not the real size into the node_tree. node.dimensions is readonly, yes, My question is precisely how to get it, since it is not updated immediately when the nodes are created. n.height returns 100, this is not true in the node tree

Have you tried with an application timer ? https://docs.blender.org/api/current/bpy.app.timers.html waiting for 1 frame might give enough time for the value to initialize

@Gorgious It doesn't seem like a good method like this on the spot. How would you integrate it?

Instantiate the nodes, then run the rest of your logic inside the application timer

@Gorgious I really don't understand what you mean. Sorry but it would take an example to understand what you mean. How does a timer access updated node.dimensions information? In any case, the Blender programmers claim that it is Expected behavior. Until nodes are drawn in the graph, node.dimensions is not available. So it will be (0.0, 0.0)

Maybe you can achieve your goal without this information ? what would you like to do with the node dimensions ?

@Gorgious Obtain the real dimensions in order to align the nodes

@NoobCat, node.update() is supposed to be used internally when the nodetree has changed ("adding and removing nodes and links"). You should not have to call it specifically. A node height is also an automatic value based on the node content and its dimensions can only be known when the node has been rendered at least one time (in the node editor). Without the rendering, the dimensions will allways be (0,0). But as nodes are by default expanded and its height is constant for it's sockets count, a TexImage will normally have an height of 290 units.

Since node.dimensions get evaluated on UI redraw, we're limited to using bpy.ops.wm.redraw_timer(...) to trigger a redraw. The only problem that appears is that there has to be a ShaderEditor opened. The quickest and the easiest solution turned out to be switching the current area.ui_type to ShaderNodeTree and executing bpy.ops.wm.redraw_timer(...) just after. Below is the modified script.
Solution
Switch the current area.ui_type to ShaderNodeTree and we won't have to ensure Shader Editor is present.
import bpy

def remove_all_nodes(mat):
    nodes = mat.node_tree.nodes
    for node in reversed(nodes):
        nodes.remove(node)

def create_tex_image_nodes(context, mat):
    nodes = mat.node_tree.nodes

    # Create Image Texture nodes
    image_nodes = []
    for _ in range(5):
        node = nodes.new(type='ShaderNodeTexImage')
        image_nodes.append(node)

    # Change active area.ui_type to Shader Editor
    area = context.area
    old_area_ui_type = area.ui_type
    area.ui_type = 'ShaderNodeTree'

    # Redraw nodes in the node tree
    bpy.ops.wm.redraw_timer(type='DRAW_WIN', iterations=1)

    for node in image_nodes:
        print(node.dimensions[:])

    # Restore active area.ui_type
    area.ui_type = old_area_ui_type

    return image_nodes

context = bpy.context

mat = bpy.context.object.active_material
remove_all_nodes(mat)  # for testing
tex_image_nodes = create_tex_image_nodes(context, mat)

Console:
Warning: 1 x Draw window: 31.9231 ms, average: 31.92305565 ms
(240.0, 202.0)
(240.0, 202.0)
(240.0, 202.0)
(240.0, 202.0)
(240.0, 202.0)

I tested and seems like 'DRAW_WIN' is enough for bpy.ops.wm.redraw_timer(...). With 'DRAW_WIN_SWAP' there's a minor UI area flicker (on Linux at least).
The solution can be further improved to change area.ui_type only if there's no Shader Editor present on the screen, and with additional safety in case if active area is None.
Some may say that there could be a workaround with context override, but I couldn't get it working - blender would crash at the moment  bpy.ops.wm.redraw_timer(...) was called.
Improved Solution
Change area.ui_type only if there's no Shader Editor present on the screen, and with additional safety in case if active area is None.
import bpy

def remove_all_nodes(mat):
    nodes = mat.node_tree.nodes
    for node in reversed(nodes):
        nodes.remove(node)

def get_prepared_ui_area(context):
    # Skip if Shader Editor exists
    for area in context.screen.areas:
        if area is None:
            continue

        if area.ui_type == 'ShaderNodeTree':
            return {'area': area, 'old_ui_type': area.ui_type}

    # Change area.ui_type to Shader Editor otherwise
    # Loop as a safety if the current area is None
    for area in context.screen.areas:
        if area is None:
            continue

        area_data = {'area': area, 'old_ui_type': area.ui_type}
        area.ui_type = 'ShaderNodeTree'
        return area_data

    # unlikely but present for code safety
    return {'area': None, 'old_ui_type': None}

def create_tex_image_nodes(context, mat):
    nodes = mat.node_tree.nodes

    # Create Image Texture nodes
    image_nodes = []
    for _ in range(5):
        node = nodes.new(type='ShaderNodeTexImage')
        image_nodes.append(node)

    area_data = get_prepared_ui_area(context)

    # Redraw nodes in the node tree
    bpy.ops.wm.redraw_timer(type='DRAW_WIN', iterations=1)

    for node in image_nodes:
        print(node.dimensions[:])

    # Restore active area.ui_type
    area = area_data['area']
    old_area_ui_type = area_data['old_ui_type']
    if area is not None and area.ui_type != old_area_ui_type:
        area.ui_type = old_area_ui_type

    return image_nodes

context = bpy.context

mat = bpy.context.object.active_material
remove_all_nodes(mat)  # for testing
tex_image_nodes = create_tex_image_nodes(context, mat)

Console (I ran the script four times):
Warning: 1 x Draw window: 31.9231 ms, average: 31.92305565 ms
(240.0, 202.0)
(240.0, 202.0)
(240.0, 202.0)
(240.0, 202.0)
(240.0, 202.0)
Warning: 1 x Draw window: 19.2859 ms, average: 19.28591728 ms
(240.0, 202.0)
(240.0, 202.0)
(240.0, 202.0)
(240.0, 202.0)
(240.0, 202.0)
Warning: 1 x Draw window: 19.6609 ms, average: 19.66094971 ms
(240.0, 202.0)
(240.0, 202.0)
(240.0, 202.0)
(240.0, 202.0)
(240.0, 202.0)
Warning: 1 x Draw window: 24.5559 ms, average: 24.55592155 ms
(240.0, 202.0)
(240.0, 202.0)
(240.0, 202.0)
(240.0, 202.0)
(240.0, 202.0)

"Switch the current area.ui_type to ShaderNodeTree and we won't have to ensure Shader Editor is present." - actually you don't have to assume/check if it is present, but you exactly ensure that it is. This switcheroo trick is nice, but it won't work if there's no interface to begin with…

yeah, good point.

Get node.dimensions without open shader editor
This is ui scale 1.1, working without open shader editor

This is ui scale 1.6, working without open shader editor

Script with UI scale >= 1.0
import bpy

def create_tex_image_nodes(mat):
    # ui_scale = bpy.context.preferences.view.ui_scale
    node_tree = mat.node_tree
    node_tree.nodes.clear()

    # Create nodes "TEX_IMAGE"
    image_nodes = []
    for i in range(9):
        node = node_tree.nodes.new(type='ShaderNodeTexImage')
        image_nodes.append(node)

    # bpy.ops.wm.redraw_timer(type='DRAW_WIN_SWAP', iterations=1) # Work only if the Shader Editor is open

    T = 0
    R = 0
    r = 0
    for i in range(3):
        for j in range(3):
            node = image_nodes[r]
            real_width = max(min(node.bl_width_default, node.bl_width_max), node.bl_width_min)
            # about 2 times the height
            fake_height = node.height * 2 # not work when ui_scale < 1
            node.location = R, T
            R += real_width
            r += 1
        T -= fake_height
        R = 0

    return image_nodes

mat = bpy.context.object.active_material
tex_image_nodes = create_tex_image_nodes(mat)

This is not possible using node.dimensions[1] to align the nodes when UI scale < 1.0 because node.dimensions is not always true
Here is the Reason
# suppose ui_scale = 0.75, Shader Editor is opened. tested on blender 3.5
# Align nodes using node.dimensions[1]
import bpy

# bpy.context.preferences.view.ui_scale = 0.75

def create_tex_image_nodes(mat):
    node_tree = mat.node_tree
    node_tree.nodes.clear()

    # Create nodes "TEX_IMAGE"
    image_nodes = []
    for i in range(9):
        node = node_tree.nodes.new(type='ShaderNodeTexImage')
        image_nodes.append(node)

    bpy.ops.wm.redraw_timer(type='DRAW_WIN_SWAP', iterations=1) # Work only if the Shader Editor is open

    T = 0
    R = 0
    r = 0
    for i in range(3):
        for j in range(3):
            node = image_nodes[r]
            real_width = max(min(node.bl_width_default, node.bl_width_max), node.bl_width_min)

            fake_height = node.dimensions[1]
            node.location = R, T
            R += real_width
            r += 1
        T -= fake_height
        R = 0

    return image_nodes

mat = bpy.context.object.active_material
tex_image_nodes = create_tex_image_nodes(mat)

Result:

Is the max(min( clamping necessary here? After all you create new nodes with their default sizes. If something else modifies the width, you're unable to read it, however. More importantly, if you decide to hide options (hiding sockets is more predictable ) you're unable to figure the height. BTW, I personally prefer max(MIN, min(value, MAX)) to put them in the MIN >= value >= MAX order. Also sorted((MIN, value, MAX))[1] is pretty cool.

the max(min(  should not necessary and only work on first create.

You're clamping the bl_width_default - can it ever be outside the clamped range?

The default value should be consistent with different ui scales, never saw the source code so I'm not sure.


text:
How to document two or more different operator's options with Online Manual?
It's not clear to me whether or not it's possible to document 2 different options of the same operator, so by right clicking on the operator's buttons it's possible to go to the documentation. The problem is if the operator has 2 or more options, it might do slightly different things. I wanted to be able to document them.

I modified the "Addon Add Object" template to make the example.
import bpy
from bpy.types import Operator
from bpy.props import EnumProperty

class MYADDON_OT_Operator(Operator):
    bl_idname = "myaddon.operator"
    bl_label = "Custom ops"
    bl_options = {'REGISTER', 'UNDO'}

    options: EnumProperty(default='ONE', items = (('ONE', "One", ""), ('TWO', "Two", "")))

    def execute(self, context):

        # Two different situation:

        if self.options == 'ONE':  # Doc This
            print("One")
        elif self.options == 'TWO': # Doc This
            print("Two")

        # How to make 2 different url with same operator?

        return {'FINISHED'}

# This allows you to right click on a button and link to documentation
def add_object_manual_map():
    url_manual_prefix = "https://docs.blender.org/manual/en/latest/"
    url_manual_mapping = (
        ("bpy.ops.myaddon.operator", "scene_layout/object/types.html"),
    )
    return url_manual_prefix, url_manual_mapping

def register():
    bpy.utils.register_class(MYADDON_OT_Operator)
    bpy.utils.register_manual_map(add_object_manual_map)

def unregister():
    bpy.utils.unregister_class(MYADDON_OT_Operator)
    bpy.utils.unregister_manual_map(add_object_manual_map)

if __name__ == "__main__":
    register()

As far as I know that's not possible. Also it wouldn't make any sense to have more than one option for showing a manual because everything in your addon would be documented in that one manual link. Consider using tooltips for different buttons.

The use of tooltips is certainly useful, in fact I always use them according to the chosen option of the trade, usually it's a piece of cake. I'm facing the online documentation problem for the first time. Usually I used links with an operator well positioned in the panel, with an icon (?) but this time I wanted to deal with the documentation issue in a more "Professional" way, right click and go

add_object_manual_map returns a url string at runtime so we can tap into the logic there. Unfortunately we don't have access to the context in this function so it may not work in a remote setting. But we can use bpy.context and make use of the barely documented bpy.context.button_operator.
import bpy
from bpy.types import Operator
from bpy.props import EnumProperty

class MYADDON_OT_operator(Operator):
    bl_idname = "myaddon.operator"
    bl_label = "Custom ops"
    bl_options = {'REGISTER', 'UNDO'}
    options: EnumProperty(default='ONE', items = (('ONE', "One", ""), ('TWO', "Two", "")))

    def execute(self, context):
        return {'FINISHED'}

# This allows you to right click on a button and link to documentation
def add_object_manual_map():
    url_manual_prefix = "https://docs.blender.org/manual/en/latest/"

    operator = getattr(bpy.context, "button_operator", None)

    option = operator.options if type(operator).__name__ == "MYADDON_OT_operator" else "ONE"

    if option == "ONE":
        url_manual_mapping = (
            ("bpy.ops.myaddon.operator", "scene_layout/object/types.html"),
        )
    elif option == "TWO":
        url_manual_mapping = (
            ("bpy.ops.myaddon.operator", "scene_layout/object/origin.html"),
        )
    return url_manual_prefix, url_manual_mapping

def menu_func(self, context):
    self.layout.operator_enum(MYADDON_OT_operator.bl_idname, "options")

def register():
    bpy.utils.register_class(MYADDON_OT_operator)
    bpy.utils.register_manual_map(add_object_manual_map)
    bpy.types.VIEW3D_MT_object.prepend(menu_func)

if __name__ == "__main__":
    register()

Further reading

This method works well, it's not super comfortable, but it does the job I expected! This is really helpful, I didn't know the "button_operator" attribute, is really helpful.

Hehe agreed. It's ugly but AFAIK the prettiest way to query for this information :) There is also button_prop and button_pointer FWIW. See the docs in my link


text:
3D Scene in VSE: Hide an object keeping the shadow
I have a scene (add / scene) in my VSE, and I made the lights and shadow to match those of the background footage. Now what would be the best way/strategy/approach to hide the plane, only retaining the shadow?
PS - The plane has the basic "new" material for now ; I'll make adjustments later, I just want to know if what I want to achieve is possible..?

EDIT: YES, I know you can use an image as the background/drop of a 3d scene, but this is not what I'm trying to do at all, thank you very much.
EDIT2: Apparently, it is simply not possible. The "only shadows" material checkbox of Blender Internal didn't make it into cycles. I guess it was too handy, intuitive and straightforward ;p

Firstly, yes it is possible. There is a video made by Blender Guru that thoroughly goes through this topic of removing such plane and keeping the shadows. Link to video: Click here

Wow, I knew it would be complex, but... Everything revolves around an "env texture" ("Environmetal (Equirectangular) HDRi texture, the same texture used for World") image that is not included..? Can't reproduce the example without this file..?

It was so simple and intuitive to do in Blender Internal ;(

All those 3 answers are unreproducible.

What about this nice video ?
Tutorial: Cycles Shadows Only: Shadow Catcher (Blender 2.70)

@Sam73 also not about VSE at all, but thanks

If what we see there is all you need, why not do it in the 3D window, using that backdrop photo/video as the "backdrop" and texture your 2D plane with an alpha layered video/photo to make the plane's surface disappear?  Also set it's transparency to suit.  I've been doing this to make "trouble free shadows" in videos so I can render them in GL at about 1/8th of the time and with whatever solidity I like, even give them a life of their own and moving independently of their host.  I can give you much more detail if indeed I understand your question properly.

I'm aware you don't want to use the 3D stage, but consider this..
If what we see there is all you need, why not do it in the 3D window, using that backdrop photo/video as the "backdrop" and texture your 2D plane with an alpha layered video/photo to make the plane's surface disappear?  Also set it's transparency to suit.  I've been doing this to make "trouble free shadows" mirror their host's animations in videos so I can render them in GL at about 1/8th of the time and with whatever solidity I like, even give them a life of their own and moving independently.
Once rendered, as lossless, the result can be imported into VSE for whatever it is you're trying to do in there.  I can give you much more detail if this is answering your question.


text:
Can a mask hide only one object and not the others?
I want to make the word "SECRET" disappear behind the horizon. That is, I need a mask for the lower half of the image, but if I do this, it also hides the sea..! How can I accomplish this?

How did you apply the mask? Have you tried to use the mask strip modifier?

@Ectras I did ; I made a PNG image with the top half transparent, I also tried with a "color" strip, and various combinations of the Mask Modifier ; but no matter what I try, the sea disappears.

OKay, I figured it out:

Using the UV/Image Editor, create a mask, and give it a meaningful name;
Select the "SECRET" text strip ; Its "Blend" should be "Alpha Over" that's the default for text strips anyway, leave it at that;
Add a "Mask" modifier and select your newly created mask by its name.


text:
Artifacts while sculpting
I am trying to sculpt a human head with dynamic topology. It worked so far but now I am getting artifacts when I use the smooth brush.

And when I use the smooth brush

But other brushes like the clay brush are still working without causing those weird artifacts.

Any idea why this is happening?
.blend file

Make sure that under Symmetry \ Lock you turn Lock off. You had lock set to x axis. So the smooth brush was still working but the vertices did not move in the x axis.

Wow.. that was the problem. Thank you very much.

@MaikKlein yes. It took me some time to find out what the problem was as well. good thing you uploaded the blend file. At first I thought you had a nose texture for the smooth brush, but that was not it.


text:
Spawn planes around a circle?

I am trying to create skirt out of leafes but it is actually a pain to position them. Is it possible to create this procedurally?
So that I just create a circle and say spawn 20 textured rectangles around it, would this be possible?
It would look like this, where the red lines are the planes from the top view

Clamp To
Another very easy to use and easy to edit method is to use the Clamp To object constraint modifier, as shown here:

A few points to note:

The object to clamp the leaves to MUST be a Curve, not a mesh
The origin point of the leaf is where it will attach to the belt curve
Make sure "Cyclic" is enabled on the Clamp To modifier or you may have problems moving the leaves around the belt easily

One of the benefits of this method is that you can easily change the position of the leaves on the belt and you can also change the shape of the belt very easily later on.
Another benefit of using the Clamp To modifier is that if you are animating, the shape of belt can change and the leaves will still stay attached to it.

Since you want to create this procedurally you can use modifiers. For this method you will need a curve.

Add a curve, I will use a circle, Shift A -> Curve -> Circle
Modify the curve to your liking

Select the leaf object and add an array modifier

Fit Type: Curve
Curve: the curve we just created

Add Curve modifier to the same leaf object

Object: the curve we just created
Deformation Axis: sometime based on the orientation of the curve and leaf object you need to chose another one

Note that if for some reason steps 3 or 4 do not work you might have to apply the scale for the leaf and curve object. Ctrl L

example file

This looks interesting, how is the number of instances of the leafs controlled? I couldn't reproduce step 4. to which object is this array modifier added?

They are not instances, they are copies. They are controlled by the length of the curve as done in the step 3

@ThomBlairIII updated question

@ThomBlairIII maybe you need to apply the scale of the curve? it works fine for me

@stacker Stacker, did you see Vader's comment about applying the scale etc to the curve & leaf? That enabled me to get step 4 to work.
:)

You could use the Spin  Tool Alt-R in Edit Mode. Make sure that the 3D-cursor is located in the center (pivot point).

Alternatively you could use an Array Modifier with an Empty to control the offset. Set the rectangle and the empty to the origin and add the array modifier as in the image to set the rotation you rotate the empty around its z-axis. Make sure that all transformations on your rectangle are applied (Ctrl-A) before adding the modifier.

Dupliverts is another easy way to duplicate an object at defined locations.
Starting with a leaf and and a mesh circle, make the circle the parent of the leaf and object properties of the circle enable verts and rotation under duplication.

A duplicated of the leaf will then be located at each vertex.

These duplicates can then be turned into real objects with CtrlShiftA

Can you please clarify the steps? I cannot duplicate this, but it looks very interesting. Thanks!

Not sure what to clarify, the leaf is child the circle is parent, the parent has duplicate enabled. It helps if the two objects are aligned before duplication and the leaf object centre is best located at the top point where you want it to join the circle vert. Maybe the manual on dupliverts can help

Thanks sambler, I was using a curve circle, not a mesh.
:)


text:
Textures in cycles are black

I created a bridge, created the uvs and created a material with a texture in cycles. I can see the textured result when I set the viewport shading to material, but when I try to render the image, the material just appears to be black.
Any idea why this could happen?
blend file

The bridge is showing up as black because it has no shader on it. You need to add a shader to it to be able to render it. Let's use a diffuse shader.

In the node editor, Shift A Shader -> Diffuse
Connect the output from the Hue node to the color input of the diffuse shader.
Connect the BSDF output from the diffuse shader to the Material Output's Surface input.


text:
Can't find the Modifier section in Strip properties to use curves
I am using Blender to do video editing, for most part it has been great.
I have been using these tutorials :
As you can see from the video there seems to be Modifier section in properties of the strip modifier.
http://youtu.be/9hR2zNBxh68?t=50s
And this one
http://www.blendtuts.com/video_editing   (if you jump to 20 mins)
But on mine there is no section like that, I am using Blender 2.62 on Ubuntu 12.04
Is there a way to enable this modifiers section.
thanks

Have you tried a newer build of Blender?

The reason why is simple, this feature is not in Blender 2.62. I wasn't able to find the exact version it was added but looking at the videos. I would say any version 2.68 or higher will have strip modifiers.

This feature was added as a part of GSoC 2011 it seems, documentation is scarce and I couldn't find anything in the release logs. This is all trivial anyway, just grab an updated build and you should be good to go.

thanks what were people using to adjust brightness and contrast in the older releases

As iKlsR said, this feature is not in 2.62.
To do this kind of manipulation with 2.62 you will need to use the Compositor.
You can adjust the brightness/contrast in the compositor with a BrightContrast node or an RGB Curves node.
However, I would highly recommend updating your version of blender.
Updating blender:
For Ubuntu, you can install up to date versions of blender by using the irie PPA. Add the PPA to your sources with:
sudo add-apt-repository ppa:irie/blender
sudo apt-get update

See this post on AskUbuntu for more details.
You can also use portable versions from blender.org:

Download the tarball and extract

Run the blender executable in the extracted directory to run blender

(Optional) create a launcher .desktop file, see this post on AskUbuntu for more information.

Note that you can have multiple portable versions of blender at one time.

Also see Where can I get Blender test builds?


text:
Color as Custom Property?
With objects, there you can add Custom Properties to an object, though it only seems to let you specify numeric values.
Is there any way that I can add a color value as a custom property, such as through Blender's python API?
EDIT: To clarify what I am doing: I am making a set of character models for use in a web comic I am making.  The character models will be "generic" ones for ordinary characters (ie: bystanders, pedestrians, etc.).  What I want to do is put some color field properties onto the armature (which is the parent of all the model pieces and clothing), and then use drivers in the model pieces so that they can pull the color data for the clothing, eyes, and skin.
I wish to use this method because I want to use models in a linked fashion, where I import one or more generic models and set the colors in the scene they are used in after importing, so that I don't fill up my hard drive (or my cloud drive) with dozens of .blend files for every color variation I use.
EDIT 2: To clarify further, I wish for a solution that can be applied on a per-model basis, rather than needing to create an addon that adds the same set of properties to all models.

This should help: http://wiki.blender.org/index.php/Doc:2.6/Manual/Extensions/Python/Properties

Does it need to appear in the Custom Properties panel? I would use a FloatVectorProperty() instead, which wouldn't show in tha panel, but can be added to any panel with a custom draw function. It would give you a color field, click to open color picker.

CoDEmanX: Yes, that's pretty much what I want.  How do I set that up?

Here is condensed heavily edited sample add-on an artist requested t use blender as the middleman to mass convert vertex colors data from custom data source, the latter being removed as its not related to the question.
The color value was selected using FloatVectorProperty, specifically with subtype COLOR. This also has the advantage that if exposed through the UI is visualised by the nice UI Color wheel/hex-widget.
The code is split into properties.py and ui.py as this is done for ease of maintainance and separation of concerns, ie storage and display. You can store the custom property anywhere you want I choose object as per the question, the same applies for where the ui appears.
You can also combine it into one script, just need to change registration from module to class and supply each class name.
I generally use a properties group when working with multiple properties, but you can just define a single custom property to attach.
properties.py
import bpy
from bpy.props import FloatVectorProperty, StringProperty, PointerProperty

class ObjectProperties(bpy.types.PropertyGroup):
    @classmethod
    def register(cls):

        bpy.types.Object.custom = PointerProperty(
            name="Custom properties",
            description="Custom Properties for Objects",
            type=cls,
            )

        #Add in the properties you want
        cls.hexwidget = FloatVectorProperty(name="Hex Value",
                                        subtype='COLOR',
                                        default=[0.0,0.0,0.0])

        cls.test_string = StringProperty(name="Test String",
                                        default="I am a string")

    @classmethod
    def unregister(cls):
        del bpy.types.Object.custom

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

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

This module has specific registration handling as we prefer to get rid of custom info if the addon is not install, design decision.
Here is the UI which will display the value stored in the defined property
ui.py
import bpy

class UtilityPanel(bpy.types.Panel):
    bl_label = "Utilites Panel"
    bl_idname = "OBJECT_PT_utilities"

    bl_space_type = "PROPERTIES"
    bl_region_type = "WINDOW"
    bl_context = "object"

    def draw(self, context):
        layout = self.layout

        box = layout.box()
        row = box.row()
        row.prop(context.active_object.custom, "hexwidget")
        row = box.row()
        row.prop(context.active_object.custom, "test_string")

__init__.py for completeness
#--- ### Header
bl_info = {
    "name": "Custom Property: Color",
    "category": "Object",
}

import bpy
import bpy.props

from <folder_name> import ui, properties

def register():
    properties.register()
    bpy.utils.register_module(__name__)

def unregister():
    properties.unregister()
    bpy.utils.unregister_module(__name__)

if __name__ == "__main__":
    register()

When enabled the add-on adds a custom propertygroup to each Object, which can be altered or expanded as you need.

Okay, going to try this out.  Will ask if I have any trouble.

Okay, I have all three scripts copied into the text editor and registered.  How do I hook them up to an object, though?

This is the bare bones of an addon. Create a new folder in your addon directory and enable the new add-on.

Okay, and after that, how do I use it?  Also, I am going to edit the original question to put my use case down so that it fits into the context.

You need to edit the <folder_name> of init to whatever you called the folder you created. Some slight corrections, works and displays in the Properties -> Object tab. See screenshot

Okay, it appears to be working now.  One last question: what do I set bl_context to if I want it to appear in the toolbox instead of the object tab?

Normally I would suggest API documentation but in this case all you get it is "The context in which the panel belongs to. (TODO: explain the possible combinations bl_context/bl_region_type/bl_space_type)". Next solution for finding out stuff is open the tab in question; Left click -> Edit Source find the bl_context.
As for the expanded version of question it might be best to start a new question, referring back tho this as the basis as its turning into a tutorial at this stage.

I think I'll just revise my original question.  Now that I've tried this solution, it doesn't really fit with what I want, since I would have the same set of properties for all of my models, whereas I would want to add them as-needed to specific models.

I wound up utilizing this solution, or rather, a heavily-modified version.  I modded it to all go into a single script, and will be embedding that script as-needed into the .blend files.  Though, I may adapt it further to make it more dynamic (ie: using a list value in Custom Properties to define the colors needed)

Well this is only to show you how to create a single custom property, you can expand as needed. You can also do the other part where you could tie the an update function for the values into the material color or via drivers.

You want to add min=0.0 and max=1.0 to the FloatVectorProperty or the color picker will spazz out trying to pick colors. Also, setting size to 4 allows choosing alpha values.

I'm not sure if this is a recent feature (tested on blender 3.1) or not (otherwise I don't see why nobody mentioned it before), but you can add a color property without using any sort of python, with or without alpha by simply using the type Float Array, set dimension to 3 (4 if you want alpha), and the Subtype should be Linear Color or Gamma Corrected Colors:

This is actually the correct answer to the original question. Thank you! That Subtype field only shows up when using 'Float Array'-- totally eluded me. I wish it was higher up in the list of parameters.

I don't know whether this would be the intended way, but at least it works:
You could add a string representation of other datatypes than integer from the edit dialog, there you could paste a color value Ctrl-V copied from e.g. material settings, this would add a list with 4 floats.

To access your custom properties attached to your object e.g.
o=bpy.data.objects["Cube"]
c = Color( o["customColor"][:3] )
print( c )
>>> <Color (r=0.8000, g=0.2236, b=0.2440)>

To set a color programmatically:
c = Color((1,2,3))
o["customColor"]=c

c2=o["customColor"]
print(c2)
>>> <bpy id property array [3]>

print(Color(c2))
>>> <Color (r=1.0000, g=2.0000, b=3.0000)>

See also:

Assign datablock to custom property
Properties, ID-Properties and their differences

Just want do add:
Similar to python properties, the properties from bpy.props basically provide setter/getter methods for custom properties which actually are items of an ID dictionary.
Creating such a property
bpy.types.Object.test = bpy.props.IntProperty()

has no effect on an object until you assign a value to its test attribute
obj.test = 4
#calls the default setter if not specified which sets the custom property
obj["test"] = 4

The getter method returns the default value if nothing has been set for this attribute
obj.test
#calls the default setter if not specified which either returns the custom property,
#if it exists, or the default value
if "test" in obj:
    return obj["test"]
else:
    return default_value

Custom properties will be saved to the .blend file.
Correct me if i am wrong.
In this case:
#addon bl_info to be inserted here - see Templates -> Addon Add Object
import bpy

def hndl_draw(self, context):
    row = self.layout.row()
    #if "myColor" in context.object.data:
    row.prop(context.object.data, "myColor")

def register():
    bpy.types.Armature.myColor = bpy.props.FloatVectorProperty(
                                     name = "myColor",
                                     subtype = "COLOR",
                                     size = 4,
                                     min = 0.0,
                                     max = 1.0,
                                     default = (0.75,0.0,0.8,1.0)
                                     )
    bpy.types.DATA_PT_display.append(hndl_draw)

def unregister():
    bpy.types.DATA_PT_display.remove(hndl_draw)
    del bpy.types.Armature.myColor

if __name__ == "__main__":
    register()

For all armatures the specified default color will be displayed in Properties Area -> Armature -> Display

If you don't change the color no data will be added to the armature.
You can hide this color picker for objects without the custom property "myColor" by uncommenting the if-line. However you will have to set obj.data["myColor"] = (0.0,0.0,0.0,1.0) manually then (via console, script or UI).

How would I apply this to a specific object?

You can simply assign a custom property. obj["myColor"] = (100, 255, 0). If you create a bpy.props.IntVectorProperty the end result will be the same when saved to the .blend file.

My problem is I'm trying to get it to show up with a color picker.

Added an example.

Tried that, and it appears to work.  However, it appears that if the code is run more than once, the MyColor fields get added multiple times.

Yes. Each time you are appending a new draw handler. bpy.types.DATA_PT_display.remove(hndl_draw) will remove it.


text:
Inverting Vertex Colors?
I am using black & white vertex colors to drive some of the shading on a character model's surface material (cycles), and found that the colors were the opposite of what I needed.
I wound up just swapping the colors on the material's Color Mix node, but now I am wondering: is there any way in blender to invert a model's vertex colors?
EDIT: To clarify, I was wondering if there was any built-in method to directly modify vertex colors.  IE: without using python code or the invert node.

You can invert the colors of a vertex paint with python. The algorithm to invert the color is as follows:
new_color = 1.0 - current_color
Here is the code to invert the color of a vertex paint. Note that you should substitute the name Cube to the name of your mesh. Same goes for the vertex paint layer Col.
import bpy
import random

# get and store the object in object mode
obj = bpy.data.objects["Cube"]
mesh = obj.data

# set active vertex paint layer
color_layer = mesh.vertex_colors["Col"]

v = 0  # current vertex in loop

# iterate over the verices and invert their color
for poly in mesh.polygons:
    for idx in poly.loop_indices:
        col = [(1 - color_layer.data[v].color[i]) for i in range(3)]
        color_layer.data[v].color = col
        v += 1

# We have to refresh Vertex Paint mode to see the changes
bpy.ops.object.mode_set(mode='OBJECT')
bpy.ops.object.mode_set(mode='VERTEX_PAINT')

Final Result

The advantage of this method is that you do not have to constantly invert at rendertime.

why the downvote?

Perhaps you are looking for the Color Invert node.
The top half of the following image shows the vertex colors plugged straight into the models color.
The bottom half shows the Color Invert node inserted between the Attribute node and the final color.

As I stated before, I was just swapping the color values in the mix node, which was the same effect.  I was asking about how to invert the color values directly, rather than just using a node to transform them.


text:
Saving objects' coordinates as RGBA
I need to save multiple objects' location in XYZ as RGBA data on an image. The colors should match that of blender in metric, so if I move the object up 105.4 centimeters in blender, the color should be 1.054. Just like shown here. And even go in the negatives, like the blue.

Furthermore I need to save their rotation in quaternions as RGBA as well, different image though.
I've found this script, but it doesn't do exactly as I need, could it be rewritten, or how would I go about it?
Since I also need the data from multiple objects, saved in a string of pixels.
https://github.com/JoshRBogart/unreal_tools?files=1
For a visual representation of what I need to do, I need to place these track elements (shown in green outline) in a shape to form the belt for a tracked machine. Each pixel corresponds to one element and it's position/rotation. So the number of pixels should match the number of objects.

The rest will then be handled by the shader in the game.
I've included an original file from the game, if it helps.
https://www.dropbox.com/s/amvvysvzrba3w9f/trackArray.rar?dl=0
Thanks.

If I understand correctly you would basically do
def locations_to_image(objects, image_name='Locations'):
    im = bpy.data.images.new(image_name, len(objects), 1)
    i = 0
    for ob in objects:
        im.pixels[i:i+3] = xyz_to_rgb(ob.matrix_world.translation)
        i += 4
    return im

def xyz_to_rgb(xyz):
    # Replace with however you want locations encoded.
    # This is just an example.
    bb_max = 50  # bounding box size
    return [(v + bb_max)/(2*bb_max) for v in xyz]

Edit to match your specifications.
PS. RGBA components are always in the range [0,1], so you'll need to encode them somehow.


text:
How do I open up a window I have closed in blender?
I opened up a new viewport window to move lights, adjust camera, etc which was just grayscale. When I meant to close the new window, I accidentally closed the window that had my materials rendered on the screen so there is no color being rendered. What do I do to get the colors back?
This image should have pink, brown, and blue...

This image should have pink, brown, and blue but it's just grayscale

As a short term fix, you can press Z in the viewport and select either "Material Preview" or "Rendered" from the pie menu.

It worked! Thank you so much!!!

In the top left of any viewport window you'll find this button:

You can turn any window into any other type of window from here, and completely customize your workspace.

In your case, you were in the 3d viewport, but you were in either rendered mode or material preview, and now you're in solid mode.  You can switch between these by pressing Z while your mouse cursor is inside the viewport, or using these buttons in the top right.

Last, if you don't know what you just closed, you can create a new workspace of the type you were working in, here.

You can delete the old workspace and move on like nothing happened.


text:
How do I get an Overlay image to follow elements that move in a video?
My video pans to the right. How do I get the overlaid elements to move with the video so that it seem integrated?

image1: This is where I would like the overlay to stay (beside the 2nd from last tree on the right)

image2: The overlay element doesn't move when the camera pans to the right, it remains static.

You need to learn to use motion tracking, and use the position of the tracker to move other elements in the compositor or the 3D envirionment. Watch the series of videos on tracking called "track, match, blend" by Sebastian Koenig

Thanks a bunch!

The Transformation Tools add-on will simplify the process;:
https://github.com/tin2tin/VSE_Transform_Tools
As described in this tutorial: https://youtu.be/SWLRmTEX2tc


text:
How to use masks on video so that some elements appear in the foreground and others in the back in VSE
I have two people in my video - one in the foreground and the other in the background. I want to place an image of a cage over the person in the background of the video, but the issue I have is the person in the foreground would then be covered with the image also. How do I place this image behind the person in the foreground to make the scene realistic?
(I'm using the video editor workspace).

https://blender.stackexchange.com/a/175980/92768

I'll check it out. Thank you.

Read the following post: how to attach text to a tracked point on video clip