Thank you very much, I didn't notice the paid version that also offers this option. Since the file manager works very well and does everything I want, I will gladly buy a license!
Yes, I'm testing the 2.1.0+9-dev version
Has this patch already been deployed or does it need to be applied manually? I wanted to test Mercury Editor but I'm on Drupal 10.3.0 and I'm getting the AJAX error shown above.
composer require drupal/rat solves the issue but is it possible to add this dependency via ludwig?
I have the same problem but it seems like a Masonry API module problem (at least from what I see in the source of the Masonry Views module). Have you also installed Masonry API version 4.0.0? Or do you user Masonry API 3.0.0?
smurfxx → created an issue.
Just to understand if I'm doing the right things, is it correct to run a loop generating nodes from a module's controller and calling functions directly from the module? Or are there better ways to run custom code that doesn't require user interaction?
It works, thank you!
After disabling one by one every external module I found that the issue was generated by Mix Module → (1.8.0-rc2), so this issue can be considered closed!
No, it's not the admin theme, I already tried to change the admin theme to default (Claro), flushed caches but nothing changed.
I already did it but it doesn't change.
I used the same script to import a different node type that down't have attached images and it works very well without duplicates.
I only have that message on my server console, I didn't install via composer because the site is on a shared server that doesn't support it, so I installed everything manually, copying latest Google API PHP library (2.15.0) via FTP on site_root/libraries/google_api_client
smurfxx → created an issue.
Sorry, I made it by overriding the default font via custom css on my subtheme, I had a wrong syntax that corrupted the css -_-
If I manually apply the adsense.1.x-dev.rector.patch and edit the info.yml, does the module works with drupal 10?
Solved by loggin out and loggin in again after deleting the cookies.
This issue is not related with colorbox, sorry!
I reopen this issue because I have the same problem: everything is installed, no errors on drupal status report or debugger console but no animation is triggered.
I'm using this free theme:
https://www.drupal.org/project/scholarly_lite →
JQuery: 2.2 (via JQuery Update)
Do you have any hint?
I changed some lines of threejs.init.js :)
(function ($,Drupal, settings, once) {
Drupal.behaviors.ThreeJSinit = {
attach: function (context) {
$(once("initiate-threejs", ".canvas-container .threejs", context)).each(function () {
const file = $(this).data('model');
const extension = file.split('.').pop().toUpperCase();
const loaderName = extension + 'Loader';
let loader = new THREE[loaderName]();
let canvas = $(this).get(0);
let renderer = new THREE.WebGLRenderer({canvas: canvas, antialias: true});
renderer.setPixelRatio(window.devicePixelRatio);
renderer.setSize(canvas.clientWidth, canvas.clientHeight);
renderer.gammaFactor = 2.2;
renderer.outputEncoding = THREE.sRGBEncoding;
renderer.physicallyCorrectLights = true;
const width = $(this).width();
const height = $(this).height();
let scene = new THREE.Scene();
scene.background = new THREE.Color(settings.threejs.backgroundColor);
// let camera = new THREE.PerspectiveCamera(1, width / height, 0.1, 50);
let camera = new THREE.PerspectiveCamera(35, width / height, 1, 500); // New setting
// camera.position.set(settings.threejs.cameraX, settings.threejs.cameraY, settings.threejs.cameraZ);
camera.position.set( 0, -9, 6);
camera.up.set( 0, 0, 1 ); // New setting
scene.add( camera );
let ambient = new THREE.AmbientLight(0xffffff, 0.3);
scene.add(ambient);
let keyLight = new THREE.DirectionalLight(new THREE.Color('hsl(30, 100%, 75%)'), 1.0);
keyLight.position.set(-100, 0, 100);
let fillLight = new THREE.DirectionalLight(new THREE.Color('hsl(240, 100%, 75%)'), 0.75);
fillLight.position.set(100, 0, 100);
let backLight = new THREE.DirectionalLight(0xffffff, 1.0);
backLight.position.set(100, 0, -100).normalize();
scene.add(keyLight);
scene.add(fillLight);
scene.add(backLight);
let mesh;
if (extension != 'STL') {
loader.load(file, function (object) {
var objBbox = new THREE.Box3().setFromObject(object);
// Geometry vertices centering to world axis
var bboxCenter = objBbox.getCenter(new THREE.Vector3()).clone();
bboxCenter.multiplyScalar(-1);
object.traverse(function (child) {
if (child instanceof THREE.Mesh) {
child.geometry.translate(bboxCenter.x, bboxCenter.y, bboxCenter.z);
}
if (settings.threejs.SphereMapUrl != '') {
const texture = new THREE.TextureLoader().load(settings.threejs.SphereMapUrl);
const material = new THREE.MeshBasicMaterial({map: texture});
child.material = material;
}
});
objBbox.setFromObject(object); // Update the bounding box
scene.add(object);
});
} else {
var material = new THREE.MeshPhongMaterial( { color: 0x004C00, specular: 0x111111, shininess: 300 } );
var grid = new THREE.GridHelper( 500, 500, 0x444444, 0x555555 );
grid.rotateOnAxis( new THREE.Vector3( 1, 0, 0 ), 90 * ( Math.PI/180 ) );
scene.add( grid );
loader.load( file, function ( geometry ) {
var mesh = new THREE.Mesh( geometry, material );
mesh.position.set( 0, 0, 0 );
mesh.rotation.set( 0, 0, 0 );
mesh.scale.set( .08, .08, .08 );
mesh.castShadow = true;
mesh.receiveShadow = true;
scene.add( mesh );
render();
});
}
// Add OrbitControls so that we can pan around with the mouse.
let controls = new THREE.OrbitControls(camera, renderer.domElement);
controls.enableDamping = false;
controls.dampingFactor = 0.25;
controls.enableZoom = true;
controls.autoRotate = true;
controls.autoRotateSpeed = 1;
render();
function render() {
// render using requestAnimationFrame
requestAnimationFrame(render);
if (mesh && settings.threejs.InitRotationX != '') {
mesh.rotation.x -= 0.01;
}
if (mesh && settings.threejs.InitRotationY != '') {
mesh.rotation.y -= 0.01;
}
if (mesh && settings.threejs.InitRotationZ != '') {
mesh.rotation.z -= 0.01;
}
renderer.render(scene, camera);
}
});
}
};
}(jQuery, Drupal, drupalSettings, once));
As you can see I focused on STL output, adding a grid and changing the perspective camera, that was the reason why the object was disappearing when zooming out.
These settings are good for a canvas with width of 100% of it's container (1170px for a bootstrap container), I think the next steps are:
- setting a color for the texture of the object (as you can see I foced the green color for STLs)
- setting an option to display or not the grid
- setting for a default zoom
If you need a hand I can help you, I'll learn how to generate patches so we can develop more faster!
Patch works, tested module on Drupal 10.0.3 without problems!
Thank you very much for your support, I hope you will have time to make this module the best 3D viewer for Drupal ;)
Thank you very much, you solved my issue!
In my controller I changed the code to this:
// Get the custom string
$renderer = \Drupal::service('renderer');
$config = \Drupal::config('helloworld.settings');
$build = [
'#markup' => $this->t("Custom message: @custom_message", [
'@custom_message' => $config->get('custom_message')
]),
'#cache' => [
'contexts' => [
'user',
],
],
];
$renderer->addCacheableDependency($build, $config);
return $build;
Every time I visit the output page I see the updated value of "custom_message" from helloworld.settings, I don't know if the context "user" is the more appropriated but for now it works!
I know I'm only on "Hello world" module but I'm interested to know how to make a module for future and more complex development.
Searching "cache contexts to the render" I see I should use services in my module, so I can tag it and clear cache by tag on formSubmit function, correct?
Ok I installed your module from zero, now I have ver. 1.0.4 and I made these tests:
- viewing stl file generates this error: TypeError: t.updateWorldMatrix is not a function --> STLLoader.js:83
- viewing obj file I don't have errors but I see the 3d object so big that I can't understand what is it, if I try to zoom out the object disappears in a white frame even if I setted a black background
I used also //cdn.jsdelivr.net/npm/three@0.147.0 as threejs source and it works really well!
I tried now but nothing changes.
The value is stored correctly in the settings page and it loads without problems when I set that as default value:
public function buildForm(array $form, FormStateInterface $form_state) {
$form['custom_message'] = [
'#type' => 'textfield',
'#title' => $this->t('Custom Message'),
'#default_value' => $this->config('helloworld.settings')->get('custom_message'),
'#description' => $this->t('Set a custom message'),
'#cache'=> FALSE
];
return parent::buildForm($form, $form_state);
}
The real problem is the output in the custom page.
I updated to last dev release, but I think you forgot to change the function "file_create_url($model_uri)" to "\Drupal::service('file_url_generator')->generateAbsoluteString(($model_uri))" and now the error "THREE is not defined" is back.
Did you changed only the javascript and not the other things?
I applied your patch on threejs.init.js but with both STL files and obj files I get this javascript error:
Uncaught TypeError: Cannot read properties of undefined (reading 'split')
Thank you lazzyvn, I tried the dev version but when I go to view the field in a node i get the following error on chrome console:
Uncaught TypeError: $(...).once is not a function
I see you declared core/once correctly in the threejs.libraries.yml but maybe you need to fix the javascripts with this guide: https://www.drupal.org/node/3158256 →
I'm sorry but I'm studying for drupal module development and I don't know how to create patches, I can only tell you where module generates errors and why.