Thanks everyone for the help, I figured it out. I tried the plugin on several dozen different models - no errors were found. I hope it will be useful to someone.
Download glb_import plugin
Best posts made by JohnSmith
-
RE: GLB extract textures
Latest posts made by JohnSmith
-
RE: Attach Export Dialog
@m_adam Thank you very much! This is what I was looking for.
-
RE: Attach Export Dialog
@m_adam Thank you very much for your reply. Unfortunately, this solution does not suit me and I will have to recreate the menu manually. Export is carried out automatically in certain situations and the export settings menu should be in a separate "Settings" window.
-
Attach Export Dialog
Hello everyone. I want to attach in my CommandData plugin interface an export menu like fbx (e.g. using AttachSubDialog). So that it displays up-to-date information with access to export presets. If this is possible then how?
If I change any settings in my plugin window, will those changes be applied to the global export settings? If so, how can this be avoided?
Thanks! -
Drag and Drop between two UserArea
Hello everyone. I have created two UserAreas and I want to drag objects between them. Can you please tell me how to implement this?
def __init__(self): self.area1 = DraggingArea1() self.area2 = DraggingArea2() def CreateLayout(self): self.AddUserArea(1000, c4d.BFH_SCALEFIT | c4d.BFV_SCALEFIT) self.AttachUserArea(self.area1, 1000) self.AddUserArea(2000, c4d.BFH_SCALEFIT | c4d.BFV_SCALEFIT) self.AttachUserArea(self.area2, 2000) return True
-
RE: GLB extract textures
@Macsmiller I apologize for the late reply. Here is the plugin.
glTF Importer pluginI managed to finish it and integrate it into Cinema 4D. You can follow the updates here:
glTF Importer topicMaybe I am asking a question in the wrong topic - where can I find some sample code that can be used to create various import settings and write them to default presets.lib4d?
-
RE: CallCommand with modifier key
For some reason that I do not understand, the modifier keys did not work before, now they work. Implementation of the plugin via UserArea instead of GeDialog will be more convenient, thank you for your answers, I will study this part of the SDK further.
-
CallCommand with modifier key
Hello! I created an interactive toolbar where content (plugins and scripts) appear depending on the conditions set in the plugin settings.
The problem is that many of my scripts have multiple trigger modes with modifier keys, and I call them using thec4d.CallCommand(id)
command.
I can find out which key is pressed like this:bc = c4d.BaseContainer() c4d.gui.GetInputState(c4d.BFM_INPUT_KEYBOARD, c4d.BFM_INPUT_CHANNEL, bc) key = bc[c4d.BFM_INPUT_QUALIFIER]
How to run a
c4d.CallCommand(id)
given the key pressed?I use
c4d.CallCommand(id)
because I first create a list of dictionaries, each of which describes a button and its logic. Here is the dictionary example:section = 'button1' Btype = 'button' number = 1 # for sorting buttons pID = 600000028 types = [5100, 5101] logic_modes = [11, 5, 6, 13] selection = 'True' {'name': section, 'type': Btype, 'number': number, 'plugin_id': pID, 'obj_types': types, 'logic_modes': modes, 'selection': selection}
I write data to an ini file using configparser. After reading the data from the file, I register each button under the plugin id and check if it was clicked:
def Command(self, paramid, msg): for button in self.button_data: if button['type'] == 'button' and paramid == button['plugin_id']: c4d.CallCommand(button['plugin_id']) return True
I hope this description will help you better understand my problem. Thanks!
-
RE: GLB extract textures
Thanks everyone for the help, I figured it out. I tried the plugin on several dozen different models - no errors were found. I hope it will be useful to someone.
Download glb_import plugin -
GLB extract textures
Hello everyone! I created a plugin for importing glb/gltf (using the gltfio library), however I am having trouble extracting textures from glb. At the moment, the task is to save the texture to a folder with the name described below (material-name_channel.jpg / png). Please tell me how to solve this problem?
def GLB_textures(self, glb): # C:\Users\%USERNAME%\Desktop\123.glb folder , glb_name = os.path.split(glb) tex_folder = os.path.join(folder, glb_name + '_tex') try : os.mkdir(tex_folder ) except : print('Error create folder %s' % tex_folder) if glb.data.textures is None: return for texture in glb.data.textures: image = glb.data.images[texture.source] # gltfio.com.gltf2_io.Image instance full_path = os.path.join(tex_folder, image.name+'.jpg') # 'tex_folder' + 00000_basecolor.jpg try : image.Save(full_path, c4d.FILTER_JPG, None, c4d.SAVEBIT_0) except : print 'Error saving image %s' % full_path