When you click "render" or "render animation" (or use the command line -f or -a) is there a way you can hook into those using python? I have multiple cameras with different rendering resolution for X and Y. So I need to mess with bpy.data.scenes["Scene"].render.resolution_y and bpy.data.scenes["Scene"].render.resolution_x before the render.
I can write a script to mimic -a or -f via the command line, but it would be nicer to hook into the existing UI buttons and CLI options.
Hi all, I wanted to ask that are the 3D scenes that are native to blender 2.8 cycles are also compatible with the blender 2.79 version? I'll be accessing these scenes using the bpy python API of blender 2.79.
Hi all! I'm currently a part of a computer vision-based research lab and we are looking into using blender for making realistic-looking synthetic datasets for training models. We need at least 100 such scenes for creating a large diverse dataset and have bought all the blender-based Evermotion ArchInterior scenes(~40 scenes) but now are having a hard time finding more realistic-looking blender scenes. So I was hoping that you guys can point me to the right place for buying some more dope-ass realistic looking blender scenes.
I'm currently trying to render an emotion ArchInterior scene using blender python bpy but am getting something weird and am not sure what's going on. Nearly half of the image is abruptly grayed out or not rendering at all I guess. So can someone help me?
hey guys I'm new to scripting . I wanted to make a script run continually without blender pausing or loosing functionality. to my understanding I need to make a modal operator that does this. however when in run blenders modal operator template that moves the object left and right, I can no longer add an object to the scene, "shift+a" doesn't work anymore even if I comment out the line that makes left click finish and click on object or add menus nothing happens to me this is loosing functionality so wanted to know if there is a way to make something continually happen without loosing any functionality . any help is greatly appreciated thanks.
I am running the scene raycast function on a bunch of different objects in a scene with thousands of objects and it can take a half a second to a second per ray, which seems incredibly slow to me. I'm wondering if anyone here might have tips on how I can optimize this a bit. Please note, I'm raycasting to collection instances so I don't think I can use object.ray_cast since non mesh object types aren't supported (if I'm wrong about this please let me know)
I am trying to use the scipy.interpolate.interpn function within blender. I assumed the only way to do this is to utilize the sverchok addon, so my first attempt at using this function is with the sverchok addon, but let me know if there is a better way to do this.
Although I have some basic knowledge of python, I think I am a bit out of my depth here. Nonetheless, I tried writing a script to use with the Scripted Node Lite node in sverchok:
"""
in in_points v
in values s
in xi v
out out_values s
"""
import numpy as np
import sys
from sverchok.utils.logging import exception, info
from sverchok.data_structure import zip_long_repeat
try:
import scipy
from scipy.interpolate import interpn
except ImportError as e:
info("SciPy module is not available. Please refer to https://github.com/nortikin/sverchok/wiki/Non-standard-Python-modules-installation for how to install it.")
raise e
out_values = []
for everypoint in xi:
new_values = interpn(points, values, xi, method='linear', bounds_error=True, fill_value=0)
out_values.append(new_values)
Here is what I get when I try to use the script as a scripted node in blender:
I'm porting a third-party import/export plugin from Blender 2.79 to 2.8. However, I'm having issues adapting its handling of temporary meshes and shape key data.
In preparation for export, it creates a copy of the mesh to operate upon without altering the original:
[Blender 2.79; 'object' is the currently selected model]
# Make a copy of the mesh to keep the original intact
mesh = object.to_mesh(bpy.context.scene, False, 'RENDER', False, False)
temp_obj = bpy.data.objects.new('temp_obj', mesh)
2.9's 'Object.to_mesh' no longer works in this context. To quote the doc, "the result is temporary and can not be used by objects from the main database."
My solution was to use:
# Make a copy of the mesh to keep the original intact
depsgraph = bpy.context.evaluated_depsgraph_get()
object_eval = object.evaluated_get(depsgraph)
mesh = bpy.data.meshes.new_from_object(object_eval, preserve_all_data_layers=True, depsgraph=depsgraph)
temp_obj = bpy.data.objects.new(name='temp_obj', object_data=mesh)
Problem, this isn't copying the mesh's shape key data. Is there something I missed, or should I just rethink this whole process?
so basically i am creating a asset pack, and i would like to create a add on that imports or appends the models into the scene. I've found a template that includes the import code, but i need to somehow connect the assets so the code knows what to import
I have some code that adds a premade python script then makes a linked always and python controller but how do i assign a script to it?
bl_info = {
"name": "Move X Axis",
"blender": (2, 90, 0),
"category": "Object",
}
import bpy
class ObjectMoveX(bpy.types.Operator):
"""My Object Moving Script""" # Use this as a tooltip for menu items and buttons.
bl_idname = "object.move_x" # Unique identifier for buttons and menu items to reference.
bl_label = "Move X by One" # Display name in the interface.
bl_options = {'REGISTER', 'UNDO'} # Enable undo for the operator.
def execute(self, context): # execute() is called when running the operator.
# The original script
bpy.ops.text.open(filepath='D:\\test.py')
obj = bpy.context.object
sensors = obj.game.sensors
controllers = obj.game.controllers
bpy.ops.logic.sensor_add(type="ALWAYS", object=obj.name)
bpy.ops.logic.controller_add(type="PYTHON", object=obj.name)
# Newly added logic blocks will be the last ones:
sensor = sensors[-1]
controller = controllers[-1]
sensor.link(controller)
return {'FINISHED'} # Lets Blender know the operator finished successfully.
def register():
bpy.utils.register_class(ObjectMoveX)
def unregister():
bpy.utils.unregister_class(ObjectMoveX)
# This allows you to run the script directly from Blender's Text editor
# to test the add-on without having to install it.
if __name__ == "__main__":
register()
I'm looking for someone that can write me 2 simple addon templates. I don't really have time to learn python and i can't get what i want from the short tutorials on YT so i want to pay someone to write me 2 relatively customizable templates.
First one - N-Panel that allows me to append specific collection from a .Blend.
Good example of that would be Botaniq (https://blendermarket.com/creators/polygoniq) addon that has pretty much everything i would like. Only talking about "Spawn Asset" button.
If possible, button should be skipped directly into the "spawn asset" menu removing top 4 checkboxes and "make editable" checkbox.
All i need from this is to just have that kind of menu for appending collections with assets. I'm not asking for 100% copy of course, this is just an example of what i'm looking for. Main purpose for that is so i can have 1 blend file in the addon folder with my assets and append them easily. Bonus points if i can also append brushes with custom icons, i don't know if that's possible in a one addon but it would be great if it was possible. Mainly talking about texture draw brushes but sculpt brushes are appreciated too. It all should work like a normal addon so i can share it with friends.
In the code itself i'd like to have descriptions for segments of the code and it should be most importantly easy to change up so i can reuse it for different addons.
Second Addon - N-Panel like above but this time just really really simple including only 3 tabs found in the armature tab, "Skeleton", "Pose Library" and "Custom Properties"
nothing more nothing less. Should take that data from the active armature. Simply want it to make my personal rigs a bit easier to use for external users. All 3 tabs should be collapsible.
I hope i'm not asking for too much and it all should be relatively easy to write.
PayPal only, price will be discussed privately. If you're interested in working on those addons for me either add me on Discord DanteBoi#3228 or just leave your contact info here. Please straight up show me what did you do in Python so far just so i can see if i can trust you and tell me the pay you expect for it. Thank you ^^
If i'm posting this in a wrong place, please forward me to a correct one. I tried to look around for some kind of addon commissions but i couldn't really find anything.
Originally posted in r/blender but decided to post here too.
I think I just don't know the terminology to be able to find this solution. Here's an example of what I'd like to achieve -
Link the focal length of Camera B to the focal length of Camera A, so whenever A changes focal length, B changes as well. I can parent the two objects together, but can't figure out how to link other properties.
I’m likely searching with the wrong terminology, but I don’t know what to search for if I don’t... know what to search for haha. Can anyone help?
To go on a bit more detail - I want to use the add on to create an import list of a variety of screws / nuts and bolts to add to scenes, as they’re a bit tedious to model or track down from old files every time.
It seems like it should be relatively simple, even at my skill level, and I’m struggling! Any help appreciated :)
Pie menu question. Attempting to make a pie menu for my addon in Blender. I've got 8 operators defined, one for each of the rows in the pie and that works great. But i'd like to have some kind of menu button to switch the operators over to a different set, without completely calling an entirely different pie. I assume this requires replacing the operators with a variable that references a list in which case you can use matrix integers to determine which listed object appears as the operator the pie menu is calling at the time? let's just say each operator is a type of modifier or basic tool to perform a function like add a cube for now. I'd like to be able to cycle through which toolset is being called up to give the pie a bit more multi-purpose if that makes sense.