User
Write something
Coffee Hangout is happening in 11 days
Help debugging my addon
Hey its been a while, but I have been spending that time modifying my add-on a lot. I would like for you guys to download the add-on and see if there are any bugs or any other funny stuff going on. V-------------------------------------------------------------------------------------------------------------------------------------------------------------- What is the addon? The addon is an attribute editor menu, making it so that you can edit attribute values all in one place without going to Mesh > SetAttribute every time you want to edit a single attribute value. Saves time and reduces clicks. How to download it: Download the attached ZIP file, once you have done so go into blender Preferences > Get Extensions and in the top right hand corner there should be a down arrow. Click it then click on "Install from Disk" and select the addon zip and restart Blender. How to use it: - Once installed open the side bar or press N and you should see a tab called "AttributeMenu". - In "Attribute Props Panel" click on "add new attribute". - There you can select from a list of attributes. If you don't have any attributes, go to the properties panel and go to Data > Attribute and create a new attribute. - When you select an attribute from the list of attributes, you'll be able to see and edit it in the "Attribute Props Panel" Make sure that the attribute data type is either an int or bool or float data type, otherwise it wont work (I am planning to add support for different data types in the future). If you don't see the attribute in the property panel then its is likely in a different domain. So if you add an attribute, which domain is in face, but you are in vertex mode, just make sure to go to face select mode, and you should see the attribute in the panel. ----------------------------------------------------------------------------------------------------------------------------------------------------------------- Like I said I would like help debugging and finding errors and bugs n stuff, also new ideas on how to improve the addon would be greatly appreciated as well!
Vertex attribute editor
So for like the past month and a half I've been trying to create a menu that can edit all your custom attributes. And with the help of @Victor Stepanov, @Christian Coppes and a little bit of chat gpt, this is what I was able to do it. I wanted to not only showcase what I've done, but ask for a code reveiw because I feel like there is a bit more that could be optimised and I just wanted to see if there is anything worth improving. Like for instance I think in lines 119-122 and 223-226 I think that if you have a ton of attributes you want to create a property for, you could run into an issue where that section of the code takes up 15 lines instead of like the, so far, managable 4 lines. Attached is the script as well as a short gif demonstrating what it does. Tysm
Vertex attribute editor
Error in Part 2, chapter 1, exercise 3
In this exercise, I’m to add a random colour to a point light and give the light a location. If I run the script repeatedly (after clearing the scene each time), however, I eventually get this error message which crashes the script: Python: Traceback (most recent call last): …line 46, in <module> …line 44, in add_light ValueError: bpy_struct: item.attr = val: sequences of dimension 0 should contain 3 items, not 4 Just wondering what’s happening. I’ve attached my blend file for reference. Thanks!
Puzzling result (Part 1-6 exercise)
I get a puzzling result with my script: for i in range(10): if i % 2 == 0: bpy.ops.mesh.primitive_cube_add() else: bpy.ops.mesh.primitive_uv_sphere_add() bpy.context.active_object.location.y = i * 2 red_mat = bpy.data.materials.new("red") red_mat.diffuse_color = [1, 0, 0, 1] blue_mat = bpy.data.materials.new("blue") blue_mat.diffuse_color = [0, 0, 1, 1] cube_count = 1 sphere_count = 1 for obj in bpy.data.objects: if "Cube" in obj.name: obj.data.materials.append(red_mat) obj.name = f"Red Cube #{cube_count}" print("Cube " + str(cube_count)) cube_count += 1 else: obj.data.materials.append(blue_mat) obj.name = f"Blue Sphere #{sphere_count}" print("Sphere " + str(sphere_count)) sphere_count += 1 This spits out the following print statements: Cube 1 Cube 2 Cube 3 Cube 4 Cube 5 Cube 6 Cube 7 Cube 8 Cube 9 Cube 10 Cube 11 Cube 12 Cube 13 Cube 14 Sphere 1 Sphere 2 Sphere 3 Sphere 4 Sphere 5 There are only five cubes in the scene. Why does it go to 14?
Creating own Node Editor without headache (now an official Blender extension)
Hi! I found it very complicate to insert self-written nodes into Blender. First problem is, it seems not to be possible to insert them into standard Node editors like the Geometry Node Editor. That's very sad, as we could not use all the existing nodes together with own ones. So I would need to create at least a bunch of own node classes to have a basic functionality in an own Node Editor - which also cannot import any existing nodes from other Blender Node Editors. Inspired by a video from Victor explaining how to create scripts to manipulate Geometry Nodes I decided to create an own little library to manage easy creation of nodes, node categories and nodes. Result is "ccn_utils" attached here. In "HowToCall" is an example of - you guess it... :) The central thing is that you can simply use a dictionary to add all together: node_manager = ccnu.CCNNodeEditorManager() editor1 = node_manager.add_editor("Editor with Categories", icon="NODETREE", force_overwrite=True) tree_id = editor1.bl_idname print(tree_id) # Create dictionary category_dict = { "Test Cat 3": [DynamicInputNode, MyNumberNode], "Test Cat 4": [MyOutputNode, ColorGeneratorNode, MyOperatorNode], } With the first line the node manager is created with a reference to it. That is a class from the library. With "add_editor" you create a node editor. You only need the label as in the example - the corresponding very unique internal id you never need, it's created automatically (but you can read it out, see tree_id). And then the magic is in the dictionary: You have keys which are the label of the categories you want to create. And as value a list of the class names which must have been registered before (see code). And then, everything you need to do is: editor1.create_categories_from_dict(category_dict, force_overwrite=True) This creates the categories or reuses them if they exist, it creates the node entries and with "force_overwrite" they will be unregistered before, which is good while developing, so you can quickly change the Node code and rerun this and the change is directly visible in the node editor, even with already inserted nodes.
1-17 of 17
CG Python Academy (Free)
skool.com/cgpython
3D artists learning Blender Python.
Leaderboard (30-day)
Powered by