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

Implemented a new NURBS output plug, added icons, AETemplates and a 2025 variant to github actions #27

Merged
merged 6 commits into from
Jul 23, 2024

Conversation

mdilena
Copy link
Contributor

@mdilena mdilena commented Jul 16, 2024

Checklist

  • I have read the CONTRIBUTING.md document
  • I have added documentation regarding my changes where necessary

Types of Changes

  • Bugfix (change that fixes an issue)
  • New Feature (change that adds functionality)
  • Documentation Update (if none of the other choices apply)

Proposed Changes

This is another update I've been sitting on for a while, as the first time I used this plug-in on a project I ended up needing nurbs representation of the spline too, so I figured I could give it a try.
I also took the chance to clean up some code that I found out was unnecessary for what regards the new viewport 2.0 implementation, adding icons, attribute editor templates and making sure github actions are all up to date with latest stuff. I also fixed the plug-in version and bumped it to 1.1.0, as I think we're past beta by this point, guess I considered 1.0.0 the previous merge request I made 😁

I also moved the gifs to a local images folder, as it's nice to have them when the repo is cloned offline and the website is not reachable!

Don't mind twistSpline.h and twistTangentNode.cpp changes, they're only whitespaces and it's because I accidentally included some experiments I was doing and rolled them back, they got trimmed when I re-saved the file 😅

mdilena added 4 commits July 15, 2024 22:47
* added a nurbs data output plug + cleanup

* Nurbs output, cleanup and AETemplates

* Updated xcode in github actions
@tbttfox
Copy link
Member

tbttfox commented Jul 17, 2024

Icons? Nice! And you're right, it's definitely out of beta by this point.
I really appreciate this.
And fair enough with the images, but I'm curious why the xpm's as well as the png's?
I'll run these changes through our code to make sure it doesn't break anything, but everything looks good at first glance.

The only issue I have is how you built the knots array. Because the knot values are the parameterization of the spline, I think you should build the knot array by doing spline->getRemap(), and repeat each value from that vector 3 times. That way you get the auto-reparameterization that comes from the locks and pins of the twist spline (at least for translation)

@mdilena
Copy link
Contributor Author

mdilena commented Jul 17, 2024

The .xpm is for the Node Editor and it's picked up automatically if it shares the same name as the node, while the png is scaled down to look nice in the outliner - I just realized I may have to provide _150 and _200 dpi resolution for that too - and is assigned through the code. Before I did that, the outliner one looked really bad and pixelated! Also, I forgot to include the twistTangent node one, so I will push it soon.

Regarding the knots, I really wanted to hear your opinion on that, as I'm really no expert on NURBS and I remember it took me a while to get it right. What you mentioned makes total sense!
I took a quick look at the spline->getRemap() array and tried to print its values to get an idea of the data in there, but I can't fully understand how I could use it to build the knots array. Would you mind explain what you had in mind? Is it related to the first values in that array? If I build the spline with your python script (so with 4 controls), the first 4 values in that array are [0.0, 3.0, 6.0, 9.0], they seem to be the only one who recall some parametrization to me.

Thank you!

@tbttfox
Copy link
Member

tbttfox commented Jul 17, 2024

Ah, cool. I didn't know that about the xpm's.

And the knot vector should be really easy. Because the twist spline will never be anything but a cubic bezier curve, you can get rid of all that extra logic and just repeat each value from remap 3 times in a row.

std::vector<double> remaps = spline->getRemap();
MDoubleArray knots(remaps.size() * 3, 0);  # we know the length of the array, so we only need to allocate once.
unsigned int c = 0;
for (double p: remaps){
    // set the value 3 times
    knots[c++] = p;
    knots[c++] = p;
    knots[c++] = p;
}

@mdilena
Copy link
Contributor Author

mdilena commented Jul 17, 2024

That worked great, tested it and generated correctly both a NURBS and a Bezier curve!
I also added all the missing icons 🙂

@tbttfox
Copy link
Member

tbttfox commented Jul 23, 2024

I tested and it works great!
Thanks a bunch for your PR

@tbttfox tbttfox merged commit eafd72d into blurstudio:master Jul 23, 2024
14 checks passed
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

Successfully merging this pull request may close these issues.

2 participants