Quantcast
Channel: GetCOREInterface
Viewing all 44 articles
Browse latest View live

Preparation for your 3ds Max customer’s cloud storage

$
0
0

There has been much talk about cloud technology over the past few years. Cloud storage is something that has become much more common in recent years. Customers now have easy access to cloud storage and sometimes do not even know they are using it directly and what permissions they are giving to their files. A simple mistake on their part could expose their files and other data to the public.

In the context of a 3ds Max plugin, this may not seem to be very important, but the reality is that any data that you  store into a user’s 3ds Max file, may suddenly become exposed to the entire planet through a simple and thoughtless file copy.

For this reason, I encourage you to consider data encryption of all your customer’s sensitive data. A common place to store data for a plugin would be within the parameter block structure. In this post I will introduce the idea of using a parameter block accessor to specialize the handling of data. This lends itself to very well to data encryption. You can use the parameter block accessor class to do the custom encryption work before storing the data, and then decrypt it before displaying the data back to the user.

First, let’s build a simple plugin that has some parameter block storage present. I used the 3ds Max SDK Wizard to create a Material plugin, and then added a string parameter to the parameter block definition that the Wizard created. Here is the new string parameter definition for the parameter block, and the reference to the custom accessor:

mtl_mat1_stringval, _T("mtl_mat1_stringval"), TYPE_STRING,
        P_RESET_DEFAULT, IDS_MTL1_STRVAL,
     p_ui, TYPE_EDITBOX, IDC_MTL1_STRVAL,
     p_accessor,         &encrypter_accessor,
     p_end,

The added control is an edit box that allows the user to type in some string data. Notice that we asked the parameter block to use our specialized accessor class instead of the default system. This allows us to intercept the string and encrypt/decrypt it as we want within the set/get operations. You mainly need to implement a class derived from PBAccessor. The implementation allows for the string to be encrypted for storage, but be decrypted for display during runtime. For example, in the debugger, we can see a string after it has been encrypted by our set accessor, right before storing it:

 

After we have stored it, and need to access it again in the decrypted form for display, we can then decrypt it in the ‘get’ operation:

 

The example project is here maxProject_2014_04_01.zip


3ds Max 2015 public debug symbols ready now!

$
0
0

3ds Max 2015 is well into it's product cycle. Due to the heartbleed vulnerability (a security bug in the open-source OpenSSL cryptography library) we have already released the first service pack. You can find the SP1 here for Autodesk 3ds Max 2015 Service Pack 1 and Security Fix and here for Autodesk 3ds Max Design 2015 Service Pack 1 and Security Fix.

Basically at the same time the debug symbols became available. Our engineering team has posted both versions - FCS and SP1.

As usual we encourage you to update to the latest service pack, so please consider doing so and be assured the symbols are already there!

 See a previous post here, for details on debugging in 3ds Max: 3ds Max Public Debug Symbols and Plugin testing.

Autodesk Exchange Apps Webinar May 22nd: Learn about exciting new features that bring new opportunities

$
0
0

Without a doubt, Autodesk Exchange Apps is now the best and easiest way for developers to reach Autodesk customers.  With over 1,860,000 visitors and over 620,000 downloads, customers continue to demonstrate how much they have come to rely upon Autodesk Exchange Apps to find the tools that help increase their productivity.

With 18 Autodesk Exchange Apps stores and our recent and upcoming enhancements there is opportunity for any type—and price of app.  Whether you have desktop apps or web services and whether you are selling high price, mid-range or low-priced per unit or monthly subscription—or whether your goal is to generate leads for your development services, Exchange Apps now offers multiple ways of delivering apps to customers.

If you develop apps but haven’t yet put your toe in the water with Exchange Apps, the Autodesk Developer Network (ADN) team is ready to help you.  You’re invited to attend a webinar on May 22nd hosted by Jim Quanci and Stephen Preston.  As they present and demo the latest trends and features you’ll learn how you can leverage this growing platform and publisher and customer community.   You’ll learn the tricks of the trade when publishing on Exchange Apps, get ideas on how to be successful and learn about the ability to expand your geographic reach not just with English language apps, but by publishing localized apps.

Here’s what you need to know:

Webinar details:
Date: Thursday, May 22nd, 2014
Time: 8 a.m. PDT (11 a.m. EDT, 4 p.m. BST; 5 p.m. CET;)
Duration: Approximately one hour
Open to anyone interested in publishing apps on Autodesk Exchange Apps

Registration: Reserve your place by May 20th by sending an email to adn-training-worldwide@autodesk.com with Exchange Apps webinar as the subject. Make sure you include:

  1. Your full name
  2. Email address
  3. Company name

If you are interested in the webinar but time zones or work commitments prevent you from attending we invite you to register anyway so that we can send the link to the recording after the event.

Note:  If you want a head start in learning how to publish apps visit www.autodesk.com/developapps and if you have any questions send an email to appsinfo@autodesk.com

Autodesk is hiring a Media and Entertainment API evangelist!

$
0
0

Do you get excited by APIs? Do you enjoy hacking wicked-cool technology together to solve your daily challenges? While your friends are binge-watching “Grimm” or playing “Minecraft” for hours on end, are you coding cool tools to help make content for those types of titles? If any of the above is true, then we want to talk to YOU! If you are enthusiastic about M&E technologies, enjoy interacting with others and sharing this enthusiasm, and loves to evangelize code –then this is the job for you!

Hey everybody! Please put the word out that we are looking for a 3ds Max SDK expert!

My team is looking for a new Media and Entertainment (M&E) API Evangelist for the Autodesk Developer Network (ADN) team to focus on 3ds Max SDK. We have a breadth of M&E software including 3ds Max, Maya and MotionBuilder. We are also transitioning to the cloud and will be providing APIs through those cloud-based services in the future. We are looking for someone to provide evangelistic API support for 3ds Max SDK, and we also hope to find someone excited by the coming world in the cloud. If you have C++ skills, and see technolgoies like JavaScript, REST and HTML 5 in your future, then please talk to us.

API KNOWLEDGE TRANSFER IS THE REASON FOR BEING

  • You will develop technical content for the ADN program including technical notes and whitepapers. Content is published on ADN blogs and used for conferences and technical marketing events.
  • Write extensive sample code that demonstrates API usage and best practice. Documenting your code is essential for knowledge transfer.
  • Develop and deliver training courses and/or presentations internally and to ADN members. Topics include APIs, and/or other software-development related topics.
  • Assist with technical marketing activities including presentations and event participation. Examples may include Autodesk University, or Game Developer Conference.
  • Use your knowledge of Autodesk product APIs to assist ADN members with their business objectives of providing value-added software. Assist with their software design by providing them with technical information on Autodesk APIs and technologies. Help resolve technical issues including communicating the functions of the API. Assist with API questions.
  • Work with internal product development engineering teams worldwide to help resolve customer and developer issues. Act as a liaison between engineering and ADN members by helping to evaluate and influence new product releases to help meet the needs of the ADN community. Submit defect and product enhancement reports and work closely with engineering to ensure appropriate resolution of issues impacting customer satisfaction.

SUCCESS COMES WITH THE FOLLOWING SKILLS:

  • You’re a gifted programmer who is excited about learning new technology and teaching others. (You already know deep in your heart if you’re a natural programmer – if you don’t, then you’re not).
  • C++ skills are essential for our M&E product environments, including knowledge of object-oriented design.
  • Experience or are interested to learn 3ds Max SDK and programming environments. Knowledge of Maya and/or MotionBuilder SDK will also be valuable.
  • Written and verbal English skills are extremely important. Ability to be patient and communicate across cultures. Other language fluency is also a great asset.
  • Ability to troubleshoot software and programming problems. The understanding of techniques to debug software will be of great value.
  • Enjoy interacting with people – including one-on-one conversations and presenting to audiences at conferences.
  • Enjoy writing – including blogging, tweeting, and other social media outlets.

EVEN MORE SUCCESS IS ADDED BY:

  • Python and/or .NET API (experience or willing to learn)
  • Web and Cloud programming technologies, including JavaScript, REST and HTML 5 (experience or willing to learn)
  • Mobile platform programming technologies, such as Java, .NET and Objective-C (experience or willing to learn)

Location: Montreal, Shanghai, or other locations if you are the right candidate. We have people located throughout the world, and location is not as important as the above skills. If you think you have the "chops" to excel in this position, please contact us. Send your resume, anything else that you view as interesting for us to know, and salary requirements to: kevin.vandecar@autodesk.com, Thanks!

3ds Max (and Maya) API Survey

An online event with an opportunity to receive up to US $100 per app published and win one of eight iPad minis!

$
0
0

We are excited to announce the 2014 Autodesk® Exchange Apps Hackathon. This event will be similar in concept to the Portathon that we held in 2013, but this event will be bigger, better, and has new competitions and great prizes! Anyone can participate from anywhere in the world and at any time, both before the event and during the Hackathon days. We’ve assembled a great line up of speakers to give presentations and demos on hot topics that will help your overall app development, and our technical experts will be on hand to help and guide you.

The Autodesk Exchange Apps Hackathon is a virtual web based Hackathon.  It’s a community event that gives you the opportunity to work closely with other members of the software development community and Autodesk engineers — in real time, developing new apps for Autodesk Exchange. 

The Hackathon will run from 9:00 a.m. U.S. Pacific Time (PT) on Saturday, September 20, 2014 to 4 p.m. PT on September 21, 2014. You can participate from anywhere you have internet access.  

The Hackathon is a free event.  Plus, there is a reward!  For all new apps submitted to the Autodesk Exchange Apps store by midnight on September 30, 2014 and accepted for publication in the store by November 30, 2014, you will receive US$ 100 per “non-Free” app and US $50 “Free or Trial” app for up to 5 apps per company.

More Information and Registration:

Head over to exchangeapphack.com for details on the event, including a FAQ, the schedule and speaker line up, the Rules and the Registration link.

If you have any questions about the Hackathon or the Cloud Apps and Sustainability Apps competitions, please send an email to exchangeapphack@autodesk.com.

Join US! for M&E DevDay events in multiple locations!

$
0
0

Hey, we have the M&E DevDay events coming up soon on several dates. You are invited to register for our annual FREE OF CHARGE Media and Entertainment DevDay events taking place on three dates in January in China and Japan.

DevDay is the best way for you to lean about Autodesk's newest technologies and next generation of products and APIs.  These are developer oriented events, and are your chance to learn how Autodesk is expanding our business in the coming year and beyond, and how you can leverage this growth by using Cloud, Mobile and Desktop APIs and technologies to increase your business.  You will have the opportunity to spend time with Autodesk and industry M&E experts as well as fellow developers.

See here for a detailed agenda:
http://autodeskdevdays.com/devdays-me-2014/

To Register:

Please visit the DevDay link: http://autodeskdevdays.com/devdays-me-2014/
If you have any questions, please send us an email here: devdaysinfo@autodesk.com.

Note, if you are not an ADN member we will ask you to sign an NDA because we will be talking about pre-release and future details.

Remember the M&E DevDay conference is free, so there is no charge for attending the M&E DevDay!

We hope to see you there!
Please come introduce yourself if you are able to make it!

 

Introducing 3ds Max 2016!

$
0
0

Happy Spring to everyone! This week our ADN DevTech M&E team are together in Montreal as a newly formed group. I would like to apologize for the lack of activity here, but the good news is that we are back to being fully staffed, and should be able to start blogging more frequently again!

The even better news, of course, is the announcement of the new 3ds Max 2016 version. For a full overview of the features, please see the posting here: Introducing 3ds Max 2016. Please take a moment to read about all the cool features.

One 3ds Max

The first thing you will notice is that we have moved 3ds Max to a single flavor. We no longer are offering a separate “Design” version. For me this is great news and no longer any need to worry about testing and support of your commercial plugins or scripts for two different versions of 3ds Max. As a result of this product decision, please note there are two APIs that have been marked deprecated:

    EProductID GetProductID(); (utilitf.h)
    APPLICATION_ID GetAppID(); (plugapi.h)

Binary Compatible Release

This release is also considered binary compatible with 3ds Max 2015. What does this mean? Any C++ plugins that are working for 3ds Max 2015, will simply just work in 2016 without needing to be recompiled. The Visual Studio requirements are the same, and the SDK compatibility was maintained. Also the exchange store experience is supported for both versions. For example, if you have already published a 2015 app in the exchange store, it should just work in 2016 with no changes. Yes, the 2016 version will not even care if the package is saying 2015 only. The key thing for you to do with an exchange app is to update any text, to indicate it is also supported in 2016. Of course it never hurts to test your app. :-) Please remember if you want to support both 2015 and 2016, use the 2015 SDK to ensure proper compatibility.

API Changes

There were also some new features and changes made to the SDK. You can use those new features in 2016 only versions of plugins. See the documentation for all the new SDK features online here: 3ds Max 2016 What's New in the SDK.

Public Debug Symbols

We have also uploaded the 3ds Max 2016 debug symbols to the symbol server. You can immediately take advantage of full debugging capability in this new release. As always, these symbols are on http://symbols.autodesk.com/symbols and you do not need to change anything in your Visual Studio debug settings if you already are directing to the symbol server. For full details, see this post: 3ds Max Public Debug Symbols and Plugin testing.

#BiggestMaxEver !!!

 


3ds Max SDK Specialist needed!

$
0
0

Hey, we are looking for a 3ds Max SDK specialist to join our ADN team. This position will be located in Montreal and is entry-level. We are willing to train in the SDK if you bring excellent C++ skills and strong enthusiasm for 3ds Max programming. Because we are a global team, English communication skills are also very important.

See our job posting here:http://jobs.autodesk.com/jobs/consulting/canada-quebec-montr-al/developer-technical-consultant/15WD18354?lang=en

Feel free to send me an email if interested!

 

Boston TechJam 2015 - Showing Oculus Rift with View and Data API

$
0
0

Hey! I will be down at the local Boston TechJam 2015 later today. We were asked to demo Oculus Rift and will show a sample running the Autodesk View and Data API.Stop by and introduce yourself if you are in town. :-)

I will be sharing some links and am posting them here:

Autodesk public Virtual Reality research includes these sites, that are using the View and Data API Large Model Viewer:

  • 3ds Max and Maya both have stereo cameras, so may be possible to bring into Oculus. Not time to research the best approach here yet.

Welcome Denis Grigor, Responsive Web Design, and Autodesk University!

$
0
0

Hello everyone! Just wanted to say a few quick words to restart our blogging activities. First, we are finally re-staffed on the 3ds Max side of ADN DevTech. Denis Grigor joined us in July and is progressing very quickly at becoming a 3ds Max SDK guru. I also revamped the blog site to be of responsive design, so you can now read while you are on a mobile device taking a coffee break or commuting. :-)

Also wanted to mention that the US version of Autodesk University is coming up quickly in Las Vegas. Denis and I will both be at AU and we have two 3ds Max related classes. See "SD10586 Take 3ds Max to the Next Level with Customization (and Gain Kudos)" and "AV10591 Top 10 Autodesk 3ds Max Apps in the Autodesk App Store". We will also be around during the ADN DevDay activities on Monday and Tuesday. See here for details about the Las Vegas DevDay: http://autodeskdevdays.com/las-vegas/. The agenda for DevDays is packed, and includes a DevHack on Tuesday afternoon. If you are not an ADN Member, but are interested to attend anyway, please contact us at: devdaysinfo@autodesk.com. The DevHack is a ad-hoc session where we can help you with programming issues in 3ds Max (and other Autodesk products), or just a place to meet and chat. Hope to see you there.

Support for JavaScript in 3ds Max

$
0
0

3ds Max is renowned for its customization abilities.To facilitate this even more, support for many languages was added along the way.
At the beginning it was just MAXScript, followed by the powerful C++ SDK, but to open the power of 3ds Max to a wider modern developing audience, support for .NET and Python has been included.

Now 3ds Max is ready to take the next step and provide it's API to be used through one of the most popular languages (according to data provided by GitHut and RedMonk); the all mighty Web Language King - ECMAScript, or better known under its pseudonym: JavaScript.

3ds Max took the same path as Node.js did and integrated the powerful Google V8 JavaScript engine, with all its inherited strengths and weaknesses.

From an API perspective, we tried to keep the same approach as with Python and .NET API, thus allowing a smooth transition between these 3 languages.

In this small code sample here, you may see the clearness and elegance of this language when used with 3ds Max SDK:

let my_object = new MaxPlus.CreateGeomObject(MaxPlus.ClassIds.Cylinder);
my_object.setValue(Radius, 10.0);
my_object.setValue(Height, 30.0);

let my_node = new MaxPlus.CreateNode(my_object);

let my_mod = new MaxPlus.CreateObjectModifier(MaxPlus.ClassIds.Bend);
my_mod.setValue(BendAngle, 45.0);
my_node.AddModifier(mod);

MaxPlus.MaxScript.log("Created cylinder with bend modifier.");

From the syntax you can see that we went directly with supporting the Sixth Edition, known as ECMAScript 2015, which soon will be widely adopted.

Moreover, the ability of creating modules and importing them is also here, and it is following the CommonJS approach, thus allowing use of third party libraries along with our own:

const MaxPlus = require("3dsmax_core");

The new language wouldn't be enough without a proper set of tools, and we are well aware that there are plenty of JavaScript IDEs over there, but we want to make JavaScript a first class citizen within 3ds Max, perhaps with a later complete replacement of the MaxScript, this is why we are starting to give a special attention to an integrated solution for JavaScript in 3ds Max (Click on image to see the video illustration):

Main_window

Conclusion:

It is important to accept the power of a language in a certain context, this is why we consider that 3d is the excellent place for using JavaScript and 3ds Max is just the beginning. This is "going viral" now and some similar work is also being made for Maya (for more details, look at our Maya dedicated Blog).
|
|
|
|
|
|
|
|
|

                      _ _   ______          _ _     
     /\              (_) | |  ____|        | ( )    
    /  \   _ __  _ __ _| | | |__ ___   ___ | |/ ___ 
   / /\ \ | '_ \| '__| | | |  __/ _ \ / _ \| | / __|
  / ____ \| |_) | |  | | | | | | (_) | (_) | | \__ \
 /_/    \_\ .__/|_|  |_|_| |_|  \___/ \___/|_| |___/
          | |                                       
          |_|                                                                                                                                                        

For real technology using JavaScript, check out the Forge platform: forge.autodesk.com

3ds Max and the Forge APIs - Discount for Forge DevCon

$
0
0

3ds Max and the Forge APIs, what does that mean? To start, have you heard about the new Autodesk Forge platform? Forge is a place that gathers many new cloud service APIs into one place for consumption by developers. Forge includes the platform technology, a program for supporting partners (think ADN open on a broader scale), including a developer conference coming in June, and a fund where startups can apply for an investment by the Forge fund.

ForgeDevCon

What does this have to do with 3ds Max programming concepts? Well, there are a number of reasons to start this conversation. The Forge services support 3ds Max in various ways. The View and Data API for example, can view 3D models in HTML 5 enabled browsers and apps – a nice way to share your models online, using your own custom websites or tools. The ReCap service provides 123D Catch style photogammetry reality capture into your custom workflow. Or maybe you want to exploit the A360 rendering service outside of 3ds Max with your own tools? A360 Rendering API coming soon!

Anyway, to give you a quick example, I pulled a free model from the great website: http://tf3dm.com/. This site has many great models for sharing. After exporting the model from 3ds Max, I converted it to the View and Data API format for viewing on the web. I used a great sample created by a colleague, Philippe Leefsma using node.js and angular.js. The sample is a working online website, and also has full source code available. The sample shows how to process the model through the View and Data API translation service and then makes it viewable on the web in a full 3D interactive way. A screenshot is included below to give you a taste, but I encourage you to try it out directly here: x-wing. Also check out some of the other models in the gallery. There is also a nice interactive demo here as well: http://lmv.rocks/.

X-wing

BTW, I could have directly embedded the viewer here, but I wanted to direct you over to the Philippe's sample for a chance to play with other models, or to try your own (that can be uploaded there as well).

How to get the 3ds Max model into the viewer format? Well, the translation service does not yet support the 3ds Max native format (*.max), but there is some work being done to bring this capability into the translation service soon. For now you can export to one of the other formats. The FBX format is supported, but is not ideal for including materials at the moment. The 3DS format works well, and allows you to structure the model geometry so that the viewer can browse the components independently. The DWF format is best for supporting materials out of 3ds Max. I used DWF in this example to get the texture materials to come across. Expect to see improvements to this process once native *.max format is directly supported by the translation service.

If you are interested to learn more about the Forge platform, we can offer you a discount code to the Forge DevCon coming in June. Autodesk is offering GetCOREInterface readers a 30% discount to the Forge Developer Conference. Simply use the code ADN_ME30 when registering. Note that students can register for free with your education email address. Because conferences are always better with friends, you can also contact us for details on a special “Refer a Friend" offer for even greater savings!

If you do plan to attend, and would like to meet, just let me know… I’ll be there as well! Hope to see you there.

3ds Max 2017 Features and SDK Changes

$
0
0

Another year passed, and another great release of 3ds Max! 3ds Max 2017 is coming with a number of great new features. See here for a complete list: What's New in Autodesk 3ds Max 2017. Also Eddie’s blog has a great overview with videos: Introducing 3ds Max 2017 and you might want to checkout Christopher’s Max Creation Graph post.

First, 3ds Max 2017 is not binary compatible with previous versions. This means you must recompile your plugins using the Visual Studio 2015 RTM (or later) VC++14 compiler. See here for all the 2017 SDK changes: What's New: 3ds Max 2017 SDK.

New User Interface

Note that the user interface is it is now HDPI aware. This allows for running on the many available High-definition devices (and for me with the MacBook Pro running Windows, I can finally see the UI controls again! J). In order to handle this, 3ds Max is now using the Qt library. The good news from the SDK perspective is there is no change required for your plugins. Only the painting of the controls is using Qt, so existing controls should still be fine. The only suggestion is to test your plugin UI and ensure there are no string issues, etc. See the SDK docs here for further information Using Qt with 3ds Max Plug-ins

Qt distributions are like this:

Rendering

Another change is that the mental ray renderer is now provided as a separate component. To install it, ensure the mental ray option is checked in your installation setup. The mental ray related SDK files were also removed from the SDK distribution. You can also download the mental ray SDK from the 3ds Max Developer Center later this week. (Again, let me know if you need it sooner and I can give it directly). UPDATE: Developer center now contains the new files. Find the two new files under the "Tools" section towards bottom of 3ds Max Developer Center.

A new renderer included with 3ds Max 2017 is the Autodesk Ray Tracer (ART) renderer (aka RapidRT). This renderer is more design focused and supports photorealistic rendering. The integration of this renderer also brings a new, easier to use renderer implementation layer into the SDK. We have not yet gotten the full details into the online 2017 SDK docs, but it will be coming soon. Let me know if you need information now, and I can send you something. Note that the SDK changes are ALREADY in the SDK and you can find the bulk of those changes here: .\maxsdk\include\RenderingAPI. Also the .\maxsdk\include\Rendering folder is significantly changed.

Plugin Wizard and Porting

The plugin Wizard has also been improved to ensure it works properly with VS2015. There were a few template errors, too, and those have been fixed. The wizard is an ideal way to start a new project, that picks up the VS property sheets (including compiler and linker settings that match 3ds Max’s own settings). This makes sure you are building against the settings for the runtime environment that matches the 3dsmax.exe. One easy option for porting, is to create a new project with the wizard, and then move your source and resource files into the new project.

.NET API

For the .NET API, there was a number of fixes to make it more stable and eliminate some of the IntPtr parameter problems. Also the .\maxsdk\assemblies folder was removed from the SDK. This folder was meant to allow building of .NET plugins without needing the full installation. But it proved to be difficult to maintain and so we decided just to remove it. If there is a chance you were using it, you can simply copy the assemblies for the 3dsmax.exe folder to a location where you need them. The supported assemblies are listed here: 3ds Max .NET Assemblies

Python

On the Python side, there was also some significant improvement. The version is now 2.7.6. See here for specifics: What's New in the 3ds Max 2017 Python API  

Note that the focus was on better MAXScript integration, so you will see the MAXScript editor now supports authoring of Python scripts and the MAXScript listener now supports a Python command line. Interop between Python and MAXScript improved so you can now import python libraries into MAXScript routines, and also reference MAXScript APIs directly in a Python script. Also the Python Qt support is improved with better PySide support, and window parenting and docking functionality.

MAXScript

Of course MAXScript also receives some changes. Those are all identified here: What is New in MAXScript in 3ds Max 2017.

Max Creation Graph

Even though there is no code involved, it's important to mention that the Max Creation Graph feature also continues to see new features. See Christopher’s Max Creation Graph post. A new github repo for all the samples will be coming soon. You can find it here: https://github.com/ADN-DevTech/3dsMax-MCG-Samples

Documentation

And remember, that you can always find the M&E SDK documentation by going to this alias: http://www.autodesk.com/me-sdk-docs

How to create a Gizmo in 3ds Max

$
0
0

According to Wikipedia, a Gizmo is " ... a bounding box used for manipulating objects in 3D modeling computer programs".
Well ... not necessary a box ... and not always used for manipulating objects - couldn't a Gizmo be used just as an onscreen informative tool?

In the following post I invite you to explore with me the visual customization of modifiers and how gizmos or as 3ds Max call them modifier apparatus are drawn on the screen. All this will be examined by creating a simple modifier plugin that will serve as an on-screen informative tool for the object it modifies.

Of course, to implement a modifier we have to rely on the Modifier class, and its always worth starting class analysis by having a look at inheritance diagram of the class we have under the scope:

04.inheritance
According to class description for the BaseObject Class

"Anything with a representation in the 3D viewports is derived from BaseObject (including modifiers and controllers whose gizmos appear in the viewports)".

 


Ok, so this is where it all starts and why we have the following requirement:

A modifier plug-in must implement a method to display the modifier's gizmo in the 3D viewport. This is done by implementing a member function of the BaseObject class called BaseObject::Display(). The GraphicsWindow class provides a number of drawing routines for this purpose.

Having defined our starting point, let us continue by gathering the implementation pieces that we will need for our project.

Implementation

As already stated above, to have something displayed, we have to inherit from the BaseObject class, but for our particular need we are going to take the Modifier branch.

05.inheritance2

 

Within the BaseObject class, we have a special interest in the BaseObject::Display() method:

virtual int Display(TimeValue t, INode* inode, ViewExp* vpt, int flags);

This method is called by 3ds Max when it is time to draw the object. It will "point" you to the viewport information given by ViewExp class and provides other information. The ViewExp class contains the information on GraphicWindow associated with the given viewport:

virtual ViewExp::GraphicsWindow* getGW();

Now comes the real fun:
The GraphicsWindow class “provides low-level access to 3ds Max's graphics system“, that we will be using to explicitly draw lines, texts, markers, etc. to the viewport - everything we need for drawing our Gizmo. To make the drawing task easier, we will use the DrawLineProc Class, that"... provides a simplified way to draw a connected series of lines to the GraphicsWindow":

int DrawLineProc::proc(Point3 *p, int n);

However, for the text draw, we still are going to use the "raw" approach with:

void GraphicsWindow::text(Point3* xyz,const MCHAR* s);

We have all the details we need to create an interesting gozmo, so let's pass from theory to practice by building something.

Hands-on

We will start by setting up a project and creating a Modifier type plugin. For simplicity, (to avoid having implementing a lot of methods uninteresting to our current task), it will be based on SimpleMod2, but the same approach is also applicable to modifiers directly based on the Modifier Class. We can use the Plugin Wizard to start the project as seen below. In this example, we will call the plugin “Informix”.

01.project

Before firing up the plugin, don't forget to make the necessary adjustments and switch to the Hybrid configuration:

  02.setting

To start with the basic implementation, if we run our “Informix” plugin on the iconic Teapot, we will get a displayed bounding box. For example:

03.first_run

This bounding box is given by the default implementation of the Display within the SimpleMod class, but we should not have problems in overriding it:

int Display(TimeValue t, INode* inode, ViewExp* vpt, int flagst, ModContext* mc) override;

Here is a basic implementation that will start our task of providing a more interesting gizmo:

int Informix::Display(TimeValue t, INode* inode, ViewExp* vpt, int flagst, ModContext* mc)
{
GraphicsWindow *gw = vpt->getGW();
DrawLineProc lp(gw);
lp.SetLineColor(1, 0, 0);
Point3 my_gismo_points[5] = { Point3(0, 0, 0), Point3(-80, 0, 0),
Point3(-60, 10, 0), Point3(-80, 0, 0),
Point3(-60, -10, 0) };
lp.proc(my_gismo_points, 5);
gw->setColor(TEXT_COLOR, 1, 1, 1);
gw->text(&my_gismo_points[1], L"Here's the tip of my GIZMO!!!");

return 0;
}

Now, if you run the plugin again, you should see something like this:

06.first_gizmo

Quite simple, right? A bunch of points and some calls to draw lines.
Well ... easy things get complicated very fast when you draw something custom and parametric.
Now we can start by creating a method responsible for drawing a double arrowhead segment with a label in the center of the segment:

void Informix::drawMyArrows(Point3 p1, Point3 p2, const wchar_t* my_text, ViewExp* vpt)
{
float arrow_scale_factor = 0.05;
float arrow_wing_factor = 10.0f; // max(max(p1.z + p2.z, p1.x + p2.x)*arrow_scale_factor, 1);
pblock2->GetValue(pb_wing_spin, GetCOREInterface()->GetTime(), arrow_wing_factor, FOREVER);
Point3 wing_side_point(0,0,0);
Point3 wing_other_side_point(0,0,0);
Point3 ref_point((p1.x + p2.x), (p1.y + p2.y), (p1.z + p2.z));
Point3 midpoint = ref_point / 2;

//prepare point for left arrow
Point3 left_reference_point = p1*(1-arrow_scale_factor)+p2*arrow_scale_factor;
makeWingsidePoints(left_reference_point, wing_side_point, wing_other_side_point, arrow_wing_factor, p1);
Point3 my_gizmo_point_left[5] = { p2, p1, wing_side_point, p1, wing_other_side_point };

//prepare point for right arrow
Point3 right_reference_point = p1*arrow_scale_factor + p2*(1 - arrow_scale_factor);
makeWingsidePoints(right_reference_point, wing_side_point, wing_other_side_point, arrow_wing_factor, p1);
Point3 my_gizmo_point_right[5] = { p1, p2, wing_side_point, p2, wing_other_side_point };

//draw points and labels
GraphicsWindow *gw = vpt->getGW();
DrawLineProc lp(gw);
lp.SetLineColor(0, 0, 0);
lp.proc(my_gizmo_point_left, 5);
lp.proc(my_gizmo_point_right, 5);
gw->setColor(TEXT_COLOR, 0, 0, 0);
gw->text(&midpoint, my_text);

}

Now we can organize some repetitive code into a helper method:

void Informix::makeWingsidePoints(  Point3 reference_point, 
Point3 &wing_side_point,
Point3 &wing_other_side_point,
float arrow_wing_factor,
const Point3 source)
{
wing_side_point = reference_point;
wing_other_side_point = wing_side_point;

if(reference_point.x != source.x)
{
wing_side_point.z -= arrow_wing_factor;
wing_other_side_point.z += arrow_wing_factor;
}
else
{
wing_side_point.x -= arrow_wing_factor;
wing_other_side_point.x += arrow_wing_factor;
}
wing_side_point.y -= arrow_wing_factor;
wing_other_side_point.y += arrow_wing_factor;
}

Now our updated Modifier::Display() method is easier to read:

int Informix::Display(TimeValue t, INode* inode, ViewExp* vpt, int flagst, ModContext* mc)
{
TimeValue current_time = GetCOREInterface()->GetTime();
Box3 bounding_box;
inode->EvalWorldState(current_time).obj->GetLocalBoundBox(current_time, inode,vpt,bounding_box);
Point3 min = bounding_box.Min();
Point3 max = bounding_box.Max();
Point3 x_max(max.x, min.y, min.z);
Point3 y_max(min.x, max.y, min.z);
Point3 z_max(min.x, min.y, max.z);

std::wstring label_x = std::to_wstring(max.x - min.x) + L" units";
std::wstring label_y = std::to_wstring(max.y - min.y) + L" units";
std::wstring label_z = std::to_wstring(max.z - min.z) + L" units";

drawMyArrows(min, x_max, label_x.c_str(), vpt);
drawMyArrows(min, y_max, label_y.c_str(), vpt);
drawMyArrows(min, z_max, label_z.c_str(), vpt);

return 0;
}

Basically this is it.
Having this coded in a simple combination, we end up having the following result when applying our modifier to an object:


07.final_gizmo2

Conclusion

Although this example is not terribly useful, I hope the sample code shows you enough to implement your own cool gizmos!

00.final_candidate_02

and coming back to Wikipedia definition ...

Is it a box?

I think not.

Is it used to manipulate objects?

Not really.

Is it useful?

Wait a minute ... the definition doesn't say that it should be useful.

Then, is it a Gizmo?

I have no idea, but somewhere along the way of its creation, it was.
If you are interested in the source code, it is available here, which is great for a beginner, but for those who found it boring, you can look at the Symmetry plugin (Symmetry.cpp), available in the SDK samples within the .\maxsdk\samples\modifiers\BasicOps\ folder.


Autodesk University 2016, Developer Days 2016, and @AutodeskForge APIs

$
0
0

Well, again I find myself apologizing for not posting sooner. In this one, I would like to let you know about the upcoming events we have scheduled pertaining to 3ds Max programming. The first one is at Autodesk University. I will be presenting a new class comparing the differences between Python and the .NET APIs in 3ds Max. Both are relatively new programming features, and both have genuinely different approaches to development. Not just the languages are different! :-) After the classes are presented in person, I will post a few of the details here. Check back in December. Thanks to Denis Grigor for helping on the Python content.

This class will be presented in Shanghai, China on Nov. 3 (45 minute version with the help of my colleague, Cheng Xi Li), and then again in Las Vegas on Nov. 16 (90 minute version). For information on Autodesk University, see here: au.autodesk.com. If you are attending either event, please come introduce yourself and tell me you read this on the blog!

We will also be holding our annual developer days at several locations around the world in November and December. Although we will not have anything directly pertaining to 3ds Max programming, there will be plenty of topics about related products. The Forge APIs will be a large focus this year. For information about all the different events and the agenda, see here: http://autodeskdevdays.com/. I will be around during the DevLab portion in Las Vegas, so if you have any 3ds Max programming issues, feel free to drop in and see me. Or even if no questions, come by and introduce yourself. :-)

Also, if you have not already, check out the http://developer.autodesk.com portal where the Forge APIs are available. All you need is an Autodesk ID to login and to create your app.

Querying the 3ds Max version

$
0
0

Anyone taking plug-in development seriously has to think about plugin versioning. The 3ds Max C++ SDK documentation offers a lot of information on this topic, along with a couple of implementation techniques and some P_VERSION related best practices.

For 3ds Max version querying, the 3ds Max C++ SDK offers (within plugapi.h) some useful macros like:

GET_MAX_RELEASE(VERSION_3DSMAX)
GET_MAX_API_NUM(VERSION_3DSMAX)
GET_MAX_SDK_REV(VERSION_3DSMAX)
GET_MAX_SDK_NUMREV(VERSION_3DSMAX)

that can be used to tailor your plugin to different 3ds Max environments and other uses.

However all these tools are updated/adjusted with each major 3ds Max release when the 3ds Max SDK is updated, and not with the service packs, extensions, or updates.


This might look irrelevant for a plugin developer, as the C++ SDK is usually binary compatible for a complete full version and sometimes even across main versions (as was the case of 3ds Max 2015 and 2016). Nevertheless, sometimes there is a need to have more details, be it for logging/diagnostic purposes, or to deal with situations when some of your plugin users are not using the latest SP (and are spread between different SP). For these and other cases it would be nice to have a way of getting some info on client's 3ds Max specific version number or build version number and then if necessary, adjust the behavior of your plugin accordingly.

By inspecting the executable of 3ds Max (3dsmax.exe) we can see that the needed information is included in the file version:

where on the above screenshot:19 is the release number corresponding to 3ds Max 2017, 2 is SP number and 420 is the build number.

To extract this information we could rely on GetFileVersionInfo API (from C++ Windows API) and you can even find some sample code on how to use it (thanks to Kevin Vandecar for pointing this out). 

But in MAXScript, there is a simler way. It turns out that among many MAXScript external file methods there is  getFileVersion <filename_string> function:

GetFileVersion (getDir #maxRoot + "\\3dsmax.exe")
--> "19,2,420,0        19,2,420,0"

that gives us the very information needed.

The fact that it is just a MAXScript function, should not hold us back, as we can easily call MAXScript from C++:

BOOL ExecuteMAXScriptScript(MCHAR *s, BOOL quietErrors = FALSE, FPValue *fpv = NULL);

and use the extracted information, that in this case will be contained in a FPValue:

#include <maxscript/maxscript.h>

int getSPVersion()
{
    FPValue resulted_value;
    ExecuteMAXScriptScript(L"getFileVersion \"$max/3dsmax.exe\"",
                            false,
                            &resulted_value);

    // WARNING: for illustration only: assumes SP version is 1 digit, 3rd index
    return static_cast<int>(resulted_value.s[3] - '0');
}

The MAXScript getFileVersion function is in fact using the Windows GetFileVersionInfo API, and this is a very good illustration of how MAXScript is easily inter-operable with the 3ds Max C++ SDK. Either technique frmo the C++ SDK should yeild the same results.

 Note that due to the recent transition to a subscription-based model, it seems there will be no future Service Packs or Extensions. Instead they will be called Updates. But, using the above described approach, you will still get the desired details. In this most recent example of the 3ds Max 2017 Update, instead of getting a SP version, it will give you the Update version, that can be used for the same purpose.

 

How to properly check if a material is used in a scene?

$
0
0

Sometimes you may need to know if a given material is used within the scene or not. In Compact Material Editor it is usually marked with the UI giving you certain clues. For example, in the screen capture below, the gray corners indicate the material is used in the scene. Corners that are filled in white, indicate the material is used, and also is being used by a selected scene object. The white rectangle indicates it is the currently selected material.

Image

The same indicators are found in the Slate Material editor. They will display on the preview of the material.

 

Image (2)

 

The obvious question now is how to retrieve this information using the C++ SDK? Let's take a look at how to do it.

The very first step is to have a look at the MtlBase class where you will notice the int TestMtlFlag(int mask) that "Tests the specified flags. Returns nonzero if the flags are set; otherwise zero” . Among the available Materials flags we can notice the MTL_IN_SCENE flag, that seems to be exactly what we need.

Thus, to test if a material is used or not we can easily do:

if(my_material->TestMtlFlag(MTL_IN_SCENE))
{
    \\ It is used
} else
{
    \\it is not
}

Hurrah! Job is done, let's go home.

Not so fast.

The MTL_IN_SCENE flag is useful only if somebody sets this flag (calling MtlBase::SetMtlFlag), but it turns out that nobody sets this specific flag, like ever. Thus, it will always return 0, no matter what, and even if you have assigned this material to dozens of objects in the scene, it is never accurate, unless someone sets it (maybe you set it in your plugin, but is seems none of the default materials are doing this.)

Other (Materials) flags seems to be working fine, thus being useful, but not this one. So, let's get back to work.

This question is not new, and there are lot of (mostly MAXScript) recipes on how to check whenever a given material is used somewhere in the scene, and the common algorithm is to get the scene materials and check if the material in question is found among them.

That should be piece of cake, as the Interface Class offers us the GetSceneMtls method, and the returned MtlBaseLib has the handy FindMaterial method for finding a material by name:

bool materialIsUsed(MtlBase* this_material)
{
   MtlBaseLib* scene_materials = GetCOREInterface()->GetSceneMtls();

   return (scene_materials->FindMtl(this_material) != -1) ? true : false;
}

Easy say, easy do - can we go home now?
Not yet ... not yet ...

It turns out that this approach is not very reliable (noticed by many developers), and the reason is that there is no dynamic tracking of the materials in the scene, thus the material library returned by the Interface::GetSceneMtls might not contain the latest information.

There is a way to manually reset and rebuilding the scene lib, but unfortunately it is available only in MAXScript as ‘UpdateSceneMaterialLib()’method, and there is not yet a C++ SDK equivalent.

"So, what it is the big deal? We can execute MAXScript from C++, we can live with that."

Well ... there is yet another problem.

If the material in question is a part of a sub-material, then you can check in the scene materials lib whenever you want, it will not show up, because (in a manner of speaking) it contains only the “first level” materials and will not contain the materials that are part/contained in other materials (g.e. multi-material).

“Then, what could be the solution?”

The solution is given us by the Reference System, because if we look at MtlBase inheritance diagram:

Image (1)

we notice the obvious aspect, that any material (like many other classes in 3ds Max SDK) is also a Reference Target.

This is obvious, because logically, a material has to have dependents, that are notified upon change (i.e. change the diffuse color).

Thus, what is left is to iterate through these dependents, using the dedicated DependentIterator Class and recursively check the dependents.

Easy say, but not so obviously done:

static bool  isNodeInScene(INode* node)
{
       for (INode* par = node->GetParentNode();
              par != nullptr;
              node = par, par = node->GetParentNode()) {
       }
       return node == GetCOREInterface()->GetRootNode();
}

 static bool isUsedInScene(ReferenceTarget *mt)
{
       DependentIterator di(mt);
       RefMakerHandle rm;

       if (mt->SuperClassID() == BASENODE_CLASS_ID) {
              return isNodeInScene(static_castINode*>(mt));
       }

       while ((rm = di.Next()) != NULL) {
              if (rm != mt && rm->IsRefTarget()
                     && isUsedInScene(static_castReferenceTarget*>(rm)))
                     return true;
       }
       return false;
}

Thus, to check if a given material is used in the scene or not, it suffice to call:

if(isUsedInScene(my_material))
{
    \\ It is used
}else
{
    \\it is not
}

and the cool thing with this approach is that (I guess you already noticed) it can be used with anything that is “referable” (i.e. is a ReferenceTarget), and that could be more interesting than just for materials.

3ds Max 2018 SDK Changes

$
0
0

Another year has passed, and we have a new release of 3ds Max! 3ds Max 2018 was released today, and should be available soon in your Autodesk Account access. The online help is also already rolled out.For new features, see What's New in 3ds Max 2018.

For the 3ds Max SDK changes, see  What's New: 3ds Max 2018 SDK. As in the past, the SDK is included in the install folder structure. Typically, it is here: .\x64\Tools\MAXSDK\SDK_3dsMax2018.msi

Some SDK highlights:

The first thing to note from the C++ programming perspective, is that the compiler has been bumped to Visual Studio 2015 update 3. You are probably already there with Visual Studio 2015, but be sure to check and update to ensure compatibility. Even though 3ds Max 2017 was using Visual Studio 2015 (RTM), you will have to rebuild any plugins. The 3ds Max 2018 release is not binary compatible with 2017.

Qt is also majorly bumped in 3ds Max 2018 and is now using Qt 5.6.2.

You will also notice that all the samples in the SDK have been updated to use the Parameter Block 2 standard. There's a new Parameter Block Porting Guide in the docs. Part of this is to encourage everyone with Parameter Block 1 definitions, to move to Parameter Block 2. In the future the old Parameter block 1 will be deprecated.

Two new features that came recently are the Data Channel Modifier, and the Bezier Trajectories. Both have some new SDK access in the 3ds Max 2018 SDK. Additionally, there were some minor UI API changes, and also around the Rendering APIs. See the help for details.

Other programming environments:

For 3ds Max 2018 MAXScript changes, check-out What's New in MAXScript in 3ds Max 2018.

For 3ds Max 2018 Python changes, check-out What's New in the 3ds Max 2018 Python API.

There were also a few minor changes to the 3ds Max 2018 .NET API assemblies. Mainly cleaning up signatures, and other miscellaneous fixes.

 

Happy coding with 3ds Max 2018!

 

Updated .NET API Samples for 3ds Max 2018

$
0
0

Well, it's been a while since last posting, but trying to do more. Recently someone asked about the .NET API for recent versions of 3ds Max. There has really been no big changes for a few releases except moving from ParamBlock1 to ParamBlock2 for some of the older geometry objects and modifiers. .NET API, plus WPF, etc. still work OK, even though the main 3ds Max UI is moving to Qt. To demonstrate, I updated the samples I provided back in 2014 release to work with 2018. These are the things I changed to get everything working well again:

  • Update the csproj variables to use the 3ds Max values (Currently: $(ADSK_3DSMAX_x64_2018)). Note the original project used: $(ADSK_MAXDES_x64_2014), but 3ds Max Design as not been available for several releases now, and is combined with 3ds Max as a workspace. That makes it easier to handle 3ds Max plugin projects! The variable changes are for the assembly references, and also for the Post-Build event command line, that provides the copy operation.
  • The .NET Target framework should move to at least 4.6 to match the version 3ds Max itself is using.
  • In the code, there was one place where we fixed a defect in Autodesk.Max.dll. Line #119 of HelixControl.xaml.cs was using the (IntPtr) cast for the IINodeTab value. We fixed that API to properly use an integer index, so the cast is no longer required.
  • Updated a screen bitmap for the CreateTeapotUserControl
  • Fixed the teapot creation in CreateTeapotUserControl... turns out it was updated with the move to ParamBlock2. Added a comment to show this.
  • Added a tiny error check for the "05 - Create Face Objects" routine to ensure the user picks something before continuing.

Overall, pretty minor changes...I have attached the updated sample here: AdnCuiSamples_BlogV2018.

Enjoy!

 

Viewing all 44 articles
Browse latest View live




Latest Images