Giter VIP home page Giter VIP logo

Comments (3)

paulrobello avatar paulrobello commented on June 20, 2024

Same error, OS and Sorcar Version. Using Blender V2.93.1

from sorcar.

Credomo avatar Credomo commented on June 20, 2024

Hello, problem occurs due to blender API evolution

API
https://docs.blender.org/api/current/bpy.ops.mesh.html

bpy.ops.mesh.select_random(ratio=0.5, seed=0, action='SELECT')
    Randomly select vertices
    Parameters
            ratio (float in [0, 1], (optional)) – Ratio, Portion of items to select randomly
            seed (int in [0, inf], (optional)) – Random Seed, Seed for the random number generator
            action (enum in ['SELECT', 'DESELECT'], (optional)) –
            Action, Selection action to execute
                SELECT Select, Select all elements.
                DESELECT Deselect, Deselect all elements.

Code evolution
C:\Users[user]\AppData\Roaming\Blender Foundation\Blender\2.93\scripts\addons\Sorcar-master\nodes\selection\ScSelectRandom.py

import bpy

from bpy.props import EnumProperty, IntProperty, FloatProperty
from bpy.types import Node
from .._base.node_base import ScNode
from .._base.node_selection import ScSelectionNode

class ScSelectRandom(Node, ScSelectionNode):
    bl_idname = "ScSelectRandom"
    bl_label = "Select Random"
    
    #in_percent: FloatProperty(default=50.0, min=0.0, max=100.0, update=ScNode.update_value)
    in_ratio: FloatProperty(default=0.5, min=0.0, max=1.0, update=ScNode.update_value)
    in_seed: IntProperty(default=0, min=0, update=ScNode.update_value)
    in_action: EnumProperty(items=[("SELECT", "Select", ""), ("DESELECT", "Deselect", "")], default="SELECT", update=ScNode.update_value)
    
    def init(self, context):
        super().init(context)
        #self.inputs.new("ScNodeSocketNumber", "Percent").init("in_percent", True)
        self.inputs.new("ScNodeSocketNumber", "Ratio").init("in_ratio", True)
        self.inputs.new("ScNodeSocketNumber", "Seed").init("in_seed", True)
        self.inputs.new("ScNodeSocketString", "Action").init("in_action", True)
    
    def error_condition(self):
        return(
            super().error_condition()
            #or (self.inputs["Percent"].default_value < 0 or self.inputs["Percent"].default_value > 100)
            or (self.inputs["Ratio"].default_value < 0 or self.inputs["Ratio"].default_value > 1)
            or self.inputs["Seed"].default_value < 0
            or (not self.inputs["Action"].default_value in ["SELECT", "DESELECT"])
        )
    
    def functionality(self):
        bpy.ops.mesh.select_random(
            #percent = self.inputs["Percent"].default_value,
            ratio = self.inputs["Ratio"].default_value,
            seed = int(self.inputs["Seed"].default_value),
            action = self.inputs["Action"].default_value
        )

from sorcar.

wyhinton avatar wyhinton commented on June 20, 2024

Getting this error in blender 3.1.2 and sorcar 3.2.1
OS: Windows

from sorcar.

Related Issues (20)

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.