Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[QUESTION] Index Switch and multiple Items #51

Open
enzyme69 opened this issue Apr 10, 2024 · 3 comments
Open

[QUESTION] Index Switch and multiple Items #51

enzyme69 opened this issue Apr 10, 2024 · 3 comments

Comments

@enzyme69
Copy link

enzyme69 commented Apr 10, 2024

I am using Blender 4.1 and Geometry Script addon.

I wonder why the code below does not work?

In case, I just want to "fill up" the Index Switch and have more "add items" to the strings, how is the easiest way to do this without having to create and connect lots of String node?

BELOW FAILED:
blah = index_switch(data_type = "STRING", index = 1, 0 = "apple", 1 = "banana")
blah = index_switch(data_type = "STRING", index = 1, inputs[1] = "apple", inputs[2] = "banana")

FULL CODE BELOW FAILED:

from geometry_script import *


@tree("String Combo")
def stringcurve(geometry: Geometry):
    a = string(string = "apple")
    b = string(string = "banana")
    c = string(string = "orange")
    d = string(string = "papaya")
    blah = index_switch(data_type = "STRING", index = 1, a, b)
    blih = blah.string_to_curves()
    #bluh = blih.fill_curve().Geometry
    return blih
Screenshot 2024-04-10 at 4 07 16 PM
@enzyme69
Copy link
Author

enzyme69 commented Apr 10, 2024

The documentation specified:

index_switch(
index_switch_items: Collection,
data_type: IndexSwitch.DataType,
index: Int,
0: Geometry,
1: Geometry,
: Virtual
)

But that 0 and 1 does not seem to work...

A bit of example or documentation on adding into Blank Socket would be nice.

@enzyme69 enzyme69 changed the title Question Index Switch and multiple Items [QUESTION] Index Switch and multiple Items Apr 10, 2024
@enzyme69
Copy link
Author

Screenshot 2024-04-11 at 7 23 44 PM

If I were to do this using normal bpy and not geometryscript, it's still weird.

@enzyme69
Copy link
Author

enzyme69 commented Apr 11, 2024

I figure this out which indeed "Add Item" into Index Switch:
index_switch_node.index_switch_items.new()

But I wonder if Geometry Script provides a way to "connect" into this "Virtual slot"?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant