Code Monkey home page Code Monkey logo

blender_plus_python's Issues

The sequence_editor_stitched_together_clips_done.py does not work from command-line

The sequence_editor_stitched_together_clips_done.py works when I paste the code in GUI, have the Video Editor open and hit run. When layout is open or when or running from command-line using blender.exe -b -P sequence_editor_stitched_together_clips_done.py, it gives this error:

File "C:\myProjects\myBlender\sequence_editor_stitched_together_clips_done.py", line 91, in create_transition_between_videos bpy.ops.sequencer.movie_strip_add( File "C:\Program Files\Blender Foundation\Blender 3.4\3.4\scripts\modules\bpy\ops.py", line 111, in __call__ ret = _op_call(self.idname_py(), C_dict, kw, C_exec, C_undo) RuntimeError: Operator bpy.ops.sequencer.movie_strip_add.poll() failed, context is incorrect

How can I modify the code to avoid this. In other words, how can I choose the Video Editor context inside the code.

(I'm using Blender 3.4)

adding "AgX - " to startup files for "Very High Contrast"

several project startup files have errors in Blender v4.0, as with Weave, for example:

.../weave_done.py", line 209, in set_scene_props
TypeError: bpy_struct:
   item.attr = val: enum "Very High Contrast" 
      not found in (..., 'AgX - Very High Contrast', 'AgX - High Contrast', ...)

this is fixed by changing

209    scene.view_settings.look = "Very High Contrast"

to

209    scene.view_settings.look = "AgX - Very High Contrast"

a bug ?

import bpy
import bmesh
import random as rnd

def deleteall():
bpy.ops.object.select_all(action='SELECT')
bpy.ops.object.delete(use_global=False, confirm=False)
for m in bpy.data.materials:
bpy.data.materials.remove(m)

def RndColor():
return [rnd.uniform(0,1.0),rnd.uniform(0,1.0),rnd.uniform(0,1.0),1.0]

def SetMaterial(obj,color):
material = bpy.data.materials.new(name=f'rnd color material') # maybe repeated
material.use_nodes = True
#rnd_material.diffuse_color = RndColor()
#bpy.data.materials[rnd_material.name].node_tree.nodes["Emission"].inputs[0].default_value = (0.0441256, 0.57093, 1, 1)
material.node_tree.nodes["Principled BSDF"].inputs["Metallic"].default_value = rnd.uniform(0,1)
material.node_tree.nodes["Principled BSDF"].inputs["Roughness"].default_value = rnd.uniform(0,1)
material.node_tree.nodes["Principled BSDF"].inputs["Base Color"].default_value = color
obj.data.materials.append(material)

def go_1():
deleteall()

a = []
for _ in range(9):
    x = rnd.uniform(-5,5)
    y = rnd.uniform(-5,5)
    z = rnd.uniform(-5,5)
    a.append([x,y,z])
    print(x,y,z)
    
for aa in a:
    if aa[2] <= -2:
        bpy.ops.mesh.primitive_ico_sphere_add(radius=1, location=[aa[0],aa[1],aa[2]])
    elif aa[2] > -2 and aa[2] <= 1:
        bpy.ops.mesh.primitive_cube_add(size=1,location=[aa[0],aa[1],aa[2]])
    else:        
        bpy.ops.mesh.primitive_cone_add(location=[aa[0],aa[1],aa[2]])
    obj = bpy.context.active_object
    SetMaterial(obj,RndColor())

cubes = []
for obj in bpy.data.objects:
    if "Cube" in obj.name:
        cubes.append(obj)

for cube in cubes:
    location = cube.location
    bpy.data.objects.remove(cube)
    bpy.ops.mesh.primitive_monkey_add(location=location)
    obj = bpy.context.active_object
    SetMaterial(obj,RndColor())

#----------------------------------------------------------------------------------------
if name == "main":
go_1()

Emmisive vs Emissive Color

with Weave project files 'weave_start.py' and 'weave_done.py' :

running scripts on Blender v4.0.2 causes:

  File ".../weave_done.py", 
  line 307, in create_emissive_material
  KeyError: 'bpy_prop_collection[key]: key "Emission" not found'

code currently reads:

  307     material.node_tree.nodes["Principled BSDF"].inputs["Emission"].default_value = color

changing the input name to "Emission Color" fixes this error

 307     material.node_tree.nodes["Principled BSDF"].inputs["Emission Color"].default_value = color

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.