Script idea: create a bone between two coordinates

Moho allows users to write new tools and plugins. Discuss scripting ideas and problems here.

Moderators: Víctor Paredes, Belgarath, slowtiger

Post Reply
User avatar
moe33
Posts: 12
Joined: Mon Sep 23, 2019 4:56 am
Location: Beijing

Script idea: create a bone between two coordinates

Post by moe33 »

Hi everyone, I have a idea for a script: Get two position coordinates and create a bone between the two coordinates. A bit like DUIK.
I made a script by myself. I'm really sorry that I don't know how to write code at all. The script is made entirely by copy and paste...
This script can only get the coordinates of two points, and then create a bone.
Maybe the code looks messy, but luckily it can be used.
But I hope it can have more functions, such as getting the center coordinates of a shape or the center coordinates of a layer.
If you can, please help me improve this script...
Thank you very much!

https://drive.google.com/drive/folders/ ... sp=sharing
User avatar
gilcartunista
Posts: 55
Joined: Mon Mar 14, 2016 7:13 pm
Location: https://www.facebook.com/gil.cartunista
Contact:

Re: Script idea: create a bone between two coordinates

Post by gilcartunista »

Hi moe33...Thank you!!! I use Moho 11, and it works beautifully!!! Grateful!!! For your enormous generosity! Grateful!
User avatar
SimplSam
Posts: 1218
Joined: Thu Mar 13, 2014 5:09 pm
Location: London, UK
Contact:

Re: Script idea: create a bone between two coordinates

Post by SimplSam »

I know the Grid (View > Enable Grid) is not so good, but did you try using that to get your bones to snap?

I know we definitely need better Snapping support for all 'draw/transform' tools.
Moho 14.3 » Win 11 Pro 64GB » NVIDIA GTX 1080ti 11GB
Moho 14.3 » Mac mini 2012 8GB » macOS 10.15 Catalina
Tube: SimplSam


Sam
Daxel
Posts: 1081
Joined: Wed Mar 27, 2019 8:34 pm

Re: Script idea: create a bone between two coordinates

Post by Daxel »

Thanks for the script!
I use the "divide" feature on the select points tool frecuently to create a point in the middle of other two for things like these where I want something centered.
User avatar
moe33
Posts: 12
Joined: Mon Sep 23, 2019 4:56 am
Location: Beijing

Re: Script idea: create a bone between two coordinates

Post by moe33 »

SimplSam wrote: Thu Aug 05, 2021 8:11 pm I know the Grid (View > Enable Grid) is not so good, but did you try using that to get your bones to snap?

I know we definitely need better Snapping support for all 'draw/transform' tools.
Yes, I have tried to use the grid, but it is troublesome.
So I want to use a script to get the coordinates in order to accurately build the bones.
You can try to use my script, it can accurately build bones between two points.
animationfan
Posts: 10
Joined: Thu Nov 28, 2024 10:34 am

Re: Script idea: create a bone between two coordinates

Post by animationfan »

moe33 wrote: Wed Aug 04, 2021 3:02 pm Hi everyone, I have a idea for a script: Get two position coordinates and create a bone between the two coordinates. A bit like DUIK.
I made a script by myself. I'm really sorry that I don't know how to write code at all. The script is made entirely by copy and paste...
This script can only get the coordinates of two points, and then create a bone.
Maybe the code looks messy, but luckily it can be used.
But I hope it can have more functions, such as getting the center coordinates of a shape or the center coordinates of a layer.
If you can, please help me improve this script...
Thank you very much!

https://drive.google.com/drive/folders/ ... sp=sharing
Hey Moe33. downloaded your script "bone between two coordinates" but it shows "missing resource image" error! please rectify.
User avatar
SimplSam
Posts: 1218
Joined: Thu Mar 13, 2014 5:09 pm
Location: London, UK
Contact:

Re: Script idea: create a bone between two coordinates

Post by SimplSam »

animationfan wrote: Tue Dec 17, 2024 7:55 am Hey Moe33. downloaded your script "bone between two coordinates" but it shows "missing resource image" error! please rectify.
I have checked the version at: https://moeu33.notion.site/Set-A-Bone-B ... 735e353b0a

And everything is there. The content of Tool\ should be copied to your <Custom Content Folder>\Scripts\Tool\ folder and the content of ScriptResources\ to your <Custom Content Folder>\Scripts\ScriptResources\ folder.

Note: If you have already had the error for "missing resource image", then you will need to restart Moho after you have the placed images folder 'mu_set1bone' in the right place.
Moho 14.3 » Win 11 Pro 64GB » NVIDIA GTX 1080ti 11GB
Moho 14.3 » Mac mini 2012 8GB » macOS 10.15 Catalina
Tube: SimplSam


Sam
animationfan
Posts: 10
Joined: Thu Nov 28, 2024 10:34 am

Re: Script idea: create a bone between two coordinates

Post by animationfan »

SimplSam wrote: Tue Dec 17, 2024 5:05 pm
animationfan wrote: Tue Dec 17, 2024 7:55 am Hey Moe33. downloaded your script "bone between two coordinates" but it shows "missing resource image" error! please rectify.
I have checked the version at: https://moeu33.notion.site/Set-A-Bone-B ... 735e353b0a

And everything is there. The content of Tool\ should be copied to your <Custom Content Folder>\Scripts\Tool\ folder and the content of ScriptResources\ to your <Custom Content Folder>\Scripts\ScriptResources\ folder.

Note: If you have already had the error for "missing resource image", then you will need to restart Moho after you have the placed images folder 'mu_set1bone' in the right place.
THANKS SimplSam. It worked yesterday and didn't know what right thing I did! deleted some files and I broke it again. Thanks a ton Simplsam for highlighting the correct way. Its up and working flawlessly. Cheers!
Post Reply