Is it possible to add custom base meshes?

I really need a + and a X as base meshes.

Any way to make them and add them in the base mesh menu?

Yeah, it’s possible with Python- the Extra Objects addon that comes with Blender adds in things like the Utah Teapot to the menu, ANT Landscape tools adds a landscape generator, there’s a rock generator, bolt factory, etc

ya but how do i add things by myself?

Write an add-on :slight_smile: I’d check out the code for the Extra Objects add-on, it should be a great template. You could even just add to the existing code with your own meshes

i have zero idea how to code…

Since i added something here on BA to the teapot example (correct ratio and the cup… or something…) to add something to an existing addon can be easy or complex… it depends on the structure of the addon…
Anyway: if you are not experienced in this it may be simpler to use the asset manager ? So you can also add a - or a # or whatever :wink:

1 Like

i didnt understand what you said here

Okidoki was basically cautioning you from their own experience with adding a teapot and cup that it might not be as easy as Joseph made it sound.

I concur that using the asset manager is probably a good choice, that’s how most of us do it. It’s a few more steps, but it’s also very flexible.

Other ways:

  • You could try and get somebody to do the programming for you, paid or volunteer.

  • You could add the additional base meshes to your default scene, invisibly, and if you never use them in a scene just delete them.

1 Like

There was someone here on BA who found that the Utah Teapot and Spoon also had a cup (and a milk pot) and wanted to add it… (also that the original had another x/y ratio because of the pixel ratio of the machine which it was made on) and wanted some help to implement it in the Extra Object addon … i did help… and so … simply based on the standard blender template (says blender 2.8 but i did it in 3.3)… add a cross…
addon_add_object.py (4.2 KB)

2 Likes

hey this works great, but is there a way to make the thing, thinner, by default?

I forknew that there will be a question how to change something… :crazy_face:

…have patience…
1 Like

Okay now… not so fast hack…
Open up blender make any (mesh) object you want or import it… but only one, be in object mode, switch workspace to scripting, in the text editor load the above script into the editor and add a new text data-block by menu Text → New, now load this one convertObjToPyData.py (1.3 KB) into the text editor (or load both directly into a new one), now press the Play button (Run script) for the last one (convertObjToPyData.py).
The result should be a new text data block named after your object !! Copy all text in it and paste it over the:

verts = [ ...
]
...
faces = [ ...
]

area in the addon_add_object.py . Now change all Cross to the name you want it to be (OBJECTNAME)… and Save as… (!!) addon_add_OBJECTNAME.py

Now delete your object in 3Dview and install addon via Edit → Preferences: Install and select addon_add_OBJECTNAME.py… and activate it…

Now Add → Mesh → Add Object: OBJECTNAME and if there are any errors…
…
…you have to wait at least until tomorow…

:rofl:

2 Likes

OMG IT WORKED!!!

Here’s the result.
addon_add_plus.py (3.8 KB)

Now the final question. Is it possible to add more than one object in the script?

also, it seems i cant do two different addons, one for cross and one for plus.

if i make two different ones, it becomes either both plus or both cross.

Hmmm… not on my side… but i have to check the unregister method…

You need to have different names for both the Operator classes and bl_idname. If not, one addon will overwrite the other.

1 Like

the whats?

i saved the two files as addon_add_plus.py and addon_add_cross.py

This doesn’t to be it… but there is something while unregistering…

RuntimeError: unregister_class(...):, missing bl_rna attribute from 'RNAMeta' instance (may not be registered) 

…but someone can unregister and also delete…

Anyway the version info seems to be changed: the original template has

"blender": (2, 80, 0),

but changed to

"blender": (3, 22 , 0),

seems to not correct now…
should be:

"blender": (3, 2, 2),

because my 3.3.1 was complaining…

Yes… but i just filled this into the template (scripts texteditor Templates → Python → Addon Add Object)…

I wanted to refresh my addon development knowledge anyway :wink: there where some changes too.

(The template seeme to have no bl_idname for example… okay i’m checking the bl_info updates)

Ahh yes now i see… thanks…

It’s better to change also the line:

bl_idname = "mesh.add_object"

to something like:

bl_idname = "mesh.add_object_OBJECTNAME"

So the unregister method does spitt an error…

And funny thing in the docu there is something:

When the version number ends in zero, you need to supply that 0 too, as in (2, 50, 0) and not (2, 5, 0).

So the template does it wrong (all the time since 2.8)…

Hmmm :thinking: … i cannot replicate that with my cross and your plus:

BothAddons

I’ll have to try this